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


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Base class for all objects that expose PipeWire objects using pw_proxy underneath.
-- This base class cannot be instantiated. It provides handling of pw_proxy\'s events and exposes common functionality.

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

module GI.Wp.Objects.Proxy
    ( 

-- * Exported types
    Proxy(..)                               ,
    IsProxy                                 ,
    toProxy                                 ,


 -- * 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"), [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"), [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"), [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"), [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"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setPwProxy]("GI.Wp.Objects.Proxy#g:method:setPwProxy").

#if defined(ENABLE_OVERLOADING)
    ResolveProxyMethod                      ,
#endif

-- ** getBoundId #method:getBoundId#

#if defined(ENABLE_OVERLOADING)
    ProxyGetBoundIdMethodInfo               ,
#endif
    proxyGetBoundId                         ,


-- ** getInterfaceType #method:getInterfaceType#

#if defined(ENABLE_OVERLOADING)
    ProxyGetInterfaceTypeMethodInfo         ,
#endif
    proxyGetInterfaceType                   ,


-- ** getPwProxy #method:getPwProxy#

#if defined(ENABLE_OVERLOADING)
    ProxyGetPwProxyMethodInfo               ,
#endif
    proxyGetPwProxy                         ,


-- ** setPwProxy #method:setPwProxy#

#if defined(ENABLE_OVERLOADING)
    ProxySetPwProxyMethodInfo               ,
#endif
    proxySetPwProxy                         ,




 -- * Properties


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

#if defined(ENABLE_OVERLOADING)
    ProxyBoundIdPropertyInfo                ,
#endif
    getProxyBoundId                         ,
#if defined(ENABLE_OVERLOADING)
    proxyBoundId                            ,
#endif


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

#if defined(ENABLE_OVERLOADING)
    ProxyPwProxyPropertyInfo                ,
#endif
    getProxyPwProxy                         ,
#if defined(ENABLE_OVERLOADING)
    proxyPwProxy                            ,
#endif




 -- * Signals


-- ** bound #signal:bound#

    ProxyBoundCallback                      ,
#if defined(ENABLE_OVERLOADING)
    ProxyBoundSignalInfo                    ,
#endif
    afterProxyBound                         ,
    onProxyBound                            ,


-- ** error #signal:error#

    ProxyErrorCallback                      ,
#if defined(ENABLE_OVERLOADING)
    ProxyErrorSignalInfo                    ,
#endif
    afterProxyError                         ,
    onProxyError                            ,


-- ** pwProxyCreated #signal:pwProxyCreated#

    ProxyPwProxyCreatedCallback             ,
#if defined(ENABLE_OVERLOADING)
    ProxyPwProxyCreatedSignalInfo           ,
#endif
    afterProxyPwProxyCreated                ,
    onProxyPwProxyCreated                   ,


-- ** pwProxyDestroyed #signal:pwProxyDestroyed#

    ProxyPwProxyDestroyedCallback           ,
#if defined(ENABLE_OVERLOADING)
    ProxyPwProxyDestroyedSignalInfo         ,
#endif
    afterProxyPwProxyDestroyed              ,
    onProxyPwProxyDestroyed                 ,




    ) 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.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.Object as Wp.Object

#endif

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

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

foreign import ccall "wp_proxy_get_type"
    c_wp_proxy_get_type :: IO B.Types.GType

instance B.Types.TypedObject Proxy where
    glibType = c_wp_proxy_get_type

instance B.Types.GObject Proxy

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

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

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

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

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

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

#endif

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

#endif

-- signal Proxy::bound
-- | /No description available in the introspection data./
type ProxyBoundCallback =
    Word32
    -> IO ()

type C_ProxyBoundCallback =
    Ptr Proxy ->                            -- object
    Word32 ->
    Ptr () ->                               -- user_data
    IO ()

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

wrap_ProxyBoundCallback :: 
    GObject a => (a -> ProxyBoundCallback) ->
    C_ProxyBoundCallback
wrap_ProxyBoundCallback 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 [bound](#signal:bound) 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' proxy #bound callback
-- @
-- 
-- 
onProxyBound :: (IsProxy a, MonadIO m) => a -> ((?self :: a) => ProxyBoundCallback) -> m SignalHandlerId
onProxyBound obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_ProxyBoundCallback wrapped
    wrapped'' <- mk_ProxyBoundCallback wrapped'
    connectSignalFunPtr obj "bound" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [bound](#signal:bound) 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' proxy #bound 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.
-- 
afterProxyBound :: (IsProxy a, MonadIO m) => a -> ((?self :: a) => ProxyBoundCallback) -> m SignalHandlerId
afterProxyBound obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_ProxyBoundCallback wrapped
    wrapped'' <- mk_ProxyBoundCallback wrapped'
    connectSignalFunPtr obj "bound" wrapped'' SignalConnectAfter Nothing


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

#endif

-- signal Proxy::error
-- | /No description available in the introspection data./
type ProxyErrorCallback =
    Int32
    -> Int32
    -> T.Text
    -> IO ()

type C_ProxyErrorCallback =
    Ptr Proxy ->                            -- object
    Int32 ->
    Int32 ->
    CString ->
    Ptr () ->                               -- user_data
    IO ()

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

wrap_ProxyErrorCallback :: 
    GObject a => (a -> ProxyErrorCallback) ->
    C_ProxyErrorCallback
wrap_ProxyErrorCallback gi'cb gi'selfPtr object p0 p1 _ = do
    p1' <- cstringToText p1
    B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self)  object p0 p1'


-- | Connect a signal handler for the [error](#signal:error) 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' proxy #error callback
-- @
-- 
-- 
onProxyError :: (IsProxy a, MonadIO m) => a -> ((?self :: a) => ProxyErrorCallback) -> m SignalHandlerId
onProxyError obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_ProxyErrorCallback wrapped
    wrapped'' <- mk_ProxyErrorCallback wrapped'
    connectSignalFunPtr obj "error" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [error](#signal:error) 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' proxy #error 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.
-- 
afterProxyError :: (IsProxy a, MonadIO m) => a -> ((?self :: a) => ProxyErrorCallback) -> m SignalHandlerId
afterProxyError obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_ProxyErrorCallback wrapped
    wrapped'' <- mk_ProxyErrorCallback wrapped'
    connectSignalFunPtr obj "error" wrapped'' SignalConnectAfter Nothing


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

#endif

-- signal Proxy::pw-proxy-created
-- | /No description available in the introspection data./
type ProxyPwProxyCreatedCallback =
    Ptr ()
    -> IO ()

type C_ProxyPwProxyCreatedCallback =
    Ptr Proxy ->                            -- object
    Ptr () ->
    Ptr () ->                               -- user_data
    IO ()

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

wrap_ProxyPwProxyCreatedCallback :: 
    GObject a => (a -> ProxyPwProxyCreatedCallback) ->
    C_ProxyPwProxyCreatedCallback
wrap_ProxyPwProxyCreatedCallback 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 [pwProxyCreated](#signal:pwProxyCreated) 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' proxy #pwProxyCreated callback
-- @
-- 
-- 
onProxyPwProxyCreated :: (IsProxy a, MonadIO m) => a -> ((?self :: a) => ProxyPwProxyCreatedCallback) -> m SignalHandlerId
onProxyPwProxyCreated obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_ProxyPwProxyCreatedCallback wrapped
    wrapped'' <- mk_ProxyPwProxyCreatedCallback wrapped'
    connectSignalFunPtr obj "pw-proxy-created" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [pwProxyCreated](#signal:pwProxyCreated) 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' proxy #pwProxyCreated 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.
-- 
afterProxyPwProxyCreated :: (IsProxy a, MonadIO m) => a -> ((?self :: a) => ProxyPwProxyCreatedCallback) -> m SignalHandlerId
afterProxyPwProxyCreated obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_ProxyPwProxyCreatedCallback wrapped
    wrapped'' <- mk_ProxyPwProxyCreatedCallback wrapped'
    connectSignalFunPtr obj "pw-proxy-created" wrapped'' SignalConnectAfter Nothing


#if defined(ENABLE_OVERLOADING)
data ProxyPwProxyCreatedSignalInfo
instance SignalInfo ProxyPwProxyCreatedSignalInfo where
    type HaskellCallbackType ProxyPwProxyCreatedSignalInfo = ProxyPwProxyCreatedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_ProxyPwProxyCreatedCallback cb
        cb'' <- mk_ProxyPwProxyCreatedCallback cb'
        connectSignalFunPtr obj "pw-proxy-created" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Proxy::pw-proxy-created"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Proxy.html#g:signal:pwProxyCreated"})

#endif

-- signal Proxy::pw-proxy-destroyed
-- | /No description available in the introspection data./
type ProxyPwProxyDestroyedCallback =
    IO ()

type C_ProxyPwProxyDestroyedCallback =
    Ptr Proxy ->                            -- object
    Ptr () ->                               -- user_data
    IO ()

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

wrap_ProxyPwProxyDestroyedCallback :: 
    GObject a => (a -> ProxyPwProxyDestroyedCallback) ->
    C_ProxyPwProxyDestroyedCallback
wrap_ProxyPwProxyDestroyedCallback gi'cb gi'selfPtr _ = do
    B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self) 


-- | Connect a signal handler for the [pwProxyDestroyed](#signal:pwProxyDestroyed) 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' proxy #pwProxyDestroyed callback
-- @
-- 
-- 
onProxyPwProxyDestroyed :: (IsProxy a, MonadIO m) => a -> ((?self :: a) => ProxyPwProxyDestroyedCallback) -> m SignalHandlerId
onProxyPwProxyDestroyed obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_ProxyPwProxyDestroyedCallback wrapped
    wrapped'' <- mk_ProxyPwProxyDestroyedCallback wrapped'
    connectSignalFunPtr obj "pw-proxy-destroyed" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [pwProxyDestroyed](#signal:pwProxyDestroyed) 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' proxy #pwProxyDestroyed 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.
-- 
afterProxyPwProxyDestroyed :: (IsProxy a, MonadIO m) => a -> ((?self :: a) => ProxyPwProxyDestroyedCallback) -> m SignalHandlerId
afterProxyPwProxyDestroyed obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_ProxyPwProxyDestroyedCallback wrapped
    wrapped'' <- mk_ProxyPwProxyDestroyedCallback wrapped'
    connectSignalFunPtr obj "pw-proxy-destroyed" wrapped'' SignalConnectAfter Nothing


#if defined(ENABLE_OVERLOADING)
data ProxyPwProxyDestroyedSignalInfo
instance SignalInfo ProxyPwProxyDestroyedSignalInfo where
    type HaskellCallbackType ProxyPwProxyDestroyedSignalInfo = ProxyPwProxyDestroyedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_ProxyPwProxyDestroyedCallback cb
        cb'' <- mk_ProxyPwProxyDestroyedCallback cb'
        connectSignalFunPtr obj "pw-proxy-destroyed" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Proxy::pw-proxy-destroyed"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Proxy.html#g:signal:pwProxyDestroyed"})

#endif

-- VVV Prop "bound-id"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@bound-id@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' proxy #boundId
-- @
getProxyBoundId :: (MonadIO m, IsProxy o) => o -> m Word32
getProxyBoundId obj = MIO.liftIO $ B.Properties.getObjectPropertyUInt32 obj "bound-id"

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

-- VVV Prop "pw-proxy"
   -- Type: TBasicType TPtr
   -- Flags: [PropertyReadable]
   -- Nullable: (Just True,Just True)

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

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

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

#if defined(ENABLE_OVERLOADING)
proxyBoundId :: AttrLabelProxy "boundId"
proxyBoundId = AttrLabelProxy

proxyPwProxy :: AttrLabelProxy "pwProxy"
proxyPwProxy = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Proxy = ProxySignalList
type ProxySignalList = ('[ '("bound", ProxyBoundSignalInfo), '("error", ProxyErrorSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("pwProxyCreated", ProxyPwProxyCreatedSignalInfo), '("pwProxyDestroyed", ProxyPwProxyDestroyedSignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method Proxy::get_bound_id
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Wp" , name = "Proxy" }
--           , argCType = Just "WpProxy*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the proxy" , 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_proxy_get_bound_id" wp_proxy_get_bound_id :: 
    Ptr Proxy ->                            -- self : TInterface (Name {namespace = "Wp", name = "Proxy"})
    IO Word32

-- | Returns the proxy bound id.
-- 
-- 
-- The bound id is the id that this object has on the PipeWire registry (a.k.a. the global id). The object must have the WP_PROXY_FEATURE_BOUND feature before this method can be called.
-- Requires WP_PROXY_FEATURE_BOUND
proxyGetBoundId ::
    (B.CallStack.HasCallStack, MonadIO m, IsProxy a) =>
    a
    -- ^ /@self@/: the proxy
    -> m Word32
    -- ^ __Returns:__ the bound id of this object
proxyGetBoundId self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_proxy_get_bound_id self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data ProxyGetBoundIdMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsProxy a) => O.OverloadedMethod ProxyGetBoundIdMethodInfo a signature where
    overloadedMethod = proxyGetBoundId

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


#endif

-- method Proxy::get_interface_type
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Wp" , name = "Proxy" }
--           , argCType = Just "WpProxy*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the proxy" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "version"
--           , argType = TBasicType TUInt32
--           , argCType = Just "guint32*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the version of the interface"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "wp_proxy_get_interface_type" wp_proxy_get_interface_type :: 
    Ptr Proxy ->                            -- self : TInterface (Name {namespace = "Wp", name = "Proxy"})
    Ptr Word32 ->                           -- version : TBasicType TUInt32
    IO CString

-- | Gets the interface type of the proxied object.
proxyGetInterfaceType ::
    (B.CallStack.HasCallStack, MonadIO m, IsProxy a) =>
    a
    -- ^ /@self@/: the proxy
    -> m ((T.Text, Word32))
    -- ^ __Returns:__ the PipeWire type of the interface that is being proxied
proxyGetInterfaceType self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    version <- allocMem :: IO (Ptr Word32)
    result <- wp_proxy_get_interface_type self' version
    checkUnexpectedReturnNULL "proxyGetInterfaceType" result
    result' <- cstringToText result
    version' <- peek version
    touchManagedPtr self
    freeMem version
    return (result', version')

#if defined(ENABLE_OVERLOADING)
data ProxyGetInterfaceTypeMethodInfo
instance (signature ~ (m ((T.Text, Word32))), MonadIO m, IsProxy a) => O.OverloadedMethod ProxyGetInterfaceTypeMethodInfo a signature where
    overloadedMethod = proxyGetInterfaceType

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


#endif

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

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

-- | Gets the pw_proxy wrapped by this proxy object.
proxyGetPwProxy ::
    (B.CallStack.HasCallStack, MonadIO m, IsProxy a) =>
    a
    -- ^ /@self@/: the proxy
    -> m (Ptr ())
    -- ^ __Returns:__ a pointer to the underlying pw_proxy object
proxyGetPwProxy self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_proxy_get_pw_proxy self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data ProxyGetPwProxyMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m, IsProxy a) => O.OverloadedMethod ProxyGetPwProxyMethodInfo a signature where
    overloadedMethod = proxyGetPwProxy

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


#endif

-- method Proxy::set_pw_proxy
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Wp" , name = "Proxy" }
--           , argCType = Just "WpProxy*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "proxy"
--           , argType = TBasicType TPtr
--           , argCType = Just "pw_proxy*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , 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_proxy_set_pw_proxy" wp_proxy_set_pw_proxy :: 
    Ptr Proxy ->                            -- self : TInterface (Name {namespace = "Wp", name = "Proxy"})
    Ptr () ->                               -- proxy : TBasicType TPtr
    IO ()

-- | Private method to be used by subclasses to set the pw_proxy pointer when it is available.
-- 
-- 
-- This can be called only if there is no pw_proxy already set. Takes ownership of /@proxy@/.
-- If the proxy belongs to the client context (see @/wp_proxy_set_client_context()/@), this must be called with the client context locked, in the same locked section that created /@proxy@/, so that no event can be missed in between.
proxySetPwProxy ::
    (B.CallStack.HasCallStack, MonadIO m, IsProxy a) =>
    a
    -> Ptr ()
    -> m ()
proxySetPwProxy self proxy = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    wp_proxy_set_pw_proxy self' proxy
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data ProxySetPwProxyMethodInfo
instance (signature ~ (Ptr () -> m ()), MonadIO m, IsProxy a) => O.OverloadedMethod ProxySetPwProxyMethodInfo a signature where
    overloadedMethod = proxySetPwProxy

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


#endif


