{-# LANGUAGE ImplicitParams, RankNTypes, TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A WpSpaDevice allows running a spa_device object locally, loading the implementation from a SPA factory. This is useful to run device monitors inside the session manager and have control over creating the actual nodes that the spa_device requests to create.
-- To enable the spa device, call 'GI.Wp.Objects.Object.objectActivate' requesting WP_SPA_DEVICE_FEATURE_ENABLED.
-- For actual devices (not device monitors) it also possible and desirable to export the device to PipeWire, which can be done by requesting WP_PROXY_FEATURE_BOUND from 'GI.Wp.Objects.Object.objectActivate'. When exporting, the export should be done before enabling the device, by requesting both features at the same time.
-- When the \"client-context\" component is loaded, which is the case in the default daemon configuration, the SPA handle is loaded in a secondary pw_context that runs on its own thread, so that the device is not affected by anything that blocks WirePlumber\'s main loop. The WpSpaDevice itself stays on the thread that created it: all the signals below are emitted there, in the order in which the spa_device emitted them, and 'GI.Wp.Objects.SpaDevice.spaDeviceEnumParamsSync' and 'GI.Wp.Objects.SpaDevice.spaDeviceSetParam' remain synchronous. Note, though, that the signals are then emitted asynchronously, so a handler may run after the call that caused the event has returned.

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

module GI.Wp.Objects.SpaDevice
    ( 

-- * Exported types
    SpaDevice(..)                           ,
    IsSpaDevice                             ,
    toSpaDevice                             ,


 -- * 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"), [deactivate]("GI.Wp.Objects.Object#g:method:deactivate"), [enumParamsSync]("GI.Wp.Objects.SpaDevice#g:method:enumParamsSync"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [newManagedObjectIterator]("GI.Wp.Objects.SpaDevice#g:method:newManagedObjectIterator"), [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"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [storeManagedObject]("GI.Wp.Objects.SpaDevice#g:method:storeManagedObject"), [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"), [getBoundId]("GI.Wp.Objects.Proxy#g:method:getBoundId"), [getCore]("GI.Wp.Objects.Object#g:method:getCore"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getId]("GI.Wp.Objects.Object#g:method:getId"), [getInterfaceType]("GI.Wp.Objects.Proxy#g:method:getInterfaceType"), [getManagedObject]("GI.Wp.Objects.SpaDevice#g:method:getManagedObject"), [getProperties]("GI.Wp.Objects.SpaDevice#g:method:getProperties"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getPwProxy]("GI.Wp.Objects.Proxy#g:method:getPwProxy"), [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"), [setManagedPending]("GI.Wp.Objects.SpaDevice#g:method:setManagedPending"), [setParam]("GI.Wp.Objects.SpaDevice#g:method:setParam"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setPwProxy]("GI.Wp.Objects.Proxy#g:method:setPwProxy").

#if defined(ENABLE_OVERLOADING)
    ResolveSpaDeviceMethod                  ,
#endif

-- ** enumParamsSync #method:enumParamsSync#

#if defined(ENABLE_OVERLOADING)
    SpaDeviceEnumParamsSyncMethodInfo       ,
#endif
    spaDeviceEnumParamsSync                 ,


-- ** getManagedObject #method:getManagedObject#

#if defined(ENABLE_OVERLOADING)
    SpaDeviceGetManagedObjectMethodInfo     ,
#endif
    spaDeviceGetManagedObject               ,


-- ** getProperties #method:getProperties#

#if defined(ENABLE_OVERLOADING)
    SpaDeviceGetPropertiesMethodInfo        ,
#endif
    spaDeviceGetProperties                  ,


-- ** newFromSpaFactory #method:newFromSpaFactory#

    spaDeviceNewFromSpaFactory              ,


-- ** newManagedObjectIterator #method:newManagedObjectIterator#

#if defined(ENABLE_OVERLOADING)
    SpaDeviceNewManagedObjectIteratorMethodInfo,
#endif
    spaDeviceNewManagedObjectIterator       ,


-- ** newWrap #method:newWrap#

    spaDeviceNewWrap                        ,


-- ** setManagedPending #method:setManagedPending#

#if defined(ENABLE_OVERLOADING)
    SpaDeviceSetManagedPendingMethodInfo    ,
#endif
    spaDeviceSetManagedPending              ,


-- ** setParam #method:setParam#

#if defined(ENABLE_OVERLOADING)
    SpaDeviceSetParamMethodInfo             ,
#endif
    spaDeviceSetParam                       ,


-- ** storeManagedObject #method:storeManagedObject#

#if defined(ENABLE_OVERLOADING)
    SpaDeviceStoreManagedObjectMethodInfo   ,
#endif
    spaDeviceStoreManagedObject             ,




 -- * Properties


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

#if defined(ENABLE_OVERLOADING)
    SpaDevicePropertiesPropertyInfo         ,
#endif
    constructSpaDeviceProperties            ,
    getSpaDeviceProperties                  ,
#if defined(ENABLE_OVERLOADING)
    spaDeviceProperties                     ,
#endif


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

#if defined(ENABLE_OVERLOADING)
    SpaDeviceSpaDeviceHandlePropertyInfo    ,
#endif
    constructSpaDeviceSpaDeviceHandle       ,
    getSpaDeviceSpaDeviceHandle             ,
#if defined(ENABLE_OVERLOADING)
    spaDeviceSpaDeviceHandle                ,
#endif




 -- * Signals


-- ** createObject #signal:createObject#

    SpaDeviceCreateObjectCallback           ,
#if defined(ENABLE_OVERLOADING)
    SpaDeviceCreateObjectSignalInfo         ,
#endif
    afterSpaDeviceCreateObject              ,
    onSpaDeviceCreateObject                 ,


-- ** event #signal:event#

    SpaDeviceEventCallback                  ,
#if defined(ENABLE_OVERLOADING)
    SpaDeviceEventSignalInfo                ,
#endif
    afterSpaDeviceEvent                     ,
    onSpaDeviceEvent                        ,


-- ** objectRemoved #signal:objectRemoved#

    SpaDeviceObjectRemovedCallback          ,
#if defined(ENABLE_OVERLOADING)
    SpaDeviceObjectRemovedSignalInfo        ,
#endif
    afterSpaDeviceObjectRemoved             ,
    onSpaDeviceObjectRemoved                ,


-- ** paramsChanged #signal:paramsChanged#

    SpaDeviceParamsChangedCallback          ,
#if defined(ENABLE_OVERLOADING)
    SpaDeviceParamsChangedSignalInfo        ,
#endif
    afterSpaDeviceParamsChanged             ,
    onSpaDeviceParamsChanged                ,




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

#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.Iterator as Wp.Iterator
import {-# SOURCE #-} qualified GI.Wp.Structs.Properties as Wp.Properties
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaPod as Wp.SpaPod

#endif

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

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

foreign import ccall "wp_spa_device_get_type"
    c_wp_spa_device_get_type :: IO B.Types.GType

instance B.Types.TypedObject SpaDevice where
    glibType = c_wp_spa_device_get_type

instance B.Types.GObject SpaDevice

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

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

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

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

#if defined(ENABLE_OVERLOADING)
type family ResolveSpaDeviceMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveSpaDeviceMethod "abortActivation" o = Wp.Object.ObjectAbortActivationMethodInfo
    ResolveSpaDeviceMethod "activate" o = Wp.Object.ObjectActivateMethodInfo
    ResolveSpaDeviceMethod "activateClosure" o = Wp.Object.ObjectActivateClosureMethodInfo
    ResolveSpaDeviceMethod "activateFinish" o = Wp.Object.ObjectActivateFinishMethodInfo
    ResolveSpaDeviceMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSpaDeviceMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSpaDeviceMethod "deactivate" o = Wp.Object.ObjectDeactivateMethodInfo
    ResolveSpaDeviceMethod "enumParamsSync" o = SpaDeviceEnumParamsSyncMethodInfo
    ResolveSpaDeviceMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSpaDeviceMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSpaDeviceMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveSpaDeviceMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSpaDeviceMethod "newManagedObjectIterator" o = SpaDeviceNewManagedObjectIteratorMethodInfo
    ResolveSpaDeviceMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSpaDeviceMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSpaDeviceMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSpaDeviceMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSpaDeviceMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSpaDeviceMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSpaDeviceMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSpaDeviceMethod "storeManagedObject" o = SpaDeviceStoreManagedObjectMethodInfo
    ResolveSpaDeviceMethod "testActiveFeatures" o = Wp.Object.ObjectTestActiveFeaturesMethodInfo
    ResolveSpaDeviceMethod "testSupportedFeatures" o = Wp.Object.ObjectTestSupportedFeaturesMethodInfo
    ResolveSpaDeviceMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSpaDeviceMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSpaDeviceMethod "updateFeatures" o = Wp.Object.ObjectUpdateFeaturesMethodInfo
    ResolveSpaDeviceMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSpaDeviceMethod "getActiveFeatures" o = Wp.Object.ObjectGetActiveFeaturesMethodInfo
    ResolveSpaDeviceMethod "getBoundId" o = Wp.Proxy.ProxyGetBoundIdMethodInfo
    ResolveSpaDeviceMethod "getCore" o = Wp.Object.ObjectGetCoreMethodInfo
    ResolveSpaDeviceMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSpaDeviceMethod "getId" o = Wp.Object.ObjectGetIdMethodInfo
    ResolveSpaDeviceMethod "getInterfaceType" o = Wp.Proxy.ProxyGetInterfaceTypeMethodInfo
    ResolveSpaDeviceMethod "getManagedObject" o = SpaDeviceGetManagedObjectMethodInfo
    ResolveSpaDeviceMethod "getProperties" o = SpaDeviceGetPropertiesMethodInfo
    ResolveSpaDeviceMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSpaDeviceMethod "getPwProxy" o = Wp.Proxy.ProxyGetPwProxyMethodInfo
    ResolveSpaDeviceMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSpaDeviceMethod "getSupportedFeatures" o = Wp.Object.ObjectGetSupportedFeaturesMethodInfo
    ResolveSpaDeviceMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSpaDeviceMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveSpaDeviceMethod "setManagedPending" o = SpaDeviceSetManagedPendingMethodInfo
    ResolveSpaDeviceMethod "setParam" o = SpaDeviceSetParamMethodInfo
    ResolveSpaDeviceMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSpaDeviceMethod "setPwProxy" o = Wp.Proxy.ProxySetPwProxyMethodInfo
    ResolveSpaDeviceMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#endif

-- signal SpaDevice::create-object
-- | /No description available in the introspection data./
type SpaDeviceCreateObjectCallback =
    Word32
    -> T.Text
    -> T.Text
    -> Wp.Properties.Properties
    -> IO ()

type C_SpaDeviceCreateObjectCallback =
    Ptr SpaDevice ->                        -- object
    Word32 ->
    CString ->
    CString ->
    Ptr Wp.Properties.Properties ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_SpaDeviceCreateObjectCallback`.
foreign import ccall "wrapper"
    mk_SpaDeviceCreateObjectCallback :: C_SpaDeviceCreateObjectCallback -> IO (FunPtr C_SpaDeviceCreateObjectCallback)

wrap_SpaDeviceCreateObjectCallback :: 
    GObject a => (a -> SpaDeviceCreateObjectCallback) ->
    C_SpaDeviceCreateObjectCallback
wrap_SpaDeviceCreateObjectCallback gi'cb gi'selfPtr object p0 p1 p2 _ = do
    p0' <- cstringToText p0
    p1' <- cstringToText p1
    B.ManagedPtr.withTransient  p2 $ \p2' -> do
        B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self)  object p0' p1' p2'


-- | Connect a signal handler for the [createObject](#signal:createObject) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' spaDevice #createObject callback
-- @
-- 
-- 
onSpaDeviceCreateObject :: (IsSpaDevice a, MonadIO m) => a -> ((?self :: a) => SpaDeviceCreateObjectCallback) -> m SignalHandlerId
onSpaDeviceCreateObject obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_SpaDeviceCreateObjectCallback wrapped
    wrapped'' <- mk_SpaDeviceCreateObjectCallback wrapped'
    connectSignalFunPtr obj "create-object" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [createObject](#signal:createObject) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' spaDevice #createObject callback
-- @
-- 
-- 
-- 
-- By default the object invoking the signal is not passed to the callback.
-- If you need to access it, you can use the implit @?self@ parameter.
-- Note that this requires activating the @ImplicitParams@ GHC extension.
-- 
afterSpaDeviceCreateObject :: (IsSpaDevice a, MonadIO m) => a -> ((?self :: a) => SpaDeviceCreateObjectCallback) -> m SignalHandlerId
afterSpaDeviceCreateObject obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_SpaDeviceCreateObjectCallback wrapped
    wrapped'' <- mk_SpaDeviceCreateObjectCallback wrapped'
    connectSignalFunPtr obj "create-object" wrapped'' SignalConnectAfter Nothing


#if defined(ENABLE_OVERLOADING)
data SpaDeviceCreateObjectSignalInfo
instance SignalInfo SpaDeviceCreateObjectSignalInfo where
    type HaskellCallbackType SpaDeviceCreateObjectSignalInfo = SpaDeviceCreateObjectCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_SpaDeviceCreateObjectCallback cb
        cb'' <- mk_SpaDeviceCreateObjectCallback cb'
        connectSignalFunPtr obj "create-object" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaDevice::create-object"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-SpaDevice.html#g:signal:createObject"})

#endif

-- signal SpaDevice::event
-- | /No description available in the introspection data./
type SpaDeviceEventCallback =
    Wp.SpaPod.SpaPod
    -> IO ()

type C_SpaDeviceEventCallback =
    Ptr SpaDevice ->                        -- object
    Ptr Wp.SpaPod.SpaPod ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_SpaDeviceEventCallback`.
foreign import ccall "wrapper"
    mk_SpaDeviceEventCallback :: C_SpaDeviceEventCallback -> IO (FunPtr C_SpaDeviceEventCallback)

wrap_SpaDeviceEventCallback :: 
    GObject a => (a -> SpaDeviceEventCallback) ->
    C_SpaDeviceEventCallback
wrap_SpaDeviceEventCallback gi'cb gi'selfPtr object _ = do
    B.ManagedPtr.withTransient  object $ \object' -> do
        B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self)  object'


-- | Connect a signal handler for the [event](#signal:event) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' spaDevice #event callback
-- @
-- 
-- 
onSpaDeviceEvent :: (IsSpaDevice a, MonadIO m) => a -> ((?self :: a) => SpaDeviceEventCallback) -> m SignalHandlerId
onSpaDeviceEvent obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_SpaDeviceEventCallback wrapped
    wrapped'' <- mk_SpaDeviceEventCallback wrapped'
    connectSignalFunPtr obj "event" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [event](#signal:event) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' spaDevice #event callback
-- @
-- 
-- 
-- 
-- By default the object invoking the signal is not passed to the callback.
-- If you need to access it, you can use the implit @?self@ parameter.
-- Note that this requires activating the @ImplicitParams@ GHC extension.
-- 
afterSpaDeviceEvent :: (IsSpaDevice a, MonadIO m) => a -> ((?self :: a) => SpaDeviceEventCallback) -> m SignalHandlerId
afterSpaDeviceEvent obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_SpaDeviceEventCallback wrapped
    wrapped'' <- mk_SpaDeviceEventCallback wrapped'
    connectSignalFunPtr obj "event" wrapped'' SignalConnectAfter Nothing


#if defined(ENABLE_OVERLOADING)
data SpaDeviceEventSignalInfo
instance SignalInfo SpaDeviceEventSignalInfo where
    type HaskellCallbackType SpaDeviceEventSignalInfo = SpaDeviceEventCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_SpaDeviceEventCallback cb
        cb'' <- mk_SpaDeviceEventCallback cb'
        connectSignalFunPtr obj "event" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaDevice::event"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-SpaDevice.html#g:signal:event"})

#endif

-- signal SpaDevice::object-removed
-- | /No description available in the introspection data./
type SpaDeviceObjectRemovedCallback =
    Word32
    -> IO ()

type C_SpaDeviceObjectRemovedCallback =
    Ptr SpaDevice ->                        -- object
    Word32 ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_SpaDeviceObjectRemovedCallback`.
foreign import ccall "wrapper"
    mk_SpaDeviceObjectRemovedCallback :: C_SpaDeviceObjectRemovedCallback -> IO (FunPtr C_SpaDeviceObjectRemovedCallback)

wrap_SpaDeviceObjectRemovedCallback :: 
    GObject a => (a -> SpaDeviceObjectRemovedCallback) ->
    C_SpaDeviceObjectRemovedCallback
wrap_SpaDeviceObjectRemovedCallback gi'cb gi'selfPtr object _ = do
    B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self)  object


-- | Connect a signal handler for the [objectRemoved](#signal:objectRemoved) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' spaDevice #objectRemoved callback
-- @
-- 
-- 
onSpaDeviceObjectRemoved :: (IsSpaDevice a, MonadIO m) => a -> ((?self :: a) => SpaDeviceObjectRemovedCallback) -> m SignalHandlerId
onSpaDeviceObjectRemoved obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_SpaDeviceObjectRemovedCallback wrapped
    wrapped'' <- mk_SpaDeviceObjectRemovedCallback wrapped'
    connectSignalFunPtr obj "object-removed" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [objectRemoved](#signal:objectRemoved) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' spaDevice #objectRemoved callback
-- @
-- 
-- 
-- 
-- By default the object invoking the signal is not passed to the callback.
-- If you need to access it, you can use the implit @?self@ parameter.
-- Note that this requires activating the @ImplicitParams@ GHC extension.
-- 
afterSpaDeviceObjectRemoved :: (IsSpaDevice a, MonadIO m) => a -> ((?self :: a) => SpaDeviceObjectRemovedCallback) -> m SignalHandlerId
afterSpaDeviceObjectRemoved obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_SpaDeviceObjectRemovedCallback wrapped
    wrapped'' <- mk_SpaDeviceObjectRemovedCallback wrapped'
    connectSignalFunPtr obj "object-removed" wrapped'' SignalConnectAfter Nothing


#if defined(ENABLE_OVERLOADING)
data SpaDeviceObjectRemovedSignalInfo
instance SignalInfo SpaDeviceObjectRemovedSignalInfo where
    type HaskellCallbackType SpaDeviceObjectRemovedSignalInfo = SpaDeviceObjectRemovedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_SpaDeviceObjectRemovedCallback cb
        cb'' <- mk_SpaDeviceObjectRemovedCallback cb'
        connectSignalFunPtr obj "object-removed" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaDevice::object-removed"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-SpaDevice.html#g:signal:objectRemoved"})

#endif

-- signal SpaDevice::params-changed
-- | /No description available in the introspection data./
type SpaDeviceParamsChangedCallback =
    T.Text
    -> IO ()

type C_SpaDeviceParamsChangedCallback =
    Ptr SpaDevice ->                        -- object
    CString ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_SpaDeviceParamsChangedCallback`.
foreign import ccall "wrapper"
    mk_SpaDeviceParamsChangedCallback :: C_SpaDeviceParamsChangedCallback -> IO (FunPtr C_SpaDeviceParamsChangedCallback)

wrap_SpaDeviceParamsChangedCallback :: 
    GObject a => (a -> SpaDeviceParamsChangedCallback) ->
    C_SpaDeviceParamsChangedCallback
wrap_SpaDeviceParamsChangedCallback gi'cb gi'selfPtr object _ = do
    object' <- cstringToText object
    B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self)  object'


-- | Connect a signal handler for the [paramsChanged](#signal:paramsChanged) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' spaDevice #paramsChanged callback
-- @
-- 
-- 
onSpaDeviceParamsChanged :: (IsSpaDevice a, MonadIO m) => a -> ((?self :: a) => SpaDeviceParamsChangedCallback) -> m SignalHandlerId
onSpaDeviceParamsChanged obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_SpaDeviceParamsChangedCallback wrapped
    wrapped'' <- mk_SpaDeviceParamsChangedCallback wrapped'
    connectSignalFunPtr obj "params-changed" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [paramsChanged](#signal:paramsChanged) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' spaDevice #paramsChanged callback
-- @
-- 
-- 
-- 
-- By default the object invoking the signal is not passed to the callback.
-- If you need to access it, you can use the implit @?self@ parameter.
-- Note that this requires activating the @ImplicitParams@ GHC extension.
-- 
afterSpaDeviceParamsChanged :: (IsSpaDevice a, MonadIO m) => a -> ((?self :: a) => SpaDeviceParamsChangedCallback) -> m SignalHandlerId
afterSpaDeviceParamsChanged obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_SpaDeviceParamsChangedCallback wrapped
    wrapped'' <- mk_SpaDeviceParamsChangedCallback wrapped'
    connectSignalFunPtr obj "params-changed" wrapped'' SignalConnectAfter Nothing


#if defined(ENABLE_OVERLOADING)
data SpaDeviceParamsChangedSignalInfo
instance SignalInfo SpaDeviceParamsChangedSignalInfo where
    type HaskellCallbackType SpaDeviceParamsChangedSignalInfo = SpaDeviceParamsChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_SpaDeviceParamsChangedCallback cb
        cb'' <- mk_SpaDeviceParamsChangedCallback cb'
        connectSignalFunPtr obj "params-changed" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaDevice::params-changed"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-SpaDevice.html#g:signal:paramsChanged"})

#endif

-- VVV Prop "properties"
   -- Type: TInterface (Name {namespace = "Wp", name = "Properties"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- 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' spaDevice #properties
-- @
getSpaDeviceProperties :: (MonadIO m, IsSpaDevice o) => o -> m (Maybe Wp.Properties.Properties)
getSpaDeviceProperties obj = MIO.liftIO $ B.Properties.getObjectPropertyBoxed obj "properties" Wp.Properties.Properties

-- | Construct a t'GValueConstruct' with valid value for the “@properties@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSpaDeviceProperties :: (IsSpaDevice o, MIO.MonadIO m) => Wp.Properties.Properties -> m (GValueConstruct o)
constructSpaDeviceProperties val = MIO.liftIO $ do
    MIO.liftIO $ B.Properties.constructObjectPropertyBoxed "properties" (P.Just val)

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

-- VVV Prop "spa-device-handle"
   -- Type: TBasicType TPtr
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@spa-device-handle@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' spaDevice #spaDeviceHandle
-- @
getSpaDeviceSpaDeviceHandle :: (MonadIO m, IsSpaDevice o) => o -> m (Ptr ())
getSpaDeviceSpaDeviceHandle obj = MIO.liftIO $ B.Properties.getObjectPropertyPtr obj "spa-device-handle"

-- | Construct a t'GValueConstruct' with valid value for the “@spa-device-handle@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSpaDeviceSpaDeviceHandle :: (IsSpaDevice o, MIO.MonadIO m) => Ptr () -> m (GValueConstruct o)
constructSpaDeviceSpaDeviceHandle val = MIO.liftIO $ do
    MIO.liftIO $ B.Properties.constructObjectPropertyPtr "spa-device-handle" val

#if defined(ENABLE_OVERLOADING)
data SpaDeviceSpaDeviceHandlePropertyInfo
instance AttrInfo SpaDeviceSpaDeviceHandlePropertyInfo where
    type AttrAllowedOps SpaDeviceSpaDeviceHandlePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrBaseTypeConstraint SpaDeviceSpaDeviceHandlePropertyInfo = IsSpaDevice
    type AttrSetTypeConstraint SpaDeviceSpaDeviceHandlePropertyInfo = (~) (Ptr ())
    type AttrTransferTypeConstraint SpaDeviceSpaDeviceHandlePropertyInfo = (~) (Ptr ())
    type AttrTransferType SpaDeviceSpaDeviceHandlePropertyInfo = Ptr ()
    type AttrGetType SpaDeviceSpaDeviceHandlePropertyInfo = (Ptr ())
    type AttrLabel SpaDeviceSpaDeviceHandlePropertyInfo = "spa-device-handle"
    type AttrOrigin SpaDeviceSpaDeviceHandlePropertyInfo = SpaDevice
    attrGet = getSpaDeviceSpaDeviceHandle
    attrSet = undefined
    attrPut = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructSpaDeviceSpaDeviceHandle
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.SpaDevice.spaDeviceHandle"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-SpaDevice.html#g:attr:spaDeviceHandle"
        })
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SpaDevice
type instance O.AttributeList SpaDevice = SpaDeviceAttributeList
type SpaDeviceAttributeList = ('[ '("activeFeatures", Wp.Object.ObjectActiveFeaturesPropertyInfo), '("boundId", Wp.Proxy.ProxyBoundIdPropertyInfo), '("core", Wp.Object.ObjectCorePropertyInfo), '("id", Wp.Object.ObjectIdPropertyInfo), '("properties", SpaDevicePropertiesPropertyInfo), '("pwProxy", Wp.Proxy.ProxyPwProxyPropertyInfo), '("spaDeviceHandle", SpaDeviceSpaDeviceHandlePropertyInfo), '("supportedFeatures", Wp.Object.ObjectSupportedFeaturesPropertyInfo)] :: [(Symbol, DK.Type)])
#endif

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

spaDeviceSpaDeviceHandle :: AttrLabelProxy "spaDeviceHandle"
spaDeviceSpaDeviceHandle = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList SpaDevice = SpaDeviceSignalList
type SpaDeviceSignalList = ('[ '("bound", Wp.Proxy.ProxyBoundSignalInfo), '("createObject", SpaDeviceCreateObjectSignalInfo), '("error", Wp.Proxy.ProxyErrorSignalInfo), '("event", SpaDeviceEventSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("objectRemoved", SpaDeviceObjectRemovedSignalInfo), '("paramsChanged", SpaDeviceParamsChangedSignalInfo), '("pwProxyCreated", Wp.Proxy.ProxyPwProxyCreatedSignalInfo), '("pwProxyDestroyed", Wp.Proxy.ProxyPwProxyDestroyedSignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method SpaDevice::new_from_spa_factory
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "core"
--           , argType = TInterface Name { namespace = "Wp" , name = "Core" }
--           , argCType = Just "WpCore*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the wireplumber core"
--                 , 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 SPA factory"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "properties"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "properties to be passed to device constructor"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "SpaDevice" })
-- throws : False
-- Skip return : False

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

-- | Constructs a SPA_TYPE_INTERFACE_Device by loading the given SPA /@factoryName@/.
-- 
-- 
-- To export this device to the PipeWire server, you need to call 'GI.Wp.Objects.Object.objectActivate' requesting WP_PROXY_FEATURE_BOUND and wait for the operation to complete.
spaDeviceNewFromSpaFactory ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.Core.IsCore a) =>
    a
    -- ^ /@core@/: the wireplumber core
    -> T.Text
    -- ^ /@factoryName@/: the name of the SPA factory
    -> Maybe (Wp.Properties.Properties)
    -- ^ /@properties@/: properties to be passed to device constructor
    -> m (Maybe SpaDevice)
    -- ^ __Returns:__ A new WpSpaDevice wrapping the device that was constructed by the factory, or NULL if the factory does not exist or was unable to construct the device
spaDeviceNewFromSpaFactory core factoryName properties = liftIO $ do
    core' <- unsafeManagedPtrCastPtr core
    factoryName' <- textToCString factoryName
    maybeProperties <- case properties of
        Nothing -> return FP.nullPtr
        Just jProperties -> do
            jProperties' <- B.ManagedPtr.disownBoxed jProperties
            return jProperties'
    result <- wp_spa_device_new_from_spa_factory core' factoryName' maybeProperties
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject SpaDevice) result'
        return result''
    touchManagedPtr core
    whenJust properties touchManagedPtr
    freeMem factoryName'
    return maybeResult

#if defined(ENABLE_OVERLOADING)
#endif

-- method SpaDevice::new_wrap
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "core"
--           , argType = TInterface Name { namespace = "Wp" , name = "Core" }
--           , argCType = Just "WpCore*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the wireplumber core"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "spa_device_handle"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa device handle"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "properties"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "additional properties of the device"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "SpaDevice" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_device_new_wrap" wp_spa_device_new_wrap :: 
    Ptr Wp.Core.Core ->                     -- core : TInterface (Name {namespace = "Wp", name = "Core"})
    Ptr () ->                               -- spa_device_handle : TBasicType TPtr
    Ptr Wp.Properties.Properties ->         -- properties : TInterface (Name {namespace = "Wp", name = "Properties"})
    IO (Ptr SpaDevice)

-- | Constructs an SPA Device object from an existing device handle.
spaDeviceNewWrap ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.Core.IsCore a) =>
    a
    -- ^ /@core@/: the wireplumber core
    -> Ptr ()
    -- ^ /@spaDeviceHandle@/: the spa device handle
    -> Maybe (Wp.Properties.Properties)
    -- ^ /@properties@/: additional properties of the device
    -> m SpaDevice
    -- ^ __Returns:__ A new WpSpaDevice
spaDeviceNewWrap core spaDeviceHandle properties = liftIO $ do
    core' <- unsafeManagedPtrCastPtr core
    maybeProperties <- case properties of
        Nothing -> return FP.nullPtr
        Just jProperties -> do
            jProperties' <- B.ManagedPtr.disownBoxed jProperties
            return jProperties'
    result <- wp_spa_device_new_wrap core' spaDeviceHandle maybeProperties
    checkUnexpectedReturnNULL "spaDeviceNewWrap" result
    result' <- (wrapObject SpaDevice) result
    touchManagedPtr core
    whenJust properties touchManagedPtr
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method SpaDevice::enum_params_sync
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaDevice" }
--           , argCType = Just "WpSpaDevice*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa device" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the parameter id to enumerate"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "filter"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaPod" }
--           , argCType = Just "WpSpaPod*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a param filter or NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Iterator" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_device_enum_params_sync" wp_spa_device_enum_params_sync :: 
    Ptr SpaDevice ->                        -- self : TInterface (Name {namespace = "Wp", name = "SpaDevice"})
    CString ->                              -- id : TBasicType TUTF8
    Ptr Wp.SpaPod.SpaPod ->                 -- filter : TInterface (Name {namespace = "Wp", name = "SpaPod"})
    IO (Ptr Wp.Iterator.Iterator)

-- | This method can be used to retrieve object parameters of the spa device synchronously because the spa device always runs locally.
-- 
-- /Since: 0.5.15/
spaDeviceEnumParamsSync ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaDevice a) =>
    a
    -- ^ /@self@/: the spa device
    -> T.Text
    -- ^ /@id@/: the parameter id to enumerate
    -> Maybe (Wp.SpaPod.SpaPod)
    -- ^ /@filter@/: a param filter or NULL
    -> m (Maybe Wp.Iterator.Iterator)
    -- ^ __Returns:__ an iterator to iterate over cached parameters, or NULL if parameters for this /@id@/ are not cached; the items in the iterator are WpSpaPod
spaDeviceEnumParamsSync self id filter = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    id' <- textToCString id
    maybeFilter <- case filter of
        Nothing -> return FP.nullPtr
        Just jFilter -> do
            jFilter' <- unsafeManagedPtrGetPtr jFilter
            return jFilter'
    result <- wp_spa_device_enum_params_sync self' id' maybeFilter
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Wp.Iterator.Iterator) result'
        return result''
    touchManagedPtr self
    whenJust filter touchManagedPtr
    freeMem id'
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data SpaDeviceEnumParamsSyncMethodInfo
instance (signature ~ (T.Text -> Maybe (Wp.SpaPod.SpaPod) -> m (Maybe Wp.Iterator.Iterator)), MonadIO m, IsSpaDevice a) => O.OverloadedMethod SpaDeviceEnumParamsSyncMethodInfo a signature where
    overloadedMethod = spaDeviceEnumParamsSync

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


#endif

-- method SpaDevice::get_managed_object
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaDevice" }
--           , argCType = Just "WpSpaDevice*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa device" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id"
--           , argType = TBasicType TUInt
--           , argCType = Just "guint"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the (device-internal) id of the object to get"
--                 , 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_spa_device_get_managed_object" wp_spa_device_get_managed_object :: 
    Ptr SpaDevice ->                        -- self : TInterface (Name {namespace = "Wp", name = "SpaDevice"})
    Word32 ->                               -- id : TBasicType TUInt
    IO (Ptr GObject.Object.Object)

-- | Gets one of the objects managed by this device.
spaDeviceGetManagedObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaDevice a) =>
    a
    -- ^ /@self@/: the spa device
    -> Word32
    -- ^ /@id@/: the (device-internal) id of the object to get
    -> m GObject.Object.Object
    -- ^ __Returns:__ the managed object associated with /@id@/
spaDeviceGetManagedObject self id = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_spa_device_get_managed_object self' id
    checkUnexpectedReturnNULL "spaDeviceGetManagedObject" result
    result' <- (wrapObject GObject.Object.Object) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaDeviceGetManagedObjectMethodInfo
instance (signature ~ (Word32 -> m GObject.Object.Object), MonadIO m, IsSpaDevice a) => O.OverloadedMethod SpaDeviceGetManagedObjectMethodInfo a signature where
    overloadedMethod = spaDeviceGetManagedObject

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


#endif

-- method SpaDevice::get_properties
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaDevice" }
--           , argCType = Just "WpSpaDevice*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa device" , 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_spa_device_get_properties" wp_spa_device_get_properties :: 
    Ptr SpaDevice ->                        -- self : TInterface (Name {namespace = "Wp", name = "SpaDevice"})
    IO (Ptr Wp.Properties.Properties)

-- | Gets the properties of this device.
spaDeviceGetProperties ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaDevice a) =>
    a
    -- ^ /@self@/: the spa device
    -> m Wp.Properties.Properties
    -- ^ __Returns:__ the device properties
spaDeviceGetProperties self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_spa_device_get_properties self'
    checkUnexpectedReturnNULL "spaDeviceGetProperties" result
    result' <- (wrapBoxed Wp.Properties.Properties) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaDeviceGetPropertiesMethodInfo
instance (signature ~ (m Wp.Properties.Properties), MonadIO m, IsSpaDevice a) => O.OverloadedMethod SpaDeviceGetPropertiesMethodInfo a signature where
    overloadedMethod = spaDeviceGetProperties

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


#endif

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

foreign import ccall "wp_spa_device_new_managed_object_iterator" wp_spa_device_new_managed_object_iterator :: 
    Ptr SpaDevice ->                        -- self : TInterface (Name {namespace = "Wp", name = "SpaDevice"})
    IO (Ptr Wp.Iterator.Iterator)

-- | Iterates through all the objects managed by this device.
-- 
-- /Since: 0.4.11/
spaDeviceNewManagedObjectIterator ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaDevice a) =>
    a
    -- ^ /@self@/: the spa device
    -> m Wp.Iterator.Iterator
    -- ^ __Returns:__ a WpIterator that iterates over all the objects managed by this device
spaDeviceNewManagedObjectIterator self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_spa_device_new_managed_object_iterator self'
    checkUnexpectedReturnNULL "spaDeviceNewManagedObjectIterator" result
    result' <- (wrapBoxed Wp.Iterator.Iterator) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaDeviceNewManagedObjectIteratorMethodInfo
instance (signature ~ (m Wp.Iterator.Iterator), MonadIO m, IsSpaDevice a) => O.OverloadedMethod SpaDeviceNewManagedObjectIteratorMethodInfo a signature where
    overloadedMethod = spaDeviceNewManagedObjectIterator

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


#endif

-- method SpaDevice::set_managed_pending
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaDevice" }
--           , argCType = Just "WpSpaDevice*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa device" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id"
--           , argType = TBasicType TUInt
--           , argCType = Just "guint"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the (device-internal) id of the object"
--                 , 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_spa_device_set_managed_pending" wp_spa_device_set_managed_pending :: 
    Ptr SpaDevice ->                        -- self : TInterface (Name {namespace = "Wp", name = "SpaDevice"})
    Word32 ->                               -- id : TBasicType TUInt
    IO ()

-- | Marks a managed object id pending.
-- 
-- 
-- When an object id is pending, Props from received ObjectConfig events for the id are saved. When wp_spa_device_store_managed_object later sets an object for the id, the saved Props are immediately set on the object and pending status is cleared.
-- If an object is already set for the id, this has no effect.
spaDeviceSetManagedPending ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaDevice a) =>
    a
    -- ^ /@self@/: the spa device
    -> Word32
    -- ^ /@id@/: the (device-internal) id of the object
    -> m ()
spaDeviceSetManagedPending self id = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    wp_spa_device_set_managed_pending self' id
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaDeviceSetManagedPendingMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsSpaDevice a) => O.OverloadedMethod SpaDeviceSetManagedPendingMethodInfo a signature where
    overloadedMethod = spaDeviceSetManagedPending

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


#endif

-- method SpaDevice::set_param
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaDevice" }
--           , argCType = Just "WpSpaDevice*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the pipewire object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the parameter id to set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType = TBasicType TUInt32
--           , argCType = Just "guint32"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "optional flags or 0"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "param"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaPod" }
--           , argCType = Just "WpSpaPod*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the parameter to set"
--                 , 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_spa_device_set_param" wp_spa_device_set_param :: 
    Ptr SpaDevice ->                        -- self : TInterface (Name {namespace = "Wp", name = "SpaDevice"})
    CString ->                              -- id : TBasicType TUTF8
    Word32 ->                               -- flags : TBasicType TUInt32
    Ptr Wp.SpaPod.SpaPod ->                 -- param : TInterface (Name {namespace = "Wp", name = "SpaPod"})
    IO CInt

-- | Sets a parameter on the spa device.
-- 
-- /Since: 0.5.15/
spaDeviceSetParam ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaDevice a) =>
    a
    -- ^ /@self@/: the pipewire object
    -> T.Text
    -- ^ /@id@/: the parameter id to set
    -> Word32
    -- ^ /@flags@/: optional flags or 0
    -> Wp.SpaPod.SpaPod
    -- ^ /@param@/: the parameter to set
    -> m Bool
    -- ^ __Returns:__ TRUE on success, FALSE if setting the param failed
spaDeviceSetParam self id flags param = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    id' <- textToCString id
    param' <- B.ManagedPtr.disownBoxed param
    result <- wp_spa_device_set_param self' id' flags param'
    let result' = (/= 0) result
    touchManagedPtr self
    touchManagedPtr param
    freeMem id'
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaDeviceSetParamMethodInfo
instance (signature ~ (T.Text -> Word32 -> Wp.SpaPod.SpaPod -> m Bool), MonadIO m, IsSpaDevice a) => O.OverloadedMethod SpaDeviceSetParamMethodInfo a signature where
    overloadedMethod = spaDeviceSetParam

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


#endif

-- method SpaDevice::store_managed_object
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaDevice" }
--           , argCType = Just "WpSpaDevice*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa device" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id"
--           , argType = TBasicType TUInt
--           , argCType = Just "guint"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the (device-internal) id of the object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , argCType = Just "GObject*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the object to store or NULL to remove the managed object associated with @id"
--                 , 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_spa_device_store_managed_object" wp_spa_device_store_managed_object :: 
    Ptr SpaDevice ->                        -- self : TInterface (Name {namespace = "Wp", name = "SpaDevice"})
    Word32 ->                               -- id : TBasicType TUInt
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    IO ()

-- | Stores or removes a managed object into\/from a device.
spaDeviceStoreManagedObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaDevice a, GObject.Object.IsObject b) =>
    a
    -- ^ /@self@/: the spa device
    -> Word32
    -- ^ /@id@/: the (device-internal) id of the object
    -> Maybe (b)
    -- ^ /@object@/: the object to store or NULL to remove the managed object associated with /@id@/
    -> m ()
spaDeviceStoreManagedObject self id object = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    maybeObject <- case object of
        Nothing -> return FP.nullPtr
        Just jObject -> do
            jObject' <- B.ManagedPtr.disownObject jObject
            return jObject'
    wp_spa_device_store_managed_object self' id maybeObject
    touchManagedPtr self
    whenJust object touchManagedPtr
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaDeviceStoreManagedObjectMethodInfo
instance (signature ~ (Word32 -> Maybe (b) -> m ()), MonadIO m, IsSpaDevice a, GObject.Object.IsObject b) => O.OverloadedMethod SpaDeviceStoreManagedObjectMethodInfo a signature where
    overloadedMethod = spaDeviceStoreManagedObject

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


#endif


