{- |
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 an resolve undo index entry object.
-}

module GI.Ggit.Structs.IndexEntryResolveUndo
    ( 

-- * Exported types
    IndexEntryResolveUndo(..)               ,
    noIndexEntryResolveUndo                 ,


 -- * Methods
-- ** getFile #method:getFile#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    IndexEntryResolveUndoGetFileMethodInfo  ,
#endif
    indexEntryResolveUndoGetFile            ,


-- ** getId #method:getId#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    IndexEntryResolveUndoGetIdMethodInfo    ,
#endif
    indexEntryResolveUndoGetId              ,


-- ** getMode #method:getMode#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    IndexEntryResolveUndoGetModeMethodInfo  ,
#endif
    indexEntryResolveUndoGetMode            ,


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


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




    ) 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.Structs.OId as Ggit.OId
import qualified GI.Gio.Interfaces.File as Gio.File

newtype IndexEntryResolveUndo = IndexEntryResolveUndo (ManagedPtr IndexEntryResolveUndo)
foreign import ccall "ggit_index_entry_resolve_undo_get_type" c_ggit_index_entry_resolve_undo_get_type :: 
    IO GType

instance BoxedObject IndexEntryResolveUndo where
    boxedType _ = c_ggit_index_entry_resolve_undo_get_type

noIndexEntryResolveUndo :: Maybe IndexEntryResolveUndo
noIndexEntryResolveUndo = Nothing


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

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

foreign import ccall "ggit_index_entry_resolve_undo_get_file" ggit_index_entry_resolve_undo_get_file :: 
    Ptr IndexEntryResolveUndo ->            -- entry : TInterface (Name {namespace = "Ggit", name = "IndexEntryResolveUndo"})
    IO (Ptr Gio.File.File)

{- |
Get the file of the index entry.
-}
indexEntryResolveUndoGetFile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    IndexEntryResolveUndo
    {- ^ /@entry@/: a 'GI.Ggit.Structs.IndexEntryResolveUndo.IndexEntryResolveUndo'. -}
    -> m Gio.File.File
    {- ^ __Returns:__ a 'GI.Gio.Interfaces.File.File'. -}
indexEntryResolveUndoGetFile entry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- ggit_index_entry_resolve_undo_get_file entry'
    checkUnexpectedReturnNULL "indexEntryResolveUndoGetFile" result
    result' <- (wrapObject Gio.File.File) result
    touchManagedPtr entry
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data IndexEntryResolveUndoGetFileMethodInfo
instance (signature ~ (m Gio.File.File), MonadIO m) => O.MethodInfo IndexEntryResolveUndoGetFileMethodInfo IndexEntryResolveUndo signature where
    overloadedMethod _ = indexEntryResolveUndoGetFile

#endif

-- method IndexEntryResolveUndo::get_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Ggit", name = "IndexEntryResolveUndo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndexEntryResolveUndo.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stage", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stage (0, 1 or 2).", 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_index_entry_resolve_undo_get_id" ggit_index_entry_resolve_undo_get_id :: 
    Ptr IndexEntryResolveUndo ->            -- entry : TInterface (Name {namespace = "Ggit", name = "IndexEntryResolveUndo"})
    Int32 ->                                -- stage : TBasicType TInt
    IO (Ptr Ggit.OId.OId)

{- |
Get the oid of the index entry.
-}
indexEntryResolveUndoGetId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    IndexEntryResolveUndo
    {- ^ /@entry@/: a 'GI.Ggit.Structs.IndexEntryResolveUndo.IndexEntryResolveUndo'. -}
    -> Int32
    {- ^ /@stage@/: the stage (0, 1 or 2). -}
    -> m Ggit.OId.OId
    {- ^ __Returns:__ the oid. -}
indexEntryResolveUndoGetId entry stage = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- ggit_index_entry_resolve_undo_get_id entry' stage
    checkUnexpectedReturnNULL "indexEntryResolveUndoGetId" result
    result' <- (wrapBoxed Ggit.OId.OId) result
    touchManagedPtr entry
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data IndexEntryResolveUndoGetIdMethodInfo
instance (signature ~ (Int32 -> m Ggit.OId.OId), MonadIO m) => O.MethodInfo IndexEntryResolveUndoGetIdMethodInfo IndexEntryResolveUndo signature where
    overloadedMethod _ = indexEntryResolveUndoGetId

#endif

-- method IndexEntryResolveUndo::get_mode
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Ggit", name = "IndexEntryResolveUndo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitIndexEntryResolveUndo.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stage", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stage (0, 1 or 2).", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_index_entry_resolve_undo_get_mode" ggit_index_entry_resolve_undo_get_mode :: 
    Ptr IndexEntryResolveUndo ->            -- entry : TInterface (Name {namespace = "Ggit", name = "IndexEntryResolveUndo"})
    Int32 ->                                -- stage : TBasicType TInt
    IO Word32

{- |
Get the mode of the index entry. The returned mode contains the modes from
stage 1, 2 and 3.
-}
indexEntryResolveUndoGetMode ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    IndexEntryResolveUndo
    {- ^ /@entry@/: a 'GI.Ggit.Structs.IndexEntryResolveUndo.IndexEntryResolveUndo'. -}
    -> Int32
    {- ^ /@stage@/: the stage (0, 1 or 2). -}
    -> m Word32
    {- ^ __Returns:__ the mode. -}
indexEntryResolveUndoGetMode entry stage = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- ggit_index_entry_resolve_undo_get_mode entry' stage
    touchManagedPtr entry
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data IndexEntryResolveUndoGetModeMethodInfo
instance (signature ~ (Int32 -> m Word32), MonadIO m) => O.MethodInfo IndexEntryResolveUndoGetModeMethodInfo IndexEntryResolveUndo signature where
    overloadedMethod _ = indexEntryResolveUndoGetMode

#endif

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

foreign import ccall "ggit_index_entry_resolve_undo_ref" ggit_index_entry_resolve_undo_ref :: 
    Ptr IndexEntryResolveUndo ->            -- entry : TInterface (Name {namespace = "Ggit", name = "IndexEntryResolveUndo"})
    IO (Ptr IndexEntryResolveUndo)

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

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

#endif

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

foreign import ccall "ggit_index_entry_resolve_undo_unref" ggit_index_entry_resolve_undo_unref :: 
    Ptr IndexEntryResolveUndo ->            -- entry : TInterface (Name {namespace = "Ggit", name = "IndexEntryResolveUndo"})
    IO ()

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

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

#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveIndexEntryResolveUndoMethod (t :: Symbol) (o :: *) :: * where
    ResolveIndexEntryResolveUndoMethod "ref" o = IndexEntryResolveUndoRefMethodInfo
    ResolveIndexEntryResolveUndoMethod "unref" o = IndexEntryResolveUndoUnrefMethodInfo
    ResolveIndexEntryResolveUndoMethod "getFile" o = IndexEntryResolveUndoGetFileMethodInfo
    ResolveIndexEntryResolveUndoMethod "getId" o = IndexEntryResolveUndoGetIdMethodInfo
    ResolveIndexEntryResolveUndoMethod "getMode" o = IndexEntryResolveUndoGetModeMethodInfo
    ResolveIndexEntryResolveUndoMethod l o = O.MethodResolutionFailed l o

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

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveIndexEntryResolveUndoMethod t IndexEntryResolveUndo, O.MethodInfo info IndexEntryResolveUndo p) => O.IsLabel t (IndexEntryResolveUndo -> 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