{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A WpTransition that is used by WpObject to implement feature activation.

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

module GI.Wp.Objects.FeatureActivationTransition
    ( 

-- * Exported types
    FeatureActivationTransition(..)         ,
    IsFeatureActivationTransition           ,
    toFeatureActivationTransition           ,


 -- * 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"), [getRequestedFeatures]("GI.Wp.Objects.FeatureActivationTransition#g:method:getRequestedFeatures"), [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)
    ResolveFeatureActivationTransitionMethod,
#endif

-- ** getRequestedFeatures #method:getRequestedFeatures#

#if defined(ENABLE_OVERLOADING)
    FeatureActivationTransitionGetRequestedFeaturesMethodInfo,
#endif
    featureActivationTransitionGetRequestedFeatures,




    ) 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
import {-# SOURCE #-} qualified GI.Wp.Objects.Transition as Wp.Transition

#else
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Wp.Objects.Transition as Wp.Transition

#endif

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

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

foreign import ccall "wp_feature_activation_transition_get_type"
    c_wp_feature_activation_transition_get_type :: IO B.Types.GType

instance B.Types.TypedObject FeatureActivationTransition where
    glibType = c_wp_feature_activation_transition_get_type

instance B.Types.GObject FeatureActivationTransition

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

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

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

-- | Convert t'FeatureActivationTransition' 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 FeatureActivationTransition) where
    gvalueGType_ = c_wp_feature_activation_transition_get_type
    gvalueSet_ gv P.Nothing = B.GValue.set_object gv (FP.nullPtr :: FP.Ptr FeatureActivationTransition)
    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 FeatureActivationTransition)
        if ptr /= FP.nullPtr
        then P.Just <$> B.ManagedPtr.newObject FeatureActivationTransition ptr
        else return P.Nothing
        
    

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

instance (info ~ ResolveFeatureActivationTransitionMethod t FeatureActivationTransition, O.OverloadedMethod info FeatureActivationTransition p) => OL.IsLabel t (FeatureActivationTransition -> 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 ~ ResolveFeatureActivationTransitionMethod t FeatureActivationTransition, O.OverloadedMethod info FeatureActivationTransition p, R.HasField t FeatureActivationTransition p) => R.HasField t FeatureActivationTransition p where
    getField = O.overloadedMethod @info

#endif

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

#endif

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

#if defined(ENABLE_OVERLOADING)
#endif

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

#endif

-- method FeatureActivationTransition::get_requested_features
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface
--                 Name { namespace = "Wp" , name = "FeatureActivationTransition" }
--           , argCType = Just "WpFeatureActivationTransition*"
--           , 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 TUInt)
-- throws : False
-- Skip return : False

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

-- | Gets the features requested to be activated in this transition.
featureActivationTransitionGetRequestedFeatures ::
    (B.CallStack.HasCallStack, MonadIO m, IsFeatureActivationTransition a) =>
    a
    -- ^ /@self@/: the transition
    -> m Word32
    -- ^ __Returns:__ the features that were requested to be activated in this transition; this contains the features as they were passed in 'GI.Wp.Objects.Object.objectActivate' and therefore it may contain unsupported or already active features
featureActivationTransitionGetRequestedFeatures self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_feature_activation_transition_get_requested_features self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data FeatureActivationTransitionGetRequestedFeaturesMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsFeatureActivationTransition a) => O.OverloadedMethod FeatureActivationTransitionGetRequestedFeaturesMethodInfo a signature where
    overloadedMethod = featureActivationTransitionGetRequestedFeatures

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


#endif


