{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

Represents a git submodule.
-}

module GI.Ggit.Structs.Submodule
    ( 

-- * Exported types
    Submodule(..)                           ,
    noSubmodule                             ,


 -- * Methods
-- ** getFetchRecurse #method:getFetchRecurse#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleGetFetchRecurseMethodInfo      ,
#endif
    submoduleGetFetchRecurse                ,


-- ** getHeadId #method:getHeadId#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleGetHeadIdMethodInfo            ,
#endif
    submoduleGetHeadId                      ,


-- ** getIgnore #method:getIgnore#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleGetIgnoreMethodInfo            ,
#endif
    submoduleGetIgnore                      ,


-- ** getIndexId #method:getIndexId#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleGetIndexIdMethodInfo           ,
#endif
    submoduleGetIndexId                     ,


-- ** getName #method:getName#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleGetNameMethodInfo              ,
#endif
    submoduleGetName                        ,


-- ** getOwner #method:getOwner#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleGetOwnerMethodInfo             ,
#endif
    submoduleGetOwner                       ,


-- ** getPath #method:getPath#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleGetPathMethodInfo              ,
#endif
    submoduleGetPath                        ,


-- ** getUpdate #method:getUpdate#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleGetUpdateMethodInfo            ,
#endif
    submoduleGetUpdate                      ,


-- ** getUrl #method:getUrl#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleGetUrlMethodInfo               ,
#endif
    submoduleGetUrl                         ,


-- ** getWorkdirId #method:getWorkdirId#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleGetWorkdirIdMethodInfo         ,
#endif
    submoduleGetWorkdirId                   ,


-- ** init #method:init#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleInitMethodInfo                 ,
#endif
    submoduleInit                           ,


-- ** open #method:open#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleOpenMethodInfo                 ,
#endif
    submoduleOpen                           ,


-- ** ref #method:ref#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleRefMethodInfo                  ,
#endif
    submoduleRef                            ,


-- ** reload #method:reload#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleReloadMethodInfo               ,
#endif
    submoduleReload                         ,


-- ** sync #method:sync#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleSyncMethodInfo                 ,
#endif
    submoduleSync                           ,


-- ** unref #method:unref#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SubmoduleUnrefMethodInfo                ,
#endif
    submoduleUnref                          ,




    ) 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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 {-# SOURCE #-} qualified GI.Ggit.Enums as Ggit.Enums
import {-# SOURCE #-} qualified GI.Ggit.Objects.Repository as Ggit.Repository
import {-# SOURCE #-} qualified GI.Ggit.Structs.OId as Ggit.OId

newtype Submodule = Submodule (ManagedPtr Submodule)
foreign import ccall "ggit_submodule_get_type" c_ggit_submodule_get_type :: 
    IO GType

instance BoxedObject Submodule where
    boxedType _ = c_ggit_submodule_get_type

noSubmodule :: Maybe Submodule
noSubmodule = Nothing


#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList Submodule
type instance O.AttributeList Submodule = SubmoduleAttributeList
type SubmoduleAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method Submodule::get_fetch_recurse
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "submodule", argType = TInterface (Name {namespace = "Ggit", name = "Submodule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitSubmodule.", 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_submodule_get_fetch_recurse" ggit_submodule_get_fetch_recurse :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO CInt

{- |
Gets whether to fetch recursively. See see gitmodules(5) fetchRecurseSubmodules.
-}
submoduleGetFetchRecurse ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m Bool
    {- ^ __Returns:__ whether or not fetch recursively. -}
submoduleGetFetchRecurse submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    result <- ggit_submodule_get_fetch_recurse submodule'
    let result' = (/= 0) result
    touchManagedPtr submodule
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleGetFetchRecurseMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo SubmoduleGetFetchRecurseMethodInfo Submodule signature where
    overloadedMethod _ = submoduleGetFetchRecurse

#endif

-- method Submodule::get_head_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "submodule", argType = TInterface (Name {namespace = "Ggit", name = "Submodule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, 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_submodule_get_head_id" ggit_submodule_get_head_id :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO (Ptr Ggit.OId.OId)

{- |
/No description available in the introspection data./
-}
submoduleGetHeadId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    -> m Ggit.OId.OId
submoduleGetHeadId submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    result <- ggit_submodule_get_head_id submodule'
    checkUnexpectedReturnNULL "submoduleGetHeadId" result
    result' <- (wrapBoxed Ggit.OId.OId) result
    touchManagedPtr submodule
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleGetHeadIdMethodInfo
instance (signature ~ (m Ggit.OId.OId), MonadIO m) => O.MethodInfo SubmoduleGetHeadIdMethodInfo Submodule signature where
    overloadedMethod _ = submoduleGetHeadId

#endif

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

foreign import ccall "ggit_submodule_get_ignore" ggit_submodule_get_ignore :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO CUInt

{- |
Gets a 'GI.Ggit.Enums.SubmoduleIgnore'. See see gitmodules(5) ignore.
-}
submoduleGetIgnore ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m Ggit.Enums.SubmoduleIgnore
    {- ^ __Returns:__ the 'GI.Ggit.Enums.SubmoduleIgnore'. -}
submoduleGetIgnore submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    result <- ggit_submodule_get_ignore submodule'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr submodule
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleGetIgnoreMethodInfo
instance (signature ~ (m Ggit.Enums.SubmoduleIgnore), MonadIO m) => O.MethodInfo SubmoduleGetIgnoreMethodInfo Submodule signature where
    overloadedMethod _ = submoduleGetIgnore

#endif

-- method Submodule::get_index_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "submodule", argType = TInterface (Name {namespace = "Ggit", name = "Submodule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitSubmodule.", 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_submodule_get_index_id" ggit_submodule_get_index_id :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO (Ptr Ggit.OId.OId)

{- |
Gets the OID for the submodule in the index or 'Nothing' if there is no index.
-}
submoduleGetIndexId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m (Maybe Ggit.OId.OId)
    {- ^ __Returns:__ the OID for the submodule in the index or 'Nothing'. -}
submoduleGetIndexId submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    result <- ggit_submodule_get_index_id submodule'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Ggit.OId.OId) result'
        return result''
    touchManagedPtr submodule
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleGetIndexIdMethodInfo
instance (signature ~ (m (Maybe Ggit.OId.OId)), MonadIO m) => O.MethodInfo SubmoduleGetIndexIdMethodInfo Submodule signature where
    overloadedMethod _ = submoduleGetIndexId

#endif

-- method Submodule::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "submodule", argType = TInterface (Name {namespace = "Ggit", name = "Submodule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitSubmodule.", 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_submodule_get_name" ggit_submodule_get_name :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO CString

{- |
Gets the name of the submodule from .gitmodules.
-}
submoduleGetName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m T.Text
    {- ^ __Returns:__ the name of the submodule from .gitmodules. -}
submoduleGetName submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    result <- ggit_submodule_get_name submodule'
    checkUnexpectedReturnNULL "submoduleGetName" result
    result' <- cstringToText result
    touchManagedPtr submodule
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo SubmoduleGetNameMethodInfo Submodule signature where
    overloadedMethod _ = submoduleGetName

#endif

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

foreign import ccall "ggit_submodule_get_owner" ggit_submodule_get_owner :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO (Ptr Ggit.Repository.Repository)

{- |
Gets the containing repository for a submodule.
-}
submoduleGetOwner ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m Ggit.Repository.Repository
    {- ^ __Returns:__ the containing repository for a submodule. -}
submoduleGetOwner submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    result <- ggit_submodule_get_owner submodule'
    checkUnexpectedReturnNULL "submoduleGetOwner" result
    result' <- (wrapObject Ggit.Repository.Repository) result
    touchManagedPtr submodule
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleGetOwnerMethodInfo
instance (signature ~ (m Ggit.Repository.Repository), MonadIO m) => O.MethodInfo SubmoduleGetOwnerMethodInfo Submodule signature where
    overloadedMethod _ = submoduleGetOwner

#endif

-- method Submodule::get_path
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "submodule", argType = TInterface (Name {namespace = "Ggit", name = "Submodule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitSubmodule.", 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_submodule_get_path" ggit_submodule_get_path :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO CString

{- |
Gets the path to the submodule from the repo working directory.
It is almost always the same as the name.
See 'GI.Ggit.Structs.Submodule.submoduleGetName'.
-}
submoduleGetPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m T.Text
    {- ^ __Returns:__ the path to the submodule from the repo working directory. -}
submoduleGetPath submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    result <- ggit_submodule_get_path submodule'
    checkUnexpectedReturnNULL "submoduleGetPath" result
    result' <- cstringToText result
    touchManagedPtr submodule
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleGetPathMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo SubmoduleGetPathMethodInfo Submodule signature where
    overloadedMethod _ = submoduleGetPath

#endif

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

foreign import ccall "ggit_submodule_get_update" ggit_submodule_get_update :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO CUInt

{- |
Gets a 'GI.Ggit.Enums.SubmoduleUpdate'. See see gitmodules(5) update.
-}
submoduleGetUpdate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m Ggit.Enums.SubmoduleUpdate
    {- ^ __Returns:__ the 'GI.Ggit.Enums.SubmoduleUpdate'. -}
submoduleGetUpdate submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    result <- ggit_submodule_get_update submodule'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr submodule
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleGetUpdateMethodInfo
instance (signature ~ (m Ggit.Enums.SubmoduleUpdate), MonadIO m) => O.MethodInfo SubmoduleGetUpdateMethodInfo Submodule signature where
    overloadedMethod _ = submoduleGetUpdate

#endif

-- method Submodule::get_url
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "submodule", argType = TInterface (Name {namespace = "Ggit", name = "Submodule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitSubmodule.", 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_submodule_get_url" ggit_submodule_get_url :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO CString

{- |
Gets the url for the submodule or 'Nothing' if the submodule has been deleted
but not yet committed.
-}
submoduleGetUrl ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m T.Text
    {- ^ __Returns:__ the url for the submodule. -}
submoduleGetUrl submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    result <- ggit_submodule_get_url submodule'
    checkUnexpectedReturnNULL "submoduleGetUrl" result
    result' <- cstringToText result
    touchManagedPtr submodule
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleGetUrlMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo SubmoduleGetUrlMethodInfo Submodule signature where
    overloadedMethod _ = submoduleGetUrl

#endif

-- method Submodule::get_workdir_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "submodule", argType = TInterface (Name {namespace = "Ggit", name = "Submodule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitSubmodule.", 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_submodule_get_workdir_id" ggit_submodule_get_workdir_id :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO (Ptr Ggit.OId.OId)

{- |
Gets the OID for the submodule in the current working directory.
Corresponds to looking up \'HEAD\' in the checked out submodule.
If there are pending changes in the index or anything
else, this won\'t notice that.  You should call @/ggit_submodule_status()/@
for a more complete picture about the state of the working directory.
-}
submoduleGetWorkdirId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m (Maybe Ggit.OId.OId)
    {- ^ __Returns:__ the OID for the submodule in the current working directory or 'Nothing'. -}
submoduleGetWorkdirId submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    result <- ggit_submodule_get_workdir_id submodule'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Ggit.OId.OId) result'
        return result''
    touchManagedPtr submodule
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleGetWorkdirIdMethodInfo
instance (signature ~ (m (Maybe Ggit.OId.OId)), MonadIO m) => O.MethodInfo SubmoduleGetWorkdirIdMethodInfo Submodule signature where
    overloadedMethod _ = submoduleGetWorkdirId

#endif

-- method Submodule::init
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "submodule", argType = TInterface (Name {namespace = "Ggit", name = "Submodule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitSubmodule.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "overwrite", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "forces existing entries to be updated.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : True
-- Skip return : False

foreign import ccall "ggit_submodule_init" ggit_submodule_init :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    CInt ->                                 -- overwrite : TBasicType TBoolean
    Ptr (Ptr GError) ->                     -- error
    IO ()

{- |
Just like \"git submodule init\", this copies information about the
submodule into \".git\/config\".  You can use the accessor functions
above to alter the in-memory git_submodule object and control what
is written to the config, overriding what is in .gitmodules.
-}
submoduleInit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> Bool
    {- ^ /@overwrite@/: forces existing entries to be updated. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
submoduleInit submodule overwrite = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    let overwrite' = (fromIntegral . fromEnum) overwrite
    onException (do
        propagateGError $ ggit_submodule_init submodule' overwrite'
        touchManagedPtr submodule
        return ()
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleInitMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.MethodInfo SubmoduleInitMethodInfo Submodule signature where
    overloadedMethod _ = submoduleInit

#endif

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

foreign import ccall "ggit_submodule_open" ggit_submodule_open :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Ggit.Repository.Repository)

{- |
Open the repository for a submodule. Multiple calls to this function
will return distinct 'GI.Ggit.Objects.Repository.Repository' objects. Only submodules which are
checked out in the working directory can be opened.
-}
submoduleOpen ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m Ggit.Repository.Repository
    {- ^ __Returns:__ the opened 'GI.Ggit.Objects.Repository.Repository' or 'Nothing' in case of an
                          error. /(Can throw 'Data.GI.Base.GError.GError')/ -}
submoduleOpen submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    onException (do
        result <- propagateGError $ ggit_submodule_open submodule'
        checkUnexpectedReturnNULL "submoduleOpen" result
        result' <- (wrapObject Ggit.Repository.Repository) result
        touchManagedPtr submodule
        return result'
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleOpenMethodInfo
instance (signature ~ (m Ggit.Repository.Repository), MonadIO m) => O.MethodInfo SubmoduleOpenMethodInfo Submodule signature where
    overloadedMethod _ = submoduleOpen

#endif

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

foreign import ccall "ggit_submodule_ref" ggit_submodule_ref :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO (Ptr Submodule)

{- |
Atomically increments the reference count of /@submodule@/ by one.
This function is MT-safe and may be called from any thread.
-}
submoduleRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m Submodule
    {- ^ __Returns:__ the passed in 'GI.Ggit.Structs.Submodule.Submodule'. -}
submoduleRef submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    result <- ggit_submodule_ref submodule'
    checkUnexpectedReturnNULL "submoduleRef" result
    result' <- (newBoxed Submodule) result
    touchManagedPtr submodule
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleRefMethodInfo
instance (signature ~ (m Submodule), MonadIO m) => O.MethodInfo SubmoduleRefMethodInfo Submodule signature where
    overloadedMethod _ = submoduleRef

#endif

-- method Submodule::reload
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "submodule", argType = TInterface (Name {namespace = "Ggit", name = "Submodule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitSubmodule.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "force", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "reload even if the data doesn't seem out of date.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : True
-- Skip return : False

foreign import ccall "ggit_submodule_reload" ggit_submodule_reload :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    CInt ->                                 -- force : TBasicType TBoolean
    Ptr (Ptr GError) ->                     -- error
    IO ()

{- |
Rereads submodule info from config, index, and HEAD.
Call this if you have reason to believe that it has changed.
-}
submoduleReload ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> Bool
    {- ^ /@force@/: reload even if the data doesn\'t seem out of date. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
submoduleReload submodule force = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    let force' = (fromIntegral . fromEnum) force
    onException (do
        propagateGError $ ggit_submodule_reload submodule' force'
        touchManagedPtr submodule
        return ()
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleReloadMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.MethodInfo SubmoduleReloadMethodInfo Submodule signature where
    overloadedMethod _ = submoduleReload

#endif

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

foreign import ccall "ggit_submodule_sync" ggit_submodule_sync :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    Ptr (Ptr GError) ->                     -- error
    IO ()

{- |
Copies the information about the submodules URL into the checked out
submodule config, acting like \"git submodule sync\".  This is useful if
you have altered the URL for the submodule (or it has been altered by a
fetch of upstream changes) and you need to update your local repo.
-}
submoduleSync ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
submoduleSync submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    onException (do
        propagateGError $ ggit_submodule_sync submodule'
        touchManagedPtr submodule
        return ()
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleSyncMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo SubmoduleSyncMethodInfo Submodule signature where
    overloadedMethod _ = submoduleSync

#endif

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

foreign import ccall "ggit_submodule_unref" ggit_submodule_unref :: 
    Ptr Submodule ->                        -- submodule : TInterface (Name {namespace = "Ggit", name = "Submodule"})
    IO ()

{- |
Atomically decrements the reference count of /@submodule@/ by one.
If the reference count drops to 0, /@remote@/ is freed.
-}
submoduleUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Submodule
    {- ^ /@submodule@/: a 'GI.Ggit.Structs.Submodule.Submodule'. -}
    -> m ()
submoduleUnref submodule = liftIO $ do
    submodule' <- unsafeManagedPtrGetPtr submodule
    ggit_submodule_unref submodule'
    touchManagedPtr submodule
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SubmoduleUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo SubmoduleUnrefMethodInfo Submodule signature where
    overloadedMethod _ = submoduleUnref

#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveSubmoduleMethod (t :: Symbol) (o :: *) :: * where
    ResolveSubmoduleMethod "init" o = SubmoduleInitMethodInfo
    ResolveSubmoduleMethod "open" o = SubmoduleOpenMethodInfo
    ResolveSubmoduleMethod "ref" o = SubmoduleRefMethodInfo
    ResolveSubmoduleMethod "reload" o = SubmoduleReloadMethodInfo
    ResolveSubmoduleMethod "sync" o = SubmoduleSyncMethodInfo
    ResolveSubmoduleMethod "unref" o = SubmoduleUnrefMethodInfo
    ResolveSubmoduleMethod "getFetchRecurse" o = SubmoduleGetFetchRecurseMethodInfo
    ResolveSubmoduleMethod "getHeadId" o = SubmoduleGetHeadIdMethodInfo
    ResolveSubmoduleMethod "getIgnore" o = SubmoduleGetIgnoreMethodInfo
    ResolveSubmoduleMethod "getIndexId" o = SubmoduleGetIndexIdMethodInfo
    ResolveSubmoduleMethod "getName" o = SubmoduleGetNameMethodInfo
    ResolveSubmoduleMethod "getOwner" o = SubmoduleGetOwnerMethodInfo
    ResolveSubmoduleMethod "getPath" o = SubmoduleGetPathMethodInfo
    ResolveSubmoduleMethod "getUpdate" o = SubmoduleGetUpdateMethodInfo
    ResolveSubmoduleMethod "getUrl" o = SubmoduleGetUrlMethodInfo
    ResolveSubmoduleMethod "getWorkdirId" o = SubmoduleGetWorkdirIdMethodInfo
    ResolveSubmoduleMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSubmoduleMethod t Submodule, O.MethodInfo info Submodule p) => O.IsLabelProxy t (Submodule -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveSubmoduleMethod t Submodule, O.MethodInfo info Submodule p) => O.IsLabel t (Submodule -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif