packages feed

gi-wireplumber-0.5.14: GI/Wp/Objects/SessionItem.hs

{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Session items are high level objects that wrap underlying PipeWire objects and manage them. For example, a session item may be managing a node, taking responsibility for configuring the PortConfig and Format parameters of the node. Or another may be managing links between two nodes.
-- All the implementations are provided by modules and instantiated via the WpSiFactory class.

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

module GI.Wp.Objects.SessionItem
    ( 

-- * Exported types
    SessionItem(..)                         ,
    IsSessionItem                           ,
    toSessionItem                           ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [abortActivation]("GI.Wp.Objects.Object#g:method:abortActivation"), [activate]("GI.Wp.Objects.Object#g:method:activate"), [activateClosure]("GI.Wp.Objects.Object#g:method:activateClosure"), [activateFinish]("GI.Wp.Objects.Object#g:method:activateFinish"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [configure]("GI.Wp.Objects.SessionItem#g:method:configure"), [deactivate]("GI.Wp.Objects.Object#g:method:deactivate"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isConfigured]("GI.Wp.Objects.SessionItem#g:method:isConfigured"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [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"), [register]("GI.Wp.Objects.SessionItem#g:method:register"), [remove]("GI.Wp.Objects.SessionItem#g:method:remove"), [reset]("GI.Wp.Objects.SessionItem#g:method:reset"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [testActiveFeatures]("GI.Wp.Objects.Object#g:method:testActiveFeatures"), [testSupportedFeatures]("GI.Wp.Objects.Object#g:method:testSupportedFeatures"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [updateFeatures]("GI.Wp.Objects.Object#g:method:updateFeatures"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getActiveFeatures]("GI.Wp.Objects.Object#g:method:getActiveFeatures"), [getAssociatedProxy]("GI.Wp.Objects.SessionItem#g:method:getAssociatedProxy"), [getAssociatedProxyId]("GI.Wp.Objects.SessionItem#g:method:getAssociatedProxyId"), [getCore]("GI.Wp.Objects.Object#g:method:getCore"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getId]("GI.Wp.Objects.Object#g:method:getId"), [getProperties]("GI.Wp.Objects.SessionItem#g:method:getProperties"), [getProperty]("GI.Wp.Objects.SessionItem#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getSupportedFeatures]("GI.Wp.Objects.Object#g:method:getSupportedFeatures").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperties]("GI.Wp.Objects.SessionItem#g:method:setProperties"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveSessionItemMethod                ,
#endif

-- ** configure #method:configure#

#if defined(ENABLE_OVERLOADING)
    SessionItemConfigureMethodInfo          ,
#endif
    sessionItemConfigure                    ,


-- ** getAssociatedProxy #method:getAssociatedProxy#

#if defined(ENABLE_OVERLOADING)
    SessionItemGetAssociatedProxyMethodInfo ,
#endif
    sessionItemGetAssociatedProxy           ,


-- ** getAssociatedProxyId #method:getAssociatedProxyId#

#if defined(ENABLE_OVERLOADING)
    SessionItemGetAssociatedProxyIdMethodInfo,
#endif
    sessionItemGetAssociatedProxyId         ,


-- ** getProperties #method:getProperties#

#if defined(ENABLE_OVERLOADING)
    SessionItemGetPropertiesMethodInfo      ,
#endif
    sessionItemGetProperties                ,


-- ** getProperty #method:getProperty#

#if defined(ENABLE_OVERLOADING)
    SessionItemGetPropertyMethodInfo        ,
#endif
    sessionItemGetProperty                  ,


-- ** handleProxyDestroyed #method:handleProxyDestroyed#

    sessionItemHandleProxyDestroyed         ,


-- ** isConfigured #method:isConfigured#

#if defined(ENABLE_OVERLOADING)
    SessionItemIsConfiguredMethodInfo       ,
#endif
    sessionItemIsConfigured                 ,


-- ** make #method:make#

    sessionItemMake                         ,


-- ** register #method:register#

#if defined(ENABLE_OVERLOADING)
    SessionItemRegisterMethodInfo           ,
#endif
    sessionItemRegister                     ,


-- ** remove #method:remove#

#if defined(ENABLE_OVERLOADING)
    SessionItemRemoveMethodInfo             ,
#endif
    sessionItemRemove                       ,


-- ** reset #method:reset#

#if defined(ENABLE_OVERLOADING)
    SessionItemResetMethodInfo              ,
#endif
    sessionItemReset                        ,


-- ** setProperties #method:setProperties#

#if defined(ENABLE_OVERLOADING)
    SessionItemSetPropertiesMethodInfo      ,
#endif
    sessionItemSetProperties                ,




 -- * Properties


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

#if defined(ENABLE_OVERLOADING)
    SessionItemPropertiesPropertyInfo       ,
#endif
    getSessionItemProperties                ,
#if defined(ENABLE_OVERLOADING)
    sessionItemProperties                   ,
#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.GLib.Structs.MainContext as GLib.MainContext
import qualified GI.GLib.Structs.Source as GLib.Source
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 qualified GI.Wp.Callbacks as Wp.Callbacks
import {-# SOURCE #-} qualified GI.Wp.Enums as Wp.Enums
import {-# SOURCE #-} qualified GI.Wp.Flags as Wp.Flags
import {-# SOURCE #-} qualified GI.Wp.Objects.Conf as Wp.Conf
import {-# SOURCE #-} qualified GI.Wp.Objects.Core as Wp.Core
import {-# SOURCE #-} qualified GI.Wp.Objects.Object as Wp.Object
import {-# SOURCE #-} qualified GI.Wp.Objects.ObjectManager as Wp.ObjectManager
import {-# SOURCE #-} qualified GI.Wp.Objects.Proxy as Wp.Proxy
import {-# SOURCE #-} qualified GI.Wp.Structs.Iterator as Wp.Iterator
import {-# SOURCE #-} qualified GI.Wp.Structs.IteratorMethods as Wp.IteratorMethods
import {-# SOURCE #-} qualified GI.Wp.Structs.ObjectInterest as Wp.ObjectInterest
import {-# SOURCE #-} qualified GI.Wp.Structs.Properties as Wp.Properties
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaJson as Wp.SpaJson

#else
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Wp.Objects.Core as Wp.Core
import {-# SOURCE #-} qualified GI.Wp.Objects.Object as Wp.Object
import {-# SOURCE #-} qualified GI.Wp.Objects.Proxy as Wp.Proxy
import {-# SOURCE #-} qualified GI.Wp.Structs.Properties as Wp.Properties

#endif

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

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

foreign import ccall "wp_session_item_get_type"
    c_wp_session_item_get_type :: IO B.Types.GType

instance B.Types.TypedObject SessionItem where
    glibType = c_wp_session_item_get_type

instance B.Types.GObject SessionItem

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

instance O.HasParentTypes SessionItem
type instance O.ParentTypes SessionItem = '[Wp.Object.Object, GObject.Object.Object]

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

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

#if defined(ENABLE_OVERLOADING)
type family ResolveSessionItemMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveSessionItemMethod "abortActivation" o = Wp.Object.ObjectAbortActivationMethodInfo
    ResolveSessionItemMethod "activate" o = Wp.Object.ObjectActivateMethodInfo
    ResolveSessionItemMethod "activateClosure" o = Wp.Object.ObjectActivateClosureMethodInfo
    ResolveSessionItemMethod "activateFinish" o = Wp.Object.ObjectActivateFinishMethodInfo
    ResolveSessionItemMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSessionItemMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSessionItemMethod "configure" o = SessionItemConfigureMethodInfo
    ResolveSessionItemMethod "deactivate" o = Wp.Object.ObjectDeactivateMethodInfo
    ResolveSessionItemMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSessionItemMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSessionItemMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveSessionItemMethod "isConfigured" o = SessionItemIsConfiguredMethodInfo
    ResolveSessionItemMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSessionItemMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSessionItemMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSessionItemMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSessionItemMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSessionItemMethod "register" o = SessionItemRegisterMethodInfo
    ResolveSessionItemMethod "remove" o = SessionItemRemoveMethodInfo
    ResolveSessionItemMethod "reset" o = SessionItemResetMethodInfo
    ResolveSessionItemMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSessionItemMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSessionItemMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSessionItemMethod "testActiveFeatures" o = Wp.Object.ObjectTestActiveFeaturesMethodInfo
    ResolveSessionItemMethod "testSupportedFeatures" o = Wp.Object.ObjectTestSupportedFeaturesMethodInfo
    ResolveSessionItemMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSessionItemMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSessionItemMethod "updateFeatures" o = Wp.Object.ObjectUpdateFeaturesMethodInfo
    ResolveSessionItemMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSessionItemMethod "getActiveFeatures" o = Wp.Object.ObjectGetActiveFeaturesMethodInfo
    ResolveSessionItemMethod "getAssociatedProxy" o = SessionItemGetAssociatedProxyMethodInfo
    ResolveSessionItemMethod "getAssociatedProxyId" o = SessionItemGetAssociatedProxyIdMethodInfo
    ResolveSessionItemMethod "getCore" o = Wp.Object.ObjectGetCoreMethodInfo
    ResolveSessionItemMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSessionItemMethod "getId" o = Wp.Object.ObjectGetIdMethodInfo
    ResolveSessionItemMethod "getProperties" o = SessionItemGetPropertiesMethodInfo
    ResolveSessionItemMethod "getProperty" o = SessionItemGetPropertyMethodInfo
    ResolveSessionItemMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSessionItemMethod "getSupportedFeatures" o = Wp.Object.ObjectGetSupportedFeaturesMethodInfo
    ResolveSessionItemMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSessionItemMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveSessionItemMethod "setProperties" o = SessionItemSetPropertiesMethodInfo
    ResolveSessionItemMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSessionItemMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#endif

-- VVV Prop "properties"
   -- Type: TInterface (Name {namespace = "Wp", name = "Properties"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@properties@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' sessionItem #properties
-- @
getSessionItemProperties :: (MonadIO m, IsSessionItem o) => o -> m (Maybe Wp.Properties.Properties)
getSessionItemProperties obj = MIO.liftIO $ B.Properties.getObjectPropertyBoxed obj "properties" Wp.Properties.Properties

#if defined(ENABLE_OVERLOADING)
data SessionItemPropertiesPropertyInfo
instance AttrInfo SessionItemPropertiesPropertyInfo where
    type AttrAllowedOps SessionItemPropertiesPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint SessionItemPropertiesPropertyInfo = IsSessionItem
    type AttrSetTypeConstraint SessionItemPropertiesPropertyInfo = (~) ()
    type AttrTransferTypeConstraint SessionItemPropertiesPropertyInfo = (~) ()
    type AttrTransferType SessionItemPropertiesPropertyInfo = ()
    type AttrGetType SessionItemPropertiesPropertyInfo = (Maybe Wp.Properties.Properties)
    type AttrLabel SessionItemPropertiesPropertyInfo = "properties"
    type AttrOrigin SessionItemPropertiesPropertyInfo = SessionItem
    attrGet = getSessionItemProperties
    attrSet = undefined
    attrPut = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SessionItem.properties"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14/docs/GI-Wp-Objects-SessionItem.html#g:attr:properties"
        })
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SessionItem
type instance O.AttributeList SessionItem = SessionItemAttributeList
type SessionItemAttributeList = ('[ '("activeFeatures", Wp.Object.ObjectActiveFeaturesPropertyInfo), '("core", Wp.Object.ObjectCorePropertyInfo), '("id", Wp.Object.ObjectIdPropertyInfo), '("properties", SessionItemPropertiesPropertyInfo), '("supportedFeatures", Wp.Object.ObjectSupportedFeaturesPropertyInfo)] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
sessionItemProperties :: AttrLabelProxy "properties"
sessionItemProperties = AttrLabelProxy

#endif

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

#endif

-- method SessionItem::configure
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SessionItem" }
--           , argCType = Just "WpSessionItem*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the session item" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the properties used to configure the item"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wp_session_item_configure" wp_session_item_configure :: 
    Ptr SessionItem ->                      -- self : TInterface (Name {namespace = "Wp", name = "SessionItem"})
    Ptr Wp.Properties.Properties ->         -- props : TInterface (Name {namespace = "Wp", name = "Properties"})
    IO CInt

-- | Configures the session item with a set of properties.
sessionItemConfigure ::
    (B.CallStack.HasCallStack, MonadIO m, IsSessionItem a) =>
    a
    -- ^ /@self@/: the session item
    -> Wp.Properties.Properties
    -- ^ /@props@/: the properties used to configure the item
    -> m Bool
    -- ^ __Returns:__ TRUE on success, FALSE if the item could not be configured
sessionItemConfigure self props = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    props' <- B.ManagedPtr.disownBoxed props
    result <- wp_session_item_configure self' props'
    let result' = (/= 0) result
    touchManagedPtr self
    touchManagedPtr props
    return result'

#if defined(ENABLE_OVERLOADING)
data SessionItemConfigureMethodInfo
instance (signature ~ (Wp.Properties.Properties -> m Bool), MonadIO m, IsSessionItem a) => O.OverloadedMethod SessionItemConfigureMethodInfo a signature where
    overloadedMethod = sessionItemConfigure

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


#endif

-- method SessionItem::get_associated_proxy
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SessionItem" }
--           , argCType = Just "WpSessionItem*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the session item" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "proxy_type"
--           , argType = TBasicType TGType
--           , argCType = Just "GType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a WpProxy subclass GType"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Proxy" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_session_item_get_associated_proxy" wp_session_item_get_associated_proxy :: 
    Ptr SessionItem ->                      -- self : TInterface (Name {namespace = "Wp", name = "SessionItem"})
    CGType ->                               -- proxy_type : TBasicType TGType
    IO (Ptr Wp.Proxy.Proxy)

-- | An associated proxy is a WpProxy subclass instance that is somehow related to this item.
sessionItemGetAssociatedProxy ::
    (B.CallStack.HasCallStack, MonadIO m, IsSessionItem a) =>
    a
    -- ^ /@self@/: the session item
    -> GType
    -- ^ /@proxyType@/: a WpProxy subclass GType
    -> m (Maybe Wp.Proxy.Proxy)
    -- ^ __Returns:__ the associated proxy of the specified /@proxyType@/, or NULL if there is no association to such a proxy
sessionItemGetAssociatedProxy self proxyType = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    let proxyType' = gtypeToCGType proxyType
    result <- wp_session_item_get_associated_proxy self' proxyType'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Wp.Proxy.Proxy) result'
        return result''
    touchManagedPtr self
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data SessionItemGetAssociatedProxyMethodInfo
instance (signature ~ (GType -> m (Maybe Wp.Proxy.Proxy)), MonadIO m, IsSessionItem a) => O.OverloadedMethod SessionItemGetAssociatedProxyMethodInfo a signature where
    overloadedMethod = sessionItemGetAssociatedProxy

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


#endif

-- method SessionItem::get_associated_proxy_id
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SessionItem" }
--           , argCType = Just "WpSessionItem*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the session item" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "proxy_type"
--           , argType = TBasicType TGType
--           , argCType = Just "GType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a WpProxy subclass GType"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "wp_session_item_get_associated_proxy_id" wp_session_item_get_associated_proxy_id :: 
    Ptr SessionItem ->                      -- self : TInterface (Name {namespace = "Wp", name = "SessionItem"})
    CGType ->                               -- proxy_type : TBasicType TGType
    IO Word32

-- | Gets the bound id of a proxy associated with the session item.
sessionItemGetAssociatedProxyId ::
    (B.CallStack.HasCallStack, MonadIO m, IsSessionItem a) =>
    a
    -- ^ /@self@/: the session item
    -> GType
    -- ^ /@proxyType@/: a WpProxy subclass GType
    -> m Word32
    -- ^ __Returns:__ the bound id of the associated proxy of the specified /@proxyType@/, or SPA_ID_INVALID if there is no association to such a proxy
sessionItemGetAssociatedProxyId self proxyType = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    let proxyType' = gtypeToCGType proxyType
    result <- wp_session_item_get_associated_proxy_id self' proxyType'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data SessionItemGetAssociatedProxyIdMethodInfo
instance (signature ~ (GType -> m Word32), MonadIO m, IsSessionItem a) => O.OverloadedMethod SessionItemGetAssociatedProxyIdMethodInfo a signature where
    overloadedMethod = sessionItemGetAssociatedProxyId

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


#endif

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

foreign import ccall "wp_session_item_get_properties" wp_session_item_get_properties :: 
    Ptr SessionItem ->                      -- self : TInterface (Name {namespace = "Wp", name = "SessionItem"})
    IO (Ptr Wp.Properties.Properties)

-- | Gets the properties of a session item.
sessionItemGetProperties ::
    (B.CallStack.HasCallStack, MonadIO m, IsSessionItem a) =>
    a
    -- ^ /@self@/: the session item
    -> m Wp.Properties.Properties
    -- ^ __Returns:__ the item\'s properties.
sessionItemGetProperties self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_session_item_get_properties self'
    checkUnexpectedReturnNULL "sessionItemGetProperties" result
    result' <- (wrapBoxed Wp.Properties.Properties) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SessionItemGetPropertiesMethodInfo
instance (signature ~ (m Wp.Properties.Properties), MonadIO m, IsSessionItem a) => O.OverloadedMethod SessionItemGetPropertiesMethodInfo a signature where
    overloadedMethod = sessionItemGetProperties

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


#endif

-- method SessionItem::get_property
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SessionItem" }
--           , argCType = Just "WpSessionItem*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the session item" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the property key" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "wp_session_item_get_property" wp_session_item_get_property :: 
    Ptr SessionItem ->                      -- self : TInterface (Name {namespace = "Wp", name = "SessionItem"})
    CString ->                              -- key : TBasicType TUTF8
    IO CString

-- | Looks up a named session item property value for a given key.
sessionItemGetProperty ::
    (B.CallStack.HasCallStack, MonadIO m, IsSessionItem a) =>
    a
    -- ^ /@self@/: the session item
    -> T.Text
    -- ^ /@key@/: the property key
    -> m T.Text
    -- ^ __Returns:__ the item property value for the given key.
sessionItemGetProperty self key = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    key' <- textToCString key
    result <- wp_session_item_get_property self' key'
    checkUnexpectedReturnNULL "sessionItemGetProperty" result
    result' <- cstringToText result
    touchManagedPtr self
    freeMem key'
    return result'

#if defined(ENABLE_OVERLOADING)
data SessionItemGetPropertyMethodInfo
instance (signature ~ (T.Text -> m T.Text), MonadIO m, IsSessionItem a) => O.OverloadedMethod SessionItemGetPropertyMethodInfo a signature where
    overloadedMethod = sessionItemGetProperty

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


#endif

-- method SessionItem::is_configured
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SessionItem" }
--           , argCType = Just "WpSessionItem*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the session item" , 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_session_item_is_configured" wp_session_item_is_configured :: 
    Ptr SessionItem ->                      -- self : TInterface (Name {namespace = "Wp", name = "SessionItem"})
    IO CInt

-- | Checks if the session item is configured.
sessionItemIsConfigured ::
    (B.CallStack.HasCallStack, MonadIO m, IsSessionItem a) =>
    a
    -- ^ /@self@/: the session item
    -> m Bool
    -- ^ __Returns:__ TRUE if the item is configured, FALSE otherwise
sessionItemIsConfigured self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_session_item_is_configured self'
    let result' = (/= 0) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SessionItemIsConfiguredMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSessionItem a) => O.OverloadedMethod SessionItemIsConfiguredMethodInfo a signature where
    overloadedMethod = sessionItemIsConfigured

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


#endif

-- method SessionItem::register
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SessionItem" }
--           , argCType = Just "WpSessionItem*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the session item" , 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_session_item_register" wp_session_item_register :: 
    Ptr SessionItem ->                      -- self : TInterface (Name {namespace = "Wp", name = "SessionItem"})
    IO ()

-- | Registers the session item to its associated core.
sessionItemRegister ::
    (B.CallStack.HasCallStack, MonadIO m, IsSessionItem a) =>
    a
    -- ^ /@self@/: the session item
    -> m ()
sessionItemRegister self = liftIO $ do
    self' <- B.ManagedPtr.disownObject self
    wp_session_item_register self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SessionItemRegisterMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSessionItem a) => O.OverloadedMethod SessionItemRegisterMethodInfo a signature where
    overloadedMethod = sessionItemRegister

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


#endif

-- method SessionItem::remove
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SessionItem" }
--           , argCType = Just "WpSessionItem*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the session item" , 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_session_item_remove" wp_session_item_remove :: 
    Ptr SessionItem ->                      -- self : TInterface (Name {namespace = "Wp", name = "SessionItem"})
    IO ()

-- | Removes the session item from its associated core.
sessionItemRemove ::
    (B.CallStack.HasCallStack, MonadIO m, IsSessionItem a) =>
    a
    -- ^ /@self@/: the session item
    -> m ()
sessionItemRemove self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    wp_session_item_remove self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SessionItemRemoveMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSessionItem a) => O.OverloadedMethod SessionItemRemoveMethodInfo a signature where
    overloadedMethod = sessionItemRemove

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


#endif

-- method SessionItem::reset
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SessionItem" }
--           , argCType = Just "WpSessionItem*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the session item" , 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_session_item_reset" wp_session_item_reset :: 
    Ptr SessionItem ->                      -- self : TInterface (Name {namespace = "Wp", name = "SessionItem"})
    IO ()

-- | Resets the session item.
-- 
-- 
-- This essentially removes the configuration and deactivates all active features.
sessionItemReset ::
    (B.CallStack.HasCallStack, MonadIO m, IsSessionItem a) =>
    a
    -- ^ /@self@/: the session item
    -> m ()
sessionItemReset self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    wp_session_item_reset self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SessionItemResetMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSessionItem a) => O.OverloadedMethod SessionItemResetMethodInfo a signature where
    overloadedMethod = sessionItemReset

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


#endif

-- method SessionItem::set_properties
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SessionItem" }
--           , argCType = Just "WpSessionItem*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the session item" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the new properties to set"
--                 , 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_session_item_set_properties" wp_session_item_set_properties :: 
    Ptr SessionItem ->                      -- self : TInterface (Name {namespace = "Wp", name = "SessionItem"})
    Ptr Wp.Properties.Properties ->         -- props : TInterface (Name {namespace = "Wp", name = "Properties"})
    IO ()

-- | Sets the item\'s properties.
-- 
-- 
-- This should only be done by sub-classes after the configuration has been done.
sessionItemSetProperties ::
    (B.CallStack.HasCallStack, MonadIO m, IsSessionItem a) =>
    a
    -- ^ /@self@/: the session item
    -> Wp.Properties.Properties
    -- ^ /@props@/: the new properties to set
    -> m ()
sessionItemSetProperties self props = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    props' <- B.ManagedPtr.disownBoxed props
    wp_session_item_set_properties self' props'
    touchManagedPtr self
    touchManagedPtr props
    return ()

#if defined(ENABLE_OVERLOADING)
data SessionItemSetPropertiesMethodInfo
instance (signature ~ (Wp.Properties.Properties -> m ()), MonadIO m, IsSessionItem a) => O.OverloadedMethod SessionItemSetPropertiesMethodInfo a signature where
    overloadedMethod = sessionItemSetProperties

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


#endif

-- method SessionItem::handle_proxy_destroyed
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "proxy"
--           , argType = TInterface Name { namespace = "Wp" , name = "Proxy" }
--           , argCType = Just "WpProxy*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the proxy that was destroyed by the server"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SessionItem" }
--           , argCType = Just "WpSessionItem*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the associated session item"
--                 , 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_session_item_handle_proxy_destroyed" wp_session_item_handle_proxy_destroyed :: 
    Ptr Wp.Proxy.Proxy ->                   -- proxy : TInterface (Name {namespace = "Wp", name = "Proxy"})
    Ptr SessionItem ->                      -- item : TInterface (Name {namespace = "Wp", name = "SessionItem"})
    IO ()

-- | Helper callback for sub-classes that defers and unexports the session item.
-- 
-- 
-- Only meant to be used when the pipewire proxy destroyed signal is triggered.
sessionItemHandleProxyDestroyed ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.Proxy.IsProxy a, IsSessionItem b) =>
    a
    -- ^ /@proxy@/: the proxy that was destroyed by the server
    -> b
    -- ^ /@item@/: the associated session item
    -> m ()
sessionItemHandleProxyDestroyed proxy item = liftIO $ do
    proxy' <- unsafeManagedPtrCastPtr proxy
    item' <- unsafeManagedPtrCastPtr item
    wp_session_item_handle_proxy_destroyed proxy' item'
    touchManagedPtr proxy
    touchManagedPtr item
    return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method SessionItem::make
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "core"
--           , argType = TInterface Name { namespace = "Wp" , name = "Core" }
--           , argCType = Just "WpCore*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the WpCore" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "factory_name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the name of the factory to be used for constructing the object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "SessionItem" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_session_item_make" wp_session_item_make :: 
    Ptr Wp.Core.Core ->                     -- core : TInterface (Name {namespace = "Wp", name = "Core"})
    CString ->                              -- factory_name : TBasicType TUTF8
    IO (Ptr SessionItem)

-- | Finds the factory associated with the given /@name@/ from the /@core@/ and uses it to construct a new WpSessionItem.
sessionItemMake ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.Core.IsCore a) =>
    a
    -- ^ /@core@/: the WpCore
    -> T.Text
    -- ^ /@factoryName@/: the name of the factory to be used for constructing the object
    -> m (Maybe SessionItem)
    -- ^ __Returns:__ the new session item
sessionItemMake core factoryName = liftIO $ do
    core' <- unsafeManagedPtrCastPtr core
    factoryName' <- textToCString factoryName
    result <- wp_session_item_make core' factoryName'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject SessionItem) result'
        return result''
    touchManagedPtr core
    freeMem factoryName'
    return maybeResult

#if defined(ENABLE_OVERLOADING)
#endif