{- |
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 rebase object.
-}

module GI.Ggit.Objects.Rebase
    ( 

-- * Exported types
    Rebase(..)                              ,
    IsRebase                                ,
    toRebase                                ,
    noRebase                                ,


 -- * Methods
-- ** abort #method:abort#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RebaseAbortMethodInfo                   ,
#endif
    rebaseAbort                             ,


-- ** commit #method:commit#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RebaseCommitMethodInfo                  ,
#endif
    rebaseCommit                            ,


-- ** finish #method:finish#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RebaseFinishMethodInfo                  ,
#endif
    rebaseFinish                            ,


-- ** getOperationByIndex #method:getOperationByIndex#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RebaseGetOperationByIndexMethodInfo     ,
#endif
    rebaseGetOperationByIndex               ,


-- ** getOperationEntryCount #method:getOperationEntryCount#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RebaseGetOperationEntryCountMethodInfo  ,
#endif
    rebaseGetOperationEntryCount            ,


-- ** getOperationIndex #method:getOperationIndex#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RebaseGetOperationIndexMethodInfo       ,
#endif
    rebaseGetOperationIndex                 ,


-- ** next #method:next#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RebaseNextMethodInfo                    ,
#endif
    rebaseNext                              ,




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

newtype Rebase = Rebase (ManagedPtr Rebase)
foreign import ccall "ggit_rebase_get_type"
    c_ggit_rebase_get_type :: IO GType

instance GObject Rebase where
    gobjectType _ = c_ggit_rebase_get_type
    

class GObject o => IsRebase o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Rebase a) =>
    IsRebase a
#endif
instance IsRebase Rebase
instance Ggit.Native.IsNative Rebase
instance Ggit.ObjectFactoryBase.IsObjectFactoryBase Rebase
instance GObject.Object.IsObject Rebase

toRebase :: (MonadIO m, IsRebase o) => o -> m Rebase
toRebase = liftIO . unsafeCastTo Rebase

noRebase :: Maybe Rebase
noRebase = Nothing

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveRebaseMethod (t :: Symbol) (o :: *) :: * where
    ResolveRebaseMethod "abort" o = RebaseAbortMethodInfo
    ResolveRebaseMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveRebaseMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveRebaseMethod "commit" o = RebaseCommitMethodInfo
    ResolveRebaseMethod "finish" o = RebaseFinishMethodInfo
    ResolveRebaseMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveRebaseMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveRebaseMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveRebaseMethod "next" o = RebaseNextMethodInfo
    ResolveRebaseMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveRebaseMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveRebaseMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveRebaseMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveRebaseMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveRebaseMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveRebaseMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveRebaseMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveRebaseMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveRebaseMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveRebaseMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveRebaseMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveRebaseMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveRebaseMethod "getOperationByIndex" o = RebaseGetOperationByIndexMethodInfo
    ResolveRebaseMethod "getOperationEntryCount" o = RebaseGetOperationEntryCountMethodInfo
    ResolveRebaseMethod "getOperationIndex" o = RebaseGetOperationIndexMethodInfo
    ResolveRebaseMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveRebaseMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveRebaseMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveRebaseMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveRebaseMethod l o = O.MethodResolutionFailed l o

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

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

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList Rebase
type instance O.AttributeList Rebase = RebaseAttributeList
type RebaseAttributeList = ('[ '("native", Ggit.Native.NativeNativePropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type instance O.SignalList Rebase = RebaseSignalList
type RebaseSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

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

foreign import ccall "ggit_rebase_abort" ggit_rebase_abort :: 
    Ptr Rebase ->                           -- rebase : TInterface (Name {namespace = "Ggit", name = "Rebase"})
    Ptr (Ptr GError) ->                     -- error
    IO ()

{- |
Aborts a rebase that is currently in progress, resetting the repository
and working directory to their state before rebase began.
-}
rebaseAbort ::
    (B.CallStack.HasCallStack, MonadIO m, IsRebase a) =>
    a
    {- ^ /@rebase@/: a 'GI.Ggit.Objects.Rebase.Rebase'. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
rebaseAbort rebase = liftIO $ do
    rebase' <- unsafeManagedPtrCastPtr rebase
    onException (do
        propagateGError $ ggit_rebase_abort rebase'
        touchManagedPtr rebase
        return ()
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RebaseAbortMethodInfo
instance (signature ~ (m ()), MonadIO m, IsRebase a) => O.MethodInfo RebaseAbortMethodInfo a signature where
    overloadedMethod _ = rebaseAbort

#endif

-- method Rebase::commit
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "rebase", argType = TInterface (Name {namespace = "Ggit", name = "Rebase"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitRebase.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "author", argType = TInterface (Name {namespace = "Ggit", name = "Signature"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GgitSignature or %NULL to keep the author from\nthe original commit.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "committer", argType = TInterface (Name {namespace = "Ggit", name = "Signature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitSignature.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "message", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the message for this commit, or %NULL to use\nthe message from the original commit.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "OId"}))
-- throws : True
-- Skip return : False

foreign import ccall "ggit_rebase_commit" ggit_rebase_commit :: 
    Ptr Rebase ->                           -- rebase : TInterface (Name {namespace = "Ggit", name = "Rebase"})
    Ptr Ggit.Signature.Signature ->         -- author : TInterface (Name {namespace = "Ggit", name = "Signature"})
    Ptr Ggit.Signature.Signature ->         -- committer : TInterface (Name {namespace = "Ggit", name = "Signature"})
    CString ->                              -- message : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Ggit.OId.OId)

{- |
Commits the current patch.  You must have resolved any conflicts that
were introduced during the patch application from the 'GI.Ggit.Objects.Rebase.rebaseNext'
invocation.
-}
rebaseCommit ::
    (B.CallStack.HasCallStack, MonadIO m, IsRebase a, Ggit.Signature.IsSignature b, Ggit.Signature.IsSignature c) =>
    a
    {- ^ /@rebase@/: a 'GI.Ggit.Objects.Rebase.Rebase'. -}
    -> Maybe (b)
    {- ^ /@author@/: a 'GI.Ggit.Objects.Signature.Signature' or 'Nothing' to keep the author from
the original commit. -}
    -> c
    {- ^ /@committer@/: a 'GI.Ggit.Objects.Signature.Signature'. -}
    -> Maybe (T.Text)
    {- ^ /@message@/: the message for this commit, or 'Nothing' to use
the message from the original commit. -}
    -> m Ggit.OId.OId
    {- ^ __Returns:__ a 'GI.Ggit.Structs.OId.OId' of the newly created commit. /(Can throw 'Data.GI.Base.GError.GError')/ -}
rebaseCommit rebase author committer message = liftIO $ do
    rebase' <- unsafeManagedPtrCastPtr rebase
    maybeAuthor <- case author of
        Nothing -> return nullPtr
        Just jAuthor -> do
            jAuthor' <- unsafeManagedPtrCastPtr jAuthor
            return jAuthor'
    committer' <- unsafeManagedPtrCastPtr committer
    maybeMessage <- case message of
        Nothing -> return nullPtr
        Just jMessage -> do
            jMessage' <- textToCString jMessage
            return jMessage'
    onException (do
        result <- propagateGError $ ggit_rebase_commit rebase' maybeAuthor committer' maybeMessage
        checkUnexpectedReturnNULL "rebaseCommit" result
        result' <- (wrapBoxed Ggit.OId.OId) result
        touchManagedPtr rebase
        whenJust author touchManagedPtr
        touchManagedPtr committer
        freeMem maybeMessage
        return result'
     ) (do
        freeMem maybeMessage
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RebaseCommitMethodInfo
instance (signature ~ (Maybe (b) -> c -> Maybe (T.Text) -> m Ggit.OId.OId), MonadIO m, IsRebase a, Ggit.Signature.IsSignature b, Ggit.Signature.IsSignature c) => O.MethodInfo RebaseCommitMethodInfo a signature where
    overloadedMethod _ = rebaseCommit

#endif

-- method Rebase::finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "rebase", argType = TInterface (Name {namespace = "Ggit", name = "Rebase"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitRebase.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "signature", argType = TInterface (Name {namespace = "Ggit", name = "Signature"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the identity that is finishing the rebase or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : True
-- Skip return : False

foreign import ccall "ggit_rebase_finish" ggit_rebase_finish :: 
    Ptr Rebase ->                           -- rebase : TInterface (Name {namespace = "Ggit", name = "Rebase"})
    Ptr Ggit.Signature.Signature ->         -- signature : TInterface (Name {namespace = "Ggit", name = "Signature"})
    Ptr (Ptr GError) ->                     -- error
    IO ()

{- |
Finishes a rebase that is currently in progress once all patches have
been applied.
-}
rebaseFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsRebase a, Ggit.Signature.IsSignature b) =>
    a
    {- ^ /@rebase@/: a 'GI.Ggit.Objects.Rebase.Rebase'. -}
    -> Maybe (b)
    {- ^ /@signature@/: the identity that is finishing the rebase or 'Nothing'. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
rebaseFinish rebase signature = liftIO $ do
    rebase' <- unsafeManagedPtrCastPtr rebase
    maybeSignature <- case signature of
        Nothing -> return nullPtr
        Just jSignature -> do
            jSignature' <- unsafeManagedPtrCastPtr jSignature
            return jSignature'
    onException (do
        propagateGError $ ggit_rebase_finish rebase' maybeSignature
        touchManagedPtr rebase
        whenJust signature touchManagedPtr
        return ()
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RebaseFinishMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsRebase a, Ggit.Signature.IsSignature b) => O.MethodInfo RebaseFinishMethodInfo a signature where
    overloadedMethod _ = rebaseFinish

#endif

-- method Rebase::get_operation_by_index
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "rebase", argType = TInterface (Name {namespace = "Ggit", name = "Rebase"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitRebase.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The index of the rebase operation to retrieve.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "RebaseOperation"}))
-- throws : False
-- Skip return : False

foreign import ccall "ggit_rebase_get_operation_by_index" ggit_rebase_get_operation_by_index :: 
    Ptr Rebase ->                           -- rebase : TInterface (Name {namespace = "Ggit", name = "Rebase"})
    Word64 ->                               -- idx : TBasicType TUInt64
    IO (Ptr Ggit.RebaseOperation.RebaseOperation)

{- |
Gets the rebase operation specified by /@idx@/.
-}
rebaseGetOperationByIndex ::
    (B.CallStack.HasCallStack, MonadIO m, IsRebase a) =>
    a
    {- ^ /@rebase@/: a 'GI.Ggit.Objects.Rebase.Rebase'. -}
    -> Word64
    {- ^ /@idx@/: The index of the rebase operation to retrieve. -}
    -> m Ggit.RebaseOperation.RebaseOperation
    {- ^ __Returns:__ The rebase operation or 'Nothing' if /@idx@/ was out of bounds. -}
rebaseGetOperationByIndex rebase idx = liftIO $ do
    rebase' <- unsafeManagedPtrCastPtr rebase
    result <- ggit_rebase_get_operation_by_index rebase' idx
    checkUnexpectedReturnNULL "rebaseGetOperationByIndex" result
    result' <- (wrapBoxed Ggit.RebaseOperation.RebaseOperation) result
    touchManagedPtr rebase
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RebaseGetOperationByIndexMethodInfo
instance (signature ~ (Word64 -> m Ggit.RebaseOperation.RebaseOperation), MonadIO m, IsRebase a) => O.MethodInfo RebaseGetOperationByIndexMethodInfo a signature where
    overloadedMethod _ = rebaseGetOperationByIndex

#endif

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

foreign import ccall "ggit_rebase_get_operation_entry_count" ggit_rebase_get_operation_entry_count :: 
    Ptr Rebase ->                           -- rebase : TInterface (Name {namespace = "Ggit", name = "Rebase"})
    IO Word64

{- |
Gets the count of rebase operations that are to be applied.
-}
rebaseGetOperationEntryCount ::
    (B.CallStack.HasCallStack, MonadIO m, IsRebase a) =>
    a
    {- ^ /@rebase@/: a 'GI.Ggit.Objects.Rebase.Rebase'. -}
    -> m Word64
    {- ^ __Returns:__ the count of rebase operations that are to be applied. -}
rebaseGetOperationEntryCount rebase = liftIO $ do
    rebase' <- unsafeManagedPtrCastPtr rebase
    result <- ggit_rebase_get_operation_entry_count rebase'
    touchManagedPtr rebase
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RebaseGetOperationEntryCountMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsRebase a) => O.MethodInfo RebaseGetOperationEntryCountMethodInfo a signature where
    overloadedMethod _ = rebaseGetOperationEntryCount

#endif

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

foreign import ccall "ggit_rebase_get_operation_index" ggit_rebase_get_operation_index :: 
    Ptr Rebase ->                           -- rebase : TInterface (Name {namespace = "Ggit", name = "Rebase"})
    IO Word64

{- |
Gets the index of the rebase operation that is currently being applied.
If the first operation has not yet been applied (because you have
called 'GI.Ggit.Objects.Repository.repositoryRebaseInit' but not yet 'GI.Ggit.Objects.Rebase.rebaseNext')
then this returns /@gGITREBASENOOPERATION@/.
-}
rebaseGetOperationIndex ::
    (B.CallStack.HasCallStack, MonadIO m, IsRebase a) =>
    a
    {- ^ /@rebase@/: a 'GI.Ggit.Objects.Rebase.Rebase'. -}
    -> m Word64
    {- ^ __Returns:__ The index of the rebase operation currently being applied. -}
rebaseGetOperationIndex rebase = liftIO $ do
    rebase' <- unsafeManagedPtrCastPtr rebase
    result <- ggit_rebase_get_operation_index rebase'
    touchManagedPtr rebase
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RebaseGetOperationIndexMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsRebase a) => O.MethodInfo RebaseGetOperationIndexMethodInfo a signature where
    overloadedMethod _ = rebaseGetOperationIndex

#endif

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

foreign import ccall "ggit_rebase_next" ggit_rebase_next :: 
    Ptr Rebase ->                           -- rebase : TInterface (Name {namespace = "Ggit", name = "Rebase"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Ggit.RebaseOperation.RebaseOperation)

{- |
Performs the next rebase operation and returns the information about it.
If the operation is one that applies a patch (which is any operation except
/@gGITREBASEOPERATIONEXEC@/) then the patch will be applied and the index and
working directory will be updated with the changes. If there are conflicts,
you will need to address those before committing the changes.
-}
rebaseNext ::
    (B.CallStack.HasCallStack, MonadIO m, IsRebase a) =>
    a
    {- ^ /@rebase@/: a 'GI.Ggit.Objects.Rebase.Rebase'. -}
    -> m Ggit.RebaseOperation.RebaseOperation
    {- ^ __Returns:__ the rebase operation that is to be performed next. /(Can throw 'Data.GI.Base.GError.GError')/ -}
rebaseNext rebase = liftIO $ do
    rebase' <- unsafeManagedPtrCastPtr rebase
    onException (do
        result <- propagateGError $ ggit_rebase_next rebase'
        checkUnexpectedReturnNULL "rebaseNext" result
        result' <- (wrapBoxed Ggit.RebaseOperation.RebaseOperation) result
        touchManagedPtr rebase
        return result'
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RebaseNextMethodInfo
instance (signature ~ (m Ggit.RebaseOperation.RebaseOperation), MonadIO m, IsRebase a) => O.MethodInfo RebaseNextMethodInfo a signature where
    overloadedMethod _ = rebaseNext

#endif