{- |
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 reflog entry.
-}

module GI.Ggit.Structs.ReflogEntry
    ( 

-- * Exported types
    ReflogEntry(..)                         ,
    noReflogEntry                           ,


 -- * Methods
-- ** getCommitter #method:getCommitter#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ReflogEntryGetCommitterMethodInfo       ,
#endif
    reflogEntryGetCommitter                 ,


-- ** getMessage #method:getMessage#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ReflogEntryGetMessageMethodInfo         ,
#endif
    reflogEntryGetMessage                   ,


-- ** getNewId #method:getNewId#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ReflogEntryGetNewIdMethodInfo           ,
#endif
    reflogEntryGetNewId                     ,


-- ** getOldId #method:getOldId#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    ReflogEntryGetOldIdMethodInfo           ,
#endif
    reflogEntryGetOldId                     ,


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


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




    ) 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.Objects.Signature as Ggit.Signature
import {-# SOURCE #-} qualified GI.Ggit.Structs.OId as Ggit.OId

newtype ReflogEntry = ReflogEntry (ManagedPtr ReflogEntry)
foreign import ccall "ggit_reflog_entry_get_type" c_ggit_reflog_entry_get_type :: 
    IO GType

instance BoxedObject ReflogEntry where
    boxedType _ = c_ggit_reflog_entry_get_type

noReflogEntry :: Maybe ReflogEntry
noReflogEntry = Nothing


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

-- method ReflogEntry::get_committer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "reflog_entry", argType = TInterface (Name {namespace = "Ggit", name = "ReflogEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitReflogEntry.", 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_reflog_entry_get_committer" ggit_reflog_entry_get_committer :: 
    Ptr ReflogEntry ->                      -- reflog_entry : TInterface (Name {namespace = "Ggit", name = "ReflogEntry"})
    IO (Ptr Ggit.Signature.Signature)

{- |
Gets the committer as a 'GI.Ggit.Objects.Signature.Signature'.
-}
reflogEntryGetCommitter ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ReflogEntry
    {- ^ /@reflogEntry@/: a 'GI.Ggit.Structs.ReflogEntry.ReflogEntry'. -}
    -> m Ggit.Signature.Signature
    {- ^ __Returns:__ the committer. -}
reflogEntryGetCommitter reflogEntry = liftIO $ do
    reflogEntry' <- unsafeManagedPtrGetPtr reflogEntry
    result <- ggit_reflog_entry_get_committer reflogEntry'
    checkUnexpectedReturnNULL "reflogEntryGetCommitter" result
    result' <- (newObject Ggit.Signature.Signature) result
    touchManagedPtr reflogEntry
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ReflogEntryGetCommitterMethodInfo
instance (signature ~ (m Ggit.Signature.Signature), MonadIO m) => O.MethodInfo ReflogEntryGetCommitterMethodInfo ReflogEntry signature where
    overloadedMethod _ = reflogEntryGetCommitter

#endif

-- method ReflogEntry::get_message
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "reflog_entry", argType = TInterface (Name {namespace = "Ggit", name = "ReflogEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitReflogEntry.", 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_reflog_entry_get_message" ggit_reflog_entry_get_message :: 
    Ptr ReflogEntry ->                      -- reflog_entry : TInterface (Name {namespace = "Ggit", name = "ReflogEntry"})
    IO CString

{- |
Gets the message.
-}
reflogEntryGetMessage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ReflogEntry
    {- ^ /@reflogEntry@/: a 'GI.Ggit.Structs.ReflogEntry.ReflogEntry'. -}
    -> m T.Text
    {- ^ __Returns:__ the message. -}
reflogEntryGetMessage reflogEntry = liftIO $ do
    reflogEntry' <- unsafeManagedPtrGetPtr reflogEntry
    result <- ggit_reflog_entry_get_message reflogEntry'
    checkUnexpectedReturnNULL "reflogEntryGetMessage" result
    result' <- cstringToText result
    touchManagedPtr reflogEntry
    return result'

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

#endif

-- method ReflogEntry::get_new_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "reflog_entry", argType = TInterface (Name {namespace = "Ggit", name = "ReflogEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitReflogEntry.", 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_reflog_entry_get_new_id" ggit_reflog_entry_get_new_id :: 
    Ptr ReflogEntry ->                      -- reflog_entry : TInterface (Name {namespace = "Ggit", name = "ReflogEntry"})
    IO (Ptr Ggit.OId.OId)

{- |
Gets the new 'GI.Ggit.Structs.OId.OId'.
-}
reflogEntryGetNewId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ReflogEntry
    {- ^ /@reflogEntry@/: a 'GI.Ggit.Structs.ReflogEntry.ReflogEntry'. -}
    -> m Ggit.OId.OId
    {- ^ __Returns:__ the new oid. -}
reflogEntryGetNewId reflogEntry = liftIO $ do
    reflogEntry' <- unsafeManagedPtrGetPtr reflogEntry
    result <- ggit_reflog_entry_get_new_id reflogEntry'
    checkUnexpectedReturnNULL "reflogEntryGetNewId" result
    result' <- (wrapBoxed Ggit.OId.OId) result
    touchManagedPtr reflogEntry
    return result'

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

#endif

-- method ReflogEntry::get_old_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "reflog_entry", argType = TInterface (Name {namespace = "Ggit", name = "ReflogEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitReflogEntry.", 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_reflog_entry_get_old_id" ggit_reflog_entry_get_old_id :: 
    Ptr ReflogEntry ->                      -- reflog_entry : TInterface (Name {namespace = "Ggit", name = "ReflogEntry"})
    IO (Ptr Ggit.OId.OId)

{- |
Gets the old 'GI.Ggit.Structs.OId.OId'.
-}
reflogEntryGetOldId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ReflogEntry
    {- ^ /@reflogEntry@/: a 'GI.Ggit.Structs.ReflogEntry.ReflogEntry'. -}
    -> m Ggit.OId.OId
    {- ^ __Returns:__ the old oid. -}
reflogEntryGetOldId reflogEntry = liftIO $ do
    reflogEntry' <- unsafeManagedPtrGetPtr reflogEntry
    result <- ggit_reflog_entry_get_old_id reflogEntry'
    checkUnexpectedReturnNULL "reflogEntryGetOldId" result
    result' <- (wrapBoxed Ggit.OId.OId) result
    touchManagedPtr reflogEntry
    return result'

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

#endif

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

foreign import ccall "ggit_reflog_entry_ref" ggit_reflog_entry_ref :: 
    Ptr ReflogEntry ->                      -- reflog_entry : TInterface (Name {namespace = "Ggit", name = "ReflogEntry"})
    IO (Ptr ReflogEntry)

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

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

#endif

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

foreign import ccall "ggit_reflog_entry_unref" ggit_reflog_entry_unref :: 
    Ptr ReflogEntry ->                      -- reflog_entry : TInterface (Name {namespace = "Ggit", name = "ReflogEntry"})
    IO ()

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

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

#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveReflogEntryMethod (t :: Symbol) (o :: *) :: * where
    ResolveReflogEntryMethod "ref" o = ReflogEntryRefMethodInfo
    ResolveReflogEntryMethod "unref" o = ReflogEntryUnrefMethodInfo
    ResolveReflogEntryMethod "getCommitter" o = ReflogEntryGetCommitterMethodInfo
    ResolveReflogEntryMethod "getMessage" o = ReflogEntryGetMessageMethodInfo
    ResolveReflogEntryMethod "getNewId" o = ReflogEntryGetNewIdMethodInfo
    ResolveReflogEntryMethod "getOldId" o = ReflogEntryGetOldIdMethodInfo
    ResolveReflogEntryMethod l o = O.MethodResolutionFailed l o

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

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