{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A transition is an asynchronous operation, like GTask, that contains an internal state machine, where a series of \'steps\' are executed in order to complete the operation.
-- For every step, _WpTransitionClass[get_next_step](#g:signal:get_next_step)() is called in order to determine the next step to execute. Afterwards, _WpTransitionClass[execute_step](#g:signal:execute_step)() is called to perform any actions necessary to complete this step. When execution of the step is done, the operation\'s code must call 'GI.Wp.Objects.Transition.transitionAdvance' in order to continue to the next step. If an error occurs, the operation\'s code must call 'GI.Wp.Objects.Transition.transitionReturnError' instead, in which case the transition completes immediately and 'GI.Wp.Objects.Transition.transitionHadError' returns TRUE.
-- Typically, every step will start an asynchronous operation. Although it is possible, the WpTransition base class does not expect _WpTransitionClass[execute_step](#g:signal:execute_step)() to call 'GI.Wp.Objects.Transition.transitionAdvance' directly. Instead, it is expected that 'GI.Wp.Objects.Transition.transitionAdvance' will be called from the callback that the step\'s asynchronous operation will call when it is completed.

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

module GI.Wp.Objects.Transition
    ( 

-- * Exported types
    Transition(..)                          ,
    IsTransition                            ,
    toTransition                            ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [advance]("GI.Wp.Objects.Transition#g:method:advance"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [hadError]("GI.Wp.Objects.Transition#g:method:hadError"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [isTagged]("GI.Wp.Objects.Transition#g:method:isTagged"), [legacyPropagateError]("GI.Gio.Interfaces.AsyncResult#g:method:legacyPropagateError"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [returnError]("GI.Wp.Objects.Transition#g:method:returnError"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getCompleted]("GI.Wp.Objects.Transition#g:method:getCompleted"), [getData]("GI.Wp.Objects.Transition#g:method:getData"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getSourceObject]("GI.Wp.Objects.Transition#g:method:getSourceObject"), [getSourceTag]("GI.Wp.Objects.Transition#g:method:getSourceTag"), [getUserData]("GI.Gio.Interfaces.AsyncResult#g:method:getUserData").
-- 
-- ==== Setters
-- [setData]("GI.Wp.Objects.Transition#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setSourceTag]("GI.Wp.Objects.Transition#g:method:setSourceTag").

#if defined(ENABLE_OVERLOADING)
    ResolveTransitionMethod                 ,
#endif

-- ** advance #method:advance#

#if defined(ENABLE_OVERLOADING)
    TransitionAdvanceMethodInfo             ,
#endif
    transitionAdvance                       ,


-- ** finish #method:finish#

    transitionFinish                        ,


-- ** getCompleted #method:getCompleted#

#if defined(ENABLE_OVERLOADING)
    TransitionGetCompletedMethodInfo        ,
#endif
    transitionGetCompleted                  ,


-- ** getData #method:getData#

#if defined(ENABLE_OVERLOADING)
    TransitionGetDataMethodInfo             ,
#endif
    transitionGetData                       ,


-- ** getSourceObject #method:getSourceObject#

#if defined(ENABLE_OVERLOADING)
    TransitionGetSourceObjectMethodInfo     ,
#endif
    transitionGetSourceObject               ,


-- ** getSourceTag #method:getSourceTag#

#if defined(ENABLE_OVERLOADING)
    TransitionGetSourceTagMethodInfo        ,
#endif
    transitionGetSourceTag                  ,


-- ** hadError #method:hadError#

#if defined(ENABLE_OVERLOADING)
    TransitionHadErrorMethodInfo            ,
#endif
    transitionHadError                      ,


-- ** isTagged #method:isTagged#

#if defined(ENABLE_OVERLOADING)
    TransitionIsTaggedMethodInfo            ,
#endif
    transitionIsTagged                      ,


-- ** new #method:new#

    transitionNew                           ,


-- ** newClosure #method:newClosure#

    transitionNewClosure                    ,


-- ** returnError #method:returnError#

#if defined(ENABLE_OVERLOADING)
    TransitionReturnErrorMethodInfo         ,
#endif
    transitionReturnError                   ,


-- ** setData #method:setData#

#if defined(ENABLE_OVERLOADING)
    TransitionSetDataMethodInfo             ,
#endif
    transitionSetData                       ,


-- ** setSourceTag #method:setSourceTag#

#if defined(ENABLE_OVERLOADING)
    TransitionSetSourceTagMethodInfo        ,
#endif
    transitionSetSourceTag                  ,




 -- * Properties


-- ** completed #attr:completed#
-- | /No description available in the introspection data./

#if defined(ENABLE_OVERLOADING)
    TransitionCompletedPropertyInfo         ,
#endif
    getTransitionCompleted                  ,
#if defined(ENABLE_OVERLOADING)
    transitionCompleted                     ,
#endif




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable

#else
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable

#endif

-- | Memory-managed wrapper type.
newtype Transition = Transition (SP.ManagedPtr Transition)
    deriving (Eq)

instance SP.ManagedPtrNewtype Transition where
    toManagedPtr (Transition p) = p

foreign import ccall "wp_transition_get_type"
    c_wp_transition_get_type :: IO B.Types.GType

instance B.Types.TypedObject Transition where
    glibType = c_wp_transition_get_type

instance B.Types.GObject Transition

-- | Type class for types which can be safely cast to t'Transition', for instance with `toTransition`.
class (SP.GObject o, O.IsDescendantOf Transition o) => IsTransition o
instance (SP.GObject o, O.IsDescendantOf Transition o) => IsTransition o

instance O.HasParentTypes Transition
type instance O.ParentTypes Transition = '[GObject.Object.Object, Gio.AsyncResult.AsyncResult]

-- | Cast to t'Transition', for types for which this is known to be safe. For general casts, use 'Data.GI.Base.ManagedPtr.castTo'.
toTransition :: (MIO.MonadIO m, IsTransition o) => o -> m Transition
toTransition = MIO.liftIO . B.ManagedPtr.unsafeCastTo Transition

-- | Convert t'Transition' to and from t'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Transition) where
    gvalueGType_ = c_wp_transition_get_type
    gvalueSet_ gv P.Nothing = B.GValue.set_object gv (FP.nullPtr :: FP.Ptr Transition)
    gvalueSet_ gv (P.Just obj) = B.ManagedPtr.withManagedPtr obj (B.GValue.set_object gv)
    gvalueGet_ gv = do
        ptr <- B.GValue.get_object gv :: IO (FP.Ptr Transition)
        if ptr /= FP.nullPtr
        then P.Just <$> B.ManagedPtr.newObject Transition ptr
        else return P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveTransitionMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveTransitionMethod "advance" o = TransitionAdvanceMethodInfo
    ResolveTransitionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveTransitionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveTransitionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveTransitionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveTransitionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveTransitionMethod "hadError" o = TransitionHadErrorMethodInfo
    ResolveTransitionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveTransitionMethod "isTagged" o = TransitionIsTaggedMethodInfo
    ResolveTransitionMethod "legacyPropagateError" o = Gio.AsyncResult.AsyncResultLegacyPropagateErrorMethodInfo
    ResolveTransitionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveTransitionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveTransitionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveTransitionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveTransitionMethod "returnError" o = TransitionReturnErrorMethodInfo
    ResolveTransitionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveTransitionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveTransitionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveTransitionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveTransitionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveTransitionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveTransitionMethod "getCompleted" o = TransitionGetCompletedMethodInfo
    ResolveTransitionMethod "getData" o = TransitionGetDataMethodInfo
    ResolveTransitionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveTransitionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveTransitionMethod "getSourceObject" o = TransitionGetSourceObjectMethodInfo
    ResolveTransitionMethod "getSourceTag" o = TransitionGetSourceTagMethodInfo
    ResolveTransitionMethod "getUserData" o = Gio.AsyncResult.AsyncResultGetUserDataMethodInfo
    ResolveTransitionMethod "setData" o = TransitionSetDataMethodInfo
    ResolveTransitionMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveTransitionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveTransitionMethod "setSourceTag" o = TransitionSetSourceTagMethodInfo
    ResolveTransitionMethod l o = O.MethodResolutionFailed l o

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

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveTransitionMethod t Transition, O.OverloadedMethod info Transition p, R.HasField t Transition p) => R.HasField t Transition p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveTransitionMethod t Transition, O.OverloadedMethodInfo info Transition) => OL.IsLabel t (O.MethodProxy info Transition) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- VVV Prop "completed"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@completed@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' transition #completed
-- @
getTransitionCompleted :: (MonadIO m, IsTransition o) => o -> m Bool
getTransitionCompleted obj = MIO.liftIO $ B.Properties.getObjectPropertyBool obj "completed"

#if defined(ENABLE_OVERLOADING)
data TransitionCompletedPropertyInfo
instance AttrInfo TransitionCompletedPropertyInfo where
    type AttrAllowedOps TransitionCompletedPropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint TransitionCompletedPropertyInfo = IsTransition
    type AttrSetTypeConstraint TransitionCompletedPropertyInfo = (~) ()
    type AttrTransferTypeConstraint TransitionCompletedPropertyInfo = (~) ()
    type AttrTransferType TransitionCompletedPropertyInfo = ()
    type AttrGetType TransitionCompletedPropertyInfo = Bool
    type AttrLabel TransitionCompletedPropertyInfo = "completed"
    type AttrOrigin TransitionCompletedPropertyInfo = Transition
    attrGet = getTransitionCompleted
    attrSet = undefined
    attrPut = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Transition.completed"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Transition.html#g:attr:completed"
        })
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Transition
type instance O.AttributeList Transition = TransitionAttributeList
type TransitionAttributeList = ('[ '("completed", TransitionCompletedPropertyInfo)] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
transitionCompleted :: AttrLabelProxy "completed"
transitionCompleted = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Transition = TransitionSignalList
type TransitionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method Transition::new
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TGType
--           , argCType = Just "GType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the GType of the WpTransition subclass to instantiate"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "source_object"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the GObject that owns this task, or NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , argCType = Just "GCancellable*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "optional GCancellable"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , argCType = Just "GAsyncReadyCallback"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a GAsyncReadyCallback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user data passed to @callback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Transition" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_new" wp_transition_new :: 
    CGType ->                               -- type : TBasicType TGType
    Ptr GObject.Object.Object ->            -- source_object : TInterface (Name {namespace = "GObject", name = "Object"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- callback_data : TBasicType TPtr
    IO (Ptr Transition)

-- | Creates a WpTransition acting on /@sourceObject@/.
-- 
-- 
-- When the transition is done, /@callback@/ will be invoked.
-- The transition does not automatically start executing steps. You must call 'GI.Wp.Objects.Transition.transitionAdvance' after creating it in order to start it.
-- The transition is automatically unref\'ed after the /@callback@/ has been executed. If you wish to keep an additional reference on it, you need to ref it explicitly.
transitionNew ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a, Gio.Cancellable.IsCancellable b) =>
    GType
    -- ^ /@type@/: the GType of the WpTransition subclass to instantiate
    -> Maybe (a)
    -- ^ /@sourceObject@/: the GObject that owns this task, or NULL
    -> Maybe (b)
    -- ^ /@cancellable@/: optional GCancellable
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: a GAsyncReadyCallback
    -> m Transition
    -- ^ __Returns:__ the new transition
transitionNew type_ sourceObject cancellable callback = liftIO $ do
    let type_' = gtypeToCGType type_
    maybeSourceObject <- case sourceObject of
        Nothing -> return FP.nullPtr
        Just jSourceObject -> do
            jSourceObject' <- unsafeManagedPtrCastPtr jSourceObject
            return jSourceObject'
    maybeCancellable <- case cancellable of
        Nothing -> return FP.nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeCallback <- case callback of
        Nothing -> return FP.nullFunPtr
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let callbackData = nullPtr
    result <- wp_transition_new type_' maybeSourceObject maybeCancellable maybeCallback callbackData
    checkUnexpectedReturnNULL "transitionNew" result
    result' <- (newObject Transition) result
    whenJust sourceObject touchManagedPtr
    whenJust cancellable touchManagedPtr
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Transition::new_closure
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TGType
--           , argCType = Just "GType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the GType of the WpTransition subclass to instantiate"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "source_object"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the GObject that owns this task, or NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , argCType = Just "GCancellable*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "optional GCancellable"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "closure"
--           , argType = TGClosure Nothing
--           , argCType = Just "GClosure*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a GAsyncReadyCallback wrapped in a GClosure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Transition" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_new_closure" wp_transition_new_closure :: 
    CGType ->                               -- type : TBasicType TGType
    Ptr GObject.Object.Object ->            -- source_object : TInterface (Name {namespace = "GObject", name = "Object"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (GClosure ()) ->                    -- closure : TGClosure Nothing
    IO (Ptr Transition)

-- | Creates a WpTransition acting on /@sourceObject@/. When the transition is done, /@closure@/ will be invoked.
-- 
-- 
-- The transition does not automatically start executing steps. You must call 'GI.Wp.Objects.Transition.transitionAdvance' after creating it in order to start it.
-- Note that the transition is automatically unref\'ed after the /@closure@/ has been executed. If you wish to keep an additional reference on it, you need to ref it explicitly.
transitionNewClosure ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a, Gio.Cancellable.IsCancellable b) =>
    GType
    -- ^ /@type@/: the GType of the WpTransition subclass to instantiate
    -> Maybe (a)
    -- ^ /@sourceObject@/: the GObject that owns this task, or NULL
    -> Maybe (b)
    -- ^ /@cancellable@/: optional GCancellable
    -> Maybe (GClosure c)
    -- ^ /@closure@/: a GAsyncReadyCallback wrapped in a GClosure
    -> m Transition
    -- ^ __Returns:__ the new transition
transitionNewClosure type_ sourceObject cancellable closure = liftIO $ do
    let type_' = gtypeToCGType type_
    maybeSourceObject <- case sourceObject of
        Nothing -> return FP.nullPtr
        Just jSourceObject -> do
            jSourceObject' <- unsafeManagedPtrCastPtr jSourceObject
            return jSourceObject'
    maybeCancellable <- case cancellable of
        Nothing -> return FP.nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeClosure <- case closure of
        Nothing -> return FP.nullPtr
        Just jClosure -> do
            jClosure' <- unsafeManagedPtrCastPtr jClosure
            return jClosure'
    result <- wp_transition_new_closure type_' maybeSourceObject maybeCancellable maybeClosure
    checkUnexpectedReturnNULL "transitionNewClosure" result
    result' <- (newObject Transition) result
    whenJust sourceObject touchManagedPtr
    whenJust cancellable touchManagedPtr
    whenJust closure touchManagedPtr
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Transition::advance
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Transition" }
--           , argCType = Just "WpTransition*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the transition" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_advance" wp_transition_advance :: 
    Ptr Transition ->                       -- self : TInterface (Name {namespace = "Wp", name = "Transition"})
    IO ()

-- | Advances the transition to the next step.
-- 
-- 
-- This initially calls _WpTransitionClass[get_next_step](#g:signal:get_next_step)() in order to determine what the next step is. If _WpTransitionClass[get_next_step](#g:signal:get_next_step)() returns a step different than the previous one, it calls _WpTransitionClass[execute_step](#g:signal:execute_step)() to execute it.
-- The very first time that _WpTransitionClass[get_next_step](#g:signal:get_next_step)() is called, its /@step@/ parameter equals WP_TRANSITION_STEP_NONE.
-- When _WpTransitionClass[get_next_step](#g:signal:get_next_step)() returns WP_TRANSITION_STEP_NONE this function completes the transition, calling the transition\'s callback and then unref-ing the transition.
-- When _WpTransitionClass[get_next_step](#g:signal:get_next_step)() returns WP_TRANSITION_STEP_ERROR, this function calls 'GI.Wp.Objects.Transition.transitionReturnError', unless it has already been called directly by _WpTransitionClass[get_next_step](#g:signal:get_next_step)().
-- In error conditions, _WpTransitionClass[execute_step](#g:signal:execute_step)() is called once with /@step@/ being WP_TRANSITION_STEP_ERROR, allowing the implementation to rollback any changes or cancel underlying jobs, if necessary.
transitionAdvance ::
    (B.CallStack.HasCallStack, MonadIO m, IsTransition a) =>
    a
    -- ^ /@self@/: the transition
    -> m ()
transitionAdvance self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    wp_transition_advance self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data TransitionAdvanceMethodInfo
instance (signature ~ (m ()), MonadIO m, IsTransition a) => O.OverloadedMethod TransitionAdvanceMethodInfo a signature where
    overloadedMethod = transitionAdvance

instance O.OverloadedMethodInfo TransitionAdvanceMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Transition.transitionAdvance",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Transition.html#v:transitionAdvance"
        })


#endif

-- method Transition::get_completed
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Transition" }
--           , argCType = Just "WpTransition*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the transition" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_get_completed" wp_transition_get_completed :: 
    Ptr Transition ->                       -- self : TInterface (Name {namespace = "Wp", name = "Transition"})
    IO CInt

-- | Checks if the transition completed.
transitionGetCompleted ::
    (B.CallStack.HasCallStack, MonadIO m, IsTransition a) =>
    a
    -- ^ /@self@/: the transition
    -> m Bool
    -- ^ __Returns:__ TRUE if the transition has completed (with or without an error), FALSE otherwise
transitionGetCompleted self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_transition_get_completed self'
    let result' = (/= 0) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data TransitionGetCompletedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsTransition a) => O.OverloadedMethod TransitionGetCompletedMethodInfo a signature where
    overloadedMethod = transitionGetCompleted

instance O.OverloadedMethodInfo TransitionGetCompletedMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Transition.transitionGetCompleted",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Transition.html#v:transitionGetCompleted"
        })


#endif

-- method Transition::get_data
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Transition" }
--           , argCType = Just "WpTransition*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the transition" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_get_data" wp_transition_get_data :: 
    Ptr Transition ->                       -- self : TInterface (Name {namespace = "Wp", name = "Transition"})
    IO (Ptr ())

-- | Gets /@self@/ \'s data.
-- 
-- 
-- See 'GI.Wp.Objects.Transition.transitionSetData'.
transitionGetData ::
    (B.CallStack.HasCallStack, MonadIO m, IsTransition a) =>
    a
    -- ^ /@self@/: the transition
    -> m (Ptr ())
    -- ^ __Returns:__ the transition\'s data
transitionGetData self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_transition_get_data self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data TransitionGetDataMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m, IsTransition a) => O.OverloadedMethod TransitionGetDataMethodInfo a signature where
    overloadedMethod = transitionGetData

instance O.OverloadedMethodInfo TransitionGetDataMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Transition.transitionGetData",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Transition.html#v:transitionGetData"
        })


#endif

-- method Transition::get_source_object
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Transition" }
--           , argCType = Just "WpTransition*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the transition" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GObject" , name = "Object" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_get_source_object" wp_transition_get_source_object :: 
    Ptr Transition ->                       -- self : TInterface (Name {namespace = "Wp", name = "Transition"})
    IO (Ptr GObject.Object.Object)

-- | Gets the source object from the transition.
-- 
-- 
-- Like 'GI.Gio.Interfaces.AsyncResult.asyncResultGetSourceObject', but does not ref the object.
transitionGetSourceObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsTransition a) =>
    a
    -- ^ /@self@/: the transition
    -> m GObject.Object.Object
    -- ^ __Returns:__ the source object
transitionGetSourceObject self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_transition_get_source_object self'
    checkUnexpectedReturnNULL "transitionGetSourceObject" result
    result' <- (newObject GObject.Object.Object) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data TransitionGetSourceObjectMethodInfo
instance (signature ~ (m GObject.Object.Object), MonadIO m, IsTransition a) => O.OverloadedMethod TransitionGetSourceObjectMethodInfo a signature where
    overloadedMethod = transitionGetSourceObject

instance O.OverloadedMethodInfo TransitionGetSourceObjectMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Transition.transitionGetSourceObject",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Transition.html#v:transitionGetSourceObject"
        })


#endif

-- method Transition::get_source_tag
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Transition" }
--           , argCType = Just "WpTransition*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the transition" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_get_source_tag" wp_transition_get_source_tag :: 
    Ptr Transition ->                       -- self : TInterface (Name {namespace = "Wp", name = "Transition"})
    IO (Ptr ())

-- | Gets /@self@/ \'s source tag.
-- 
-- 
-- See 'GI.Wp.Objects.Transition.transitionSetSourceTag'.
transitionGetSourceTag ::
    (B.CallStack.HasCallStack, MonadIO m, IsTransition a) =>
    a
    -- ^ /@self@/: the transition
    -> m (Ptr ())
    -- ^ __Returns:__ the transition\'s source tag
transitionGetSourceTag self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_transition_get_source_tag self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data TransitionGetSourceTagMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m, IsTransition a) => O.OverloadedMethod TransitionGetSourceTagMethodInfo a signature where
    overloadedMethod = transitionGetSourceTag

instance O.OverloadedMethodInfo TransitionGetSourceTagMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Transition.transitionGetSourceTag",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Transition.html#v:transitionGetSourceTag"
        })


#endif

-- method Transition::had_error
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Transition" }
--           , argCType = Just "WpTransition*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the transition" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_had_error" wp_transition_had_error :: 
    Ptr Transition ->                       -- self : TInterface (Name {namespace = "Wp", name = "Transition"})
    IO CInt

-- | Checks if the transition completed with an error.
transitionHadError ::
    (B.CallStack.HasCallStack, MonadIO m, IsTransition a) =>
    a
    -- ^ /@self@/: the transition
    -> m Bool
    -- ^ __Returns:__ TRUE if the transition completed with an error, FALSE otherwise
transitionHadError self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_transition_had_error self'
    let result' = (/= 0) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data TransitionHadErrorMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsTransition a) => O.OverloadedMethod TransitionHadErrorMethodInfo a signature where
    overloadedMethod = transitionHadError

instance O.OverloadedMethodInfo TransitionHadErrorMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Transition.transitionHadError",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Transition.html#v:transitionHadError"
        })


#endif

-- method Transition::is_tagged
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Transition" }
--           , argCType = Just "WpTransition*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the transition" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tag"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a tag" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_is_tagged" wp_transition_is_tagged :: 
    Ptr Transition ->                       -- self : TInterface (Name {namespace = "Wp", name = "Transition"})
    Ptr () ->                               -- tag : TBasicType TPtr
    IO CInt

-- | Checks if /@self@/ has the given /@tag@/ (generally a function pointer indicating the function /@self@/ was created by).
transitionIsTagged ::
    (B.CallStack.HasCallStack, MonadIO m, IsTransition a) =>
    a
    -- ^ /@self@/: the transition
    -> Ptr ()
    -- ^ /@tag@/: a tag
    -> m Bool
    -- ^ __Returns:__ TRUE if /@self@/ has the indicated /@tag@/ , FALSE if not.
transitionIsTagged self tag = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_transition_is_tagged self' tag
    let result' = (/= 0) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data TransitionIsTaggedMethodInfo
instance (signature ~ (Ptr () -> m Bool), MonadIO m, IsTransition a) => O.OverloadedMethod TransitionIsTaggedMethodInfo a signature where
    overloadedMethod = transitionIsTagged

instance O.OverloadedMethodInfo TransitionIsTaggedMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Transition.transitionIsTagged",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Transition.html#v:transitionIsTagged"
        })


#endif

-- method Transition::return_error
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Transition" }
--           , argCType = Just "WpTransition*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the transition" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "error"
--           , argType = TError
--           , argCType = Just "GError*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a GError" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_return_error" wp_transition_return_error :: 
    Ptr Transition ->                       -- self : TInterface (Name {namespace = "Wp", name = "Transition"})
    Ptr GError ->                           -- error : TError
    IO ()

-- | Completes the transition with an error.
-- 
-- 
-- This can be called anytime from within any virtual function or an async job handler.
-- In most cases this will also unref the transition, so it is not safe to access it after this function has been called.
transitionReturnError ::
    (B.CallStack.HasCallStack, MonadIO m, IsTransition a) =>
    a
    -- ^ /@self@/: the transition
    -> GError
    -- ^ /@error@/: a GError
    -> m ()
transitionReturnError self error_ = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    error_' <- B.ManagedPtr.disownBoxed error_
    wp_transition_return_error self' error_'
    touchManagedPtr self
    touchManagedPtr error_
    return ()

#if defined(ENABLE_OVERLOADING)
data TransitionReturnErrorMethodInfo
instance (signature ~ (GError -> m ()), MonadIO m, IsTransition a) => O.OverloadedMethod TransitionReturnErrorMethodInfo a signature where
    overloadedMethod = transitionReturnError

instance O.OverloadedMethodInfo TransitionReturnErrorMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Transition.transitionReturnError",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Transition.html#v:transitionReturnError"
        })


#endif

-- method Transition::set_data
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Transition" }
--           , argCType = Just "WpTransition*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the transition" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "transition-specific user data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data_destroy"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "DestroyNotify" }
--           , argCType = Just "GDestroyNotify"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "GDestroyNotify for @data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_set_data" wp_transition_set_data :: 
    Ptr Transition ->                       -- self : TInterface (Name {namespace = "Wp", name = "Transition"})
    Ptr () ->                               -- data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- data_destroy : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

-- | Sets /@self@/ \'s data (freeing the existing data, if any). This can be an arbitrary user structure that holds data associated with this transition.
transitionSetData ::
    (B.CallStack.HasCallStack, MonadIO m, IsTransition a) =>
    a
    -- ^ /@self@/: the transition
    -> Ptr ()
    -- ^ /@data@/: transition-specific user data
    -> Maybe (GLib.Callbacks.DestroyNotify)
    -- ^ /@dataDestroy@/: GDestroyNotify for /@data@/
    -> m ()
transitionSetData self data_ dataDestroy = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    maybeDataDestroy <- case dataDestroy of
        Nothing -> return FP.nullFunPtr
        Just jDataDestroy -> do
            ptrdataDestroy <- callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_DestroyNotify))
            jDataDestroy' <- GLib.Callbacks.mk_DestroyNotify (GLib.Callbacks.wrap_DestroyNotify (Just ptrdataDestroy) jDataDestroy)
            poke ptrdataDestroy jDataDestroy'
            return jDataDestroy'
    wp_transition_set_data self' data_ maybeDataDestroy
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data TransitionSetDataMethodInfo
instance (signature ~ (Ptr () -> Maybe (GLib.Callbacks.DestroyNotify) -> m ()), MonadIO m, IsTransition a) => O.OverloadedMethod TransitionSetDataMethodInfo a signature where
    overloadedMethod = transitionSetData

instance O.OverloadedMethodInfo TransitionSetDataMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Transition.transitionSetData",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Transition.html#v:transitionSetData"
        })


#endif

-- method Transition::set_source_tag
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Transition" }
--           , argCType = Just "WpTransition*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the transition" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tag"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "an opaque pointer indicating the source of this transition"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "wp_transition_set_source_tag" wp_transition_set_source_tag :: 
    Ptr Transition ->                       -- self : TInterface (Name {namespace = "Wp", name = "Transition"})
    Ptr () ->                               -- tag : TBasicType TPtr
    IO ()

-- | Sets /@self@/ \'s source tag.
-- 
-- 
-- You can use this to tag a transition\'s return value with a particular pointer (usually a pointer to the function doing the tagging) and then later check it using 'GI.Wp.Objects.Transition.transitionGetSourceTag' (or 'GI.Gio.Interfaces.AsyncResult.asyncResultIsTagged') in the transition\'s \"finish\" function, to figure out if the response came from a particular place.
transitionSetSourceTag ::
    (B.CallStack.HasCallStack, MonadIO m, IsTransition a) =>
    a
    -- ^ /@self@/: the transition
    -> Ptr ()
    -- ^ /@tag@/: an opaque pointer indicating the source of this transition
    -> m ()
transitionSetSourceTag self tag = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    wp_transition_set_source_tag self' tag
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data TransitionSetSourceTagMethodInfo
instance (signature ~ (Ptr () -> m ()), MonadIO m, IsTransition a) => O.OverloadedMethod TransitionSetSourceTagMethodInfo a signature where
    overloadedMethod = transitionSetSourceTag

instance O.OverloadedMethodInfo TransitionSetSourceTagMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Transition.transitionSetSourceTag",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Transition.html#v:transitionSetSourceTag"
        })


#endif

-- method Transition::finish
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "res"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , argCType = Just "GAsyncResult*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a transition, as a GAsyncResult"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "wp_transition_finish" wp_transition_finish :: 
    Ptr Gio.AsyncResult.AsyncResult ->      -- res : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Returns the final return status of the transition and its error, if there was one.
-- 
-- 
-- This is meant to be called from within the GAsyncReadyCallback that was specified in 'GI.Wp.Objects.Transition.transitionNew'.
transitionFinish ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
    a
    -- ^ /@res@/: a transition, as a GAsyncResult
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
transitionFinish res = liftIO $ do
    res' <- unsafeManagedPtrCastPtr res
    onException (do
        _ <- propagateGError $ wp_transition_finish res'
        touchManagedPtr res
        return ()
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING)
#endif


