{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Represents a blame hunk.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Ggit.Structs.BlameHunk
    (

-- * Exported types
    BlameHunk(..)                           ,
    noBlameHunk                             ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveBlameHunkMethod                  ,
#endif


-- ** getFinalCommitId #method:getFinalCommitId#

#if defined(ENABLE_OVERLOADING)
    BlameHunkGetFinalCommitIdMethodInfo     ,
#endif
    blameHunkGetFinalCommitId               ,


-- ** getFinalSignature #method:getFinalSignature#

#if defined(ENABLE_OVERLOADING)
    BlameHunkGetFinalSignatureMethodInfo    ,
#endif
    blameHunkGetFinalSignature              ,


-- ** getFinalStartLineNumber #method:getFinalStartLineNumber#

#if defined(ENABLE_OVERLOADING)
    BlameHunkGetFinalStartLineNumberMethodInfo,
#endif
    blameHunkGetFinalStartLineNumber        ,


-- ** getLinesInHunk #method:getLinesInHunk#

#if defined(ENABLE_OVERLOADING)
    BlameHunkGetLinesInHunkMethodInfo       ,
#endif
    blameHunkGetLinesInHunk                 ,


-- ** getOrigCommitId #method:getOrigCommitId#

#if defined(ENABLE_OVERLOADING)
    BlameHunkGetOrigCommitIdMethodInfo      ,
#endif
    blameHunkGetOrigCommitId                ,


-- ** getOrigPath #method:getOrigPath#

#if defined(ENABLE_OVERLOADING)
    BlameHunkGetOrigPathMethodInfo          ,
#endif
    blameHunkGetOrigPath                    ,


-- ** getOrigSignature #method:getOrigSignature#

#if defined(ENABLE_OVERLOADING)
    BlameHunkGetOrigSignatureMethodInfo     ,
#endif
    blameHunkGetOrigSignature               ,


-- ** getOrigStartLineNumber #method:getOrigStartLineNumber#

#if defined(ENABLE_OVERLOADING)
    BlameHunkGetOrigStartLineNumberMethodInfo,
#endif
    blameHunkGetOrigStartLineNumber         ,


-- ** isBoundary #method:isBoundary#

#if defined(ENABLE_OVERLOADING)
    BlameHunkIsBoundaryMethodInfo           ,
#endif
    blameHunkIsBoundary                     ,


-- ** ref #method:ref#

#if defined(ENABLE_OVERLOADING)
    BlameHunkRefMethodInfo                  ,
#endif
    blameHunkRef                            ,


-- ** unref #method:unref#

#if defined(ENABLE_OVERLOADING)
    BlameHunkUnrefMethodInfo                ,
#endif
    blameHunkUnref                          ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import {-# SOURCE #-} qualified GI.Ggit.Objects.Signature as Ggit.Signature
import {-# SOURCE #-} qualified GI.Ggit.Structs.OId as Ggit.OId

-- | Memory-managed wrapper type.
newtype BlameHunk = BlameHunk (ManagedPtr BlameHunk)
    deriving (Eq)
foreign import ccall "ggit_blame_hunk_get_type" c_ggit_blame_hunk_get_type ::
    IO GType

instance BoxedObject BlameHunk where
    boxedType _ = c_ggit_blame_hunk_get_type

-- | Convert 'BlameHunk' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue BlameHunk where
    toGValue o = do
        gtype <- c_ggit_blame_hunk_get_type
        B.ManagedPtr.withManagedPtr o (B.GValue.buildGValue gtype B.GValue.set_boxed)

    fromGValue gv = do
        ptr <- B.GValue.get_boxed gv :: IO (Ptr BlameHunk)
        B.ManagedPtr.newBoxed BlameHunk ptr



-- | A convenience alias for `Nothing` :: `Maybe` `BlameHunk`.
noBlameHunk :: Maybe BlameHunk
noBlameHunk = Nothing


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList BlameHunk
type instance O.AttributeList BlameHunk = BlameHunkAttributeList
type BlameHunkAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method BlameHunk::get_final_commit_id
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "blame_hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "BlameHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitBlameHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Ggit" , name = "OId" })
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_final_commit_id" ggit_blame_hunk_get_final_commit_id ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO (Ptr Ggit.OId.OId)

-- | Get the id of the commit where this hunk was last changed.
blameHunkGetFinalCommitId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    -- ^ /@blameHunk@/: a t'GI.Ggit.Structs.BlameHunk.BlameHunk'.
    -> m (Maybe Ggit.OId.OId)
    -- ^ __Returns:__ a t'GI.Ggit.Structs.OId.OId' or 'P.Nothing'.
blameHunkGetFinalCommitId blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_final_commit_id blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Ggit.OId.OId) result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data BlameHunkGetFinalCommitIdMethodInfo
instance (signature ~ (m (Maybe Ggit.OId.OId)), MonadIO m) => O.MethodInfo BlameHunkGetFinalCommitIdMethodInfo BlameHunk signature where
    overloadedMethod = blameHunkGetFinalCommitId

#endif

-- method BlameHunk::get_final_signature
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "blame_hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "BlameHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitBlameHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Ggit" , name = "Signature" })
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_final_signature" ggit_blame_hunk_get_final_signature ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO (Ptr Ggit.Signature.Signature)

-- | Get the signature of the final version of the hunk.
blameHunkGetFinalSignature ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    -- ^ /@blameHunk@/: a t'GI.Ggit.Structs.BlameHunk.BlameHunk'.
    -> m (Maybe Ggit.Signature.Signature)
    -- ^ __Returns:__ a t'GI.Ggit.Objects.Signature.Signature' or 'P.Nothing'.
blameHunkGetFinalSignature blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_final_signature blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Ggit.Signature.Signature) result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data BlameHunkGetFinalSignatureMethodInfo
instance (signature ~ (m (Maybe Ggit.Signature.Signature)), MonadIO m) => O.MethodInfo BlameHunkGetFinalSignatureMethodInfo BlameHunk signature where
    overloadedMethod = blameHunkGetFinalSignature

#endif

-- method BlameHunk::get_final_start_line_number
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "blame_hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "BlameHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitBlameHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt16)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_final_start_line_number" ggit_blame_hunk_get_final_start_line_number ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO Word16

-- | Get the line number where the hunk begins in the final version of the file.
-- Line numbers start at 1.
blameHunkGetFinalStartLineNumber ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    -- ^ /@blameHunk@/: a t'GI.Ggit.Structs.BlameHunk.BlameHunk'.
    -> m Word16
    -- ^ __Returns:__ the final hunk line number.
blameHunkGetFinalStartLineNumber blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_final_start_line_number blameHunk'
    touchManagedPtr blameHunk
    return result

#if defined(ENABLE_OVERLOADING)
data BlameHunkGetFinalStartLineNumberMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.MethodInfo BlameHunkGetFinalStartLineNumberMethodInfo BlameHunk signature where
    overloadedMethod = blameHunkGetFinalStartLineNumber

#endif

-- method BlameHunk::get_lines_in_hunk
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "blame_hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "BlameHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitBlameHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt16)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_lines_in_hunk" ggit_blame_hunk_get_lines_in_hunk ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO Word16

-- | Get the number of lines in the hunk.
blameHunkGetLinesInHunk ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    -- ^ /@blameHunk@/: a t'GI.Ggit.Structs.BlameHunk.BlameHunk'.
    -> m Word16
    -- ^ __Returns:__ the number of lines in the hunk.
blameHunkGetLinesInHunk blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_lines_in_hunk blameHunk'
    touchManagedPtr blameHunk
    return result

#if defined(ENABLE_OVERLOADING)
data BlameHunkGetLinesInHunkMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.MethodInfo BlameHunkGetLinesInHunkMethodInfo BlameHunk signature where
    overloadedMethod = blameHunkGetLinesInHunk

#endif

-- method BlameHunk::get_orig_commit_id
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "blame_hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "BlameHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitBlameHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Ggit" , name = "OId" })
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_orig_commit_id" ggit_blame_hunk_get_orig_commit_id ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO (Ptr Ggit.OId.OId)

-- | Get the id of the commit where the hunk was found. This is usually the same
-- the final commit id, except when @/GGIT_BLAME_TRACK_COPIES_ANY_COMMIT/@ was used.
blameHunkGetOrigCommitId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    -- ^ /@blameHunk@/: a t'GI.Ggit.Structs.BlameHunk.BlameHunk'.
    -> m (Maybe Ggit.OId.OId)
    -- ^ __Returns:__ a t'GI.Ggit.Structs.OId.OId' or 'P.Nothing'.
blameHunkGetOrigCommitId blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_orig_commit_id blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Ggit.OId.OId) result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data BlameHunkGetOrigCommitIdMethodInfo
instance (signature ~ (m (Maybe Ggit.OId.OId)), MonadIO m) => O.MethodInfo BlameHunkGetOrigCommitIdMethodInfo BlameHunk signature where
    overloadedMethod = blameHunkGetOrigCommitId

#endif

-- method BlameHunk::get_orig_path
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "blame_hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "BlameHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitBlameHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_orig_path" ggit_blame_hunk_get_orig_path ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO CString

-- | Get the path of the file where this hunk originated, as of the commit
-- specified by @/ggit_blame_hunk_get_orig_commit_id/@.
blameHunkGetOrigPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    -- ^ /@blameHunk@/: a t'GI.Ggit.Structs.BlameHunk.BlameHunk'.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ the path or 'P.Nothing'.
blameHunkGetOrigPath blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_orig_path blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data BlameHunkGetOrigPathMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.MethodInfo BlameHunkGetOrigPathMethodInfo BlameHunk signature where
    overloadedMethod = blameHunkGetOrigPath

#endif

-- method BlameHunk::get_orig_signature
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "blame_hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "BlameHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitBlameHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Ggit" , name = "Signature" })
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_orig_signature" ggit_blame_hunk_get_orig_signature ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO (Ptr Ggit.Signature.Signature)

-- | Get the signature of the commit specified by @/ggit_blame_hunk_get_orig_commit_id/@.
blameHunkGetOrigSignature ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    -- ^ /@blameHunk@/: a t'GI.Ggit.Structs.BlameHunk.BlameHunk'.
    -> m (Maybe Ggit.Signature.Signature)
    -- ^ __Returns:__ a t'GI.Ggit.Objects.Signature.Signature' or 'P.Nothing'.
blameHunkGetOrigSignature blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_orig_signature blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Ggit.Signature.Signature) result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data BlameHunkGetOrigSignatureMethodInfo
instance (signature ~ (m (Maybe Ggit.Signature.Signature)), MonadIO m) => O.MethodInfo BlameHunkGetOrigSignatureMethodInfo BlameHunk signature where
    overloadedMethod = blameHunkGetOrigSignature

#endif

-- method BlameHunk::get_orig_start_line_number
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "blame_hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "BlameHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitBlameHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt16)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_orig_start_line_number" ggit_blame_hunk_get_orig_start_line_number ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO Word16

-- | Get the line number where the hunk begins in the file specified by
-- @/ggit_blame_hunk_get_orig_path/@ at the commit specified by
-- @/ggit_blame_hunk_get_orig_commit_id/@. Line numbers start at 1.
blameHunkGetOrigStartLineNumber ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    -- ^ /@blameHunk@/: a t'GI.Ggit.Structs.BlameHunk.BlameHunk'.
    -> m Word16
    -- ^ __Returns:__ the orig hunk line number.
blameHunkGetOrigStartLineNumber blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_orig_start_line_number blameHunk'
    touchManagedPtr blameHunk
    return result

#if defined(ENABLE_OVERLOADING)
data BlameHunkGetOrigStartLineNumberMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.MethodInfo BlameHunkGetOrigStartLineNumberMethodInfo BlameHunk signature where
    overloadedMethod = blameHunkGetOrigStartLineNumber

#endif

-- method BlameHunk::is_boundary
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "blame_hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "BlameHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitBlameHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_is_boundary" ggit_blame_hunk_is_boundary ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO CInt

-- | Get whether the hunk has been tracked to a boundary commit (the root,
-- or the commit specified in @/ggit_blame_options_set_oldest_commit/@).
blameHunkIsBoundary ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    -- ^ /@blameHunk@/: a t'GI.Ggit.Structs.BlameHunk.BlameHunk'.
    -> m Bool
    -- ^ __Returns:__ whether the hunk is at a boundary commit.
blameHunkIsBoundary blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_is_boundary blameHunk'
    let result' = (/= 0) result
    touchManagedPtr blameHunk
    return result'

#if defined(ENABLE_OVERLOADING)
data BlameHunkIsBoundaryMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo BlameHunkIsBoundaryMethodInfo BlameHunk signature where
    overloadedMethod = blameHunkIsBoundary

#endif

-- method BlameHunk::ref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "blame_hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "BlameHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitBlameHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Ggit" , name = "BlameHunk" })
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_ref" ggit_blame_hunk_ref ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO (Ptr BlameHunk)

-- | Atomically increments the reference count of /@blameHunk@/ by one.
-- This function is MT-safe and may be called from any thread.
blameHunkRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    -- ^ /@blameHunk@/: a t'GI.Ggit.Structs.BlameHunk.BlameHunk'.
    -> m (Maybe BlameHunk)
    -- ^ __Returns:__ a t'GI.Ggit.Structs.BlameHunk.BlameHunk' or 'P.Nothing'.
blameHunkRef blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_ref blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed BlameHunk) result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data BlameHunkRefMethodInfo
instance (signature ~ (m (Maybe BlameHunk)), MonadIO m) => O.MethodInfo BlameHunkRefMethodInfo BlameHunk signature where
    overloadedMethod = blameHunkRef

#endif

-- method BlameHunk::unref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "blame_hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "BlameHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitBlameHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_unref" ggit_blame_hunk_unref ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO ()

-- | Atomically decrements the reference count of /@blameHunk@/ by one.
-- If the reference count drops to 0, /@blameHunk@/ is freed.
blameHunkUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    -- ^ /@blameHunk@/: a t'GI.Ggit.Structs.BlameHunk.BlameHunk'.
    -> m ()
blameHunkUnref blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    ggit_blame_hunk_unref blameHunk'
    touchManagedPtr blameHunk
    return ()

#if defined(ENABLE_OVERLOADING)
data BlameHunkUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo BlameHunkUnrefMethodInfo BlameHunk signature where
    overloadedMethod = blameHunkUnref

#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveBlameHunkMethod (t :: Symbol) (o :: *) :: * where
    ResolveBlameHunkMethod "isBoundary" o = BlameHunkIsBoundaryMethodInfo
    ResolveBlameHunkMethod "ref" o = BlameHunkRefMethodInfo
    ResolveBlameHunkMethod "unref" o = BlameHunkUnrefMethodInfo
    ResolveBlameHunkMethod "getFinalCommitId" o = BlameHunkGetFinalCommitIdMethodInfo
    ResolveBlameHunkMethod "getFinalSignature" o = BlameHunkGetFinalSignatureMethodInfo
    ResolveBlameHunkMethod "getFinalStartLineNumber" o = BlameHunkGetFinalStartLineNumberMethodInfo
    ResolveBlameHunkMethod "getLinesInHunk" o = BlameHunkGetLinesInHunkMethodInfo
    ResolveBlameHunkMethod "getOrigCommitId" o = BlameHunkGetOrigCommitIdMethodInfo
    ResolveBlameHunkMethod "getOrigPath" o = BlameHunkGetOrigPathMethodInfo
    ResolveBlameHunkMethod "getOrigSignature" o = BlameHunkGetOrigSignatureMethodInfo
    ResolveBlameHunkMethod "getOrigStartLineNumber" o = BlameHunkGetOrigStartLineNumberMethodInfo
    ResolveBlameHunkMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveBlameHunkMethod t BlameHunk, O.MethodInfo info BlameHunk p) => OL.IsLabel t (BlameHunk -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif