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


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The WpNode class allows accessing the properties and methods of a PipeWire node object (struct pw_node).
-- A WpNode is constructed internally when a new node appears on the PipeWire registry and it is made available through the WpObjectManager API. Alternatively, a WpNode can also be constructed using 'GI.Wp.Objects.Node.nodeNewFromFactory', which creates a new node object on the remote PipeWire server by calling into a factory.

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

module GI.Wp.Objects.Node
    ( 

-- * Exported types
    Node(..)                                ,
    IsNode                                  ,
    toNode                                  ,


 -- * 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"), [bind]("GI.Wp.Objects.GlobalProxy#g:method:bind"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [deactivate]("GI.Wp.Objects.Object#g:method:deactivate"), [enumParams]("GI.Wp.Interfaces.PipewireObject#g:method:enumParams"), [enumParamsFinish]("GI.Wp.Interfaces.PipewireObject#g:method:enumParamsFinish"), [enumParamsSync]("GI.Wp.Interfaces.PipewireObject#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"), [lookupPortFull]("GI.Wp.Objects.Node#g:method:lookupPortFull"), [newPortsFilteredIteratorFull]("GI.Wp.Objects.Node#g:method:newPortsFilteredIteratorFull"), [newPortsIterator]("GI.Wp.Objects.Node#g:method:newPortsIterator"), [newPropertiesIterator]("GI.Wp.Interfaces.PipewireObject#g:method:newPropertiesIterator"), [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"), [requestDestroy]("GI.Wp.Objects.GlobalProxy#g:method:requestDestroy"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [sendCommand]("GI.Wp.Objects.Node#g:method:sendCommand"), [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"), [getGlobalProperties]("GI.Wp.Objects.GlobalProxy#g:method:getGlobalProperties"), [getId]("GI.Wp.Objects.Object#g:method:getId"), [getInterfaceType]("GI.Wp.Objects.Proxy#g:method:getInterfaceType"), [getNInputPorts]("GI.Wp.Objects.Node#g:method:getNInputPorts"), [getNOutputPorts]("GI.Wp.Objects.Node#g:method:getNOutputPorts"), [getNPorts]("GI.Wp.Objects.Node#g:method:getNPorts"), [getNativeInfo]("GI.Wp.Interfaces.PipewireObject#g:method:getNativeInfo"), [getParamInfo]("GI.Wp.Interfaces.PipewireObject#g:method:getParamInfo"), [getPermissions]("GI.Wp.Objects.GlobalProxy#g:method:getPermissions"), [getProperties]("GI.Wp.Interfaces.PipewireObject#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"), [getState]("GI.Wp.Objects.Node#g:method:getState"), [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"), [setParam]("GI.Wp.Interfaces.PipewireObject#g:method:setParam"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setPwProxy]("GI.Wp.Objects.Proxy#g:method:setPwProxy").

#if defined(ENABLE_OVERLOADING)
    ResolveNodeMethod                       ,
#endif

-- ** getNInputPorts #method:getNInputPorts#

#if defined(ENABLE_OVERLOADING)
    NodeGetNInputPortsMethodInfo            ,
#endif
    nodeGetNInputPorts                      ,


-- ** getNOutputPorts #method:getNOutputPorts#

#if defined(ENABLE_OVERLOADING)
    NodeGetNOutputPortsMethodInfo           ,
#endif
    nodeGetNOutputPorts                     ,


-- ** getNPorts #method:getNPorts#

#if defined(ENABLE_OVERLOADING)
    NodeGetNPortsMethodInfo                 ,
#endif
    nodeGetNPorts                           ,


-- ** getState #method:getState#

#if defined(ENABLE_OVERLOADING)
    NodeGetStateMethodInfo                  ,
#endif
    nodeGetState                            ,


-- ** lookupPortFull #method:lookupPortFull#

#if defined(ENABLE_OVERLOADING)
    NodeLookupPortFullMethodInfo            ,
#endif
    nodeLookupPortFull                      ,


-- ** newFromFactory #method:newFromFactory#

    nodeNewFromFactory                      ,


-- ** newPortsFilteredIteratorFull #method:newPortsFilteredIteratorFull#

#if defined(ENABLE_OVERLOADING)
    NodeNewPortsFilteredIteratorFullMethodInfo,
#endif
    nodeNewPortsFilteredIteratorFull        ,


-- ** newPortsIterator #method:newPortsIterator#

#if defined(ENABLE_OVERLOADING)
    NodeNewPortsIteratorMethodInfo          ,
#endif
    nodeNewPortsIterator                    ,


-- ** sendCommand #method:sendCommand#

#if defined(ENABLE_OVERLOADING)
    NodeSendCommandMethodInfo               ,
#endif
    nodeSendCommand                         ,




 -- * Properties


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

#if defined(ENABLE_OVERLOADING)
    NodeMaxInputPortsPropertyInfo           ,
#endif
    getNodeMaxInputPorts                    ,
#if defined(ENABLE_OVERLOADING)
    nodeMaxInputPorts                       ,
#endif


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

#if defined(ENABLE_OVERLOADING)
    NodeMaxOutputPortsPropertyInfo          ,
#endif
    getNodeMaxOutputPorts                   ,
#if defined(ENABLE_OVERLOADING)
    nodeMaxOutputPorts                      ,
#endif


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

#if defined(ENABLE_OVERLOADING)
    NodeNInputPortsPropertyInfo             ,
#endif
    getNodeNInputPorts                      ,
#if defined(ENABLE_OVERLOADING)
    nodeNInputPorts                         ,
#endif


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

#if defined(ENABLE_OVERLOADING)
    NodeNOutputPortsPropertyInfo            ,
#endif
    getNodeNOutputPorts                     ,
#if defined(ENABLE_OVERLOADING)
    nodeNOutputPorts                        ,
#endif


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

#if defined(ENABLE_OVERLOADING)
    NodeStatePropertyInfo                   ,
#endif
    getNodeState                            ,
#if defined(ENABLE_OVERLOADING)
    nodeState                               ,
#endif




 -- * Signals


-- ** portsChanged #signal:portsChanged#

    NodePortsChangedCallback                ,
#if defined(ENABLE_OVERLOADING)
    NodePortsChangedSignalInfo              ,
#endif
    afterNodePortsChanged                   ,
    onNodePortsChanged                      ,


-- ** stateChanged #signal:stateChanged#

    NodeStateChangedCallback                ,
#if defined(ENABLE_OVERLOADING)
    NodeStateChangedSignalInfo              ,
#endif
    afterNodeStateChanged                   ,
    onNodeStateChanged                      ,




    ) 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.Interfaces.PipewireObject as Wp.PipewireObject
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.GlobalProxy as Wp.GlobalProxy
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.Port as Wp.Port
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.Enums as Wp.Enums
import {-# SOURCE #-} qualified GI.Wp.Interfaces.PipewireObject as Wp.PipewireObject
import {-# SOURCE #-} qualified GI.Wp.Objects.Core as Wp.Core
import {-# SOURCE #-} qualified GI.Wp.Objects.GlobalProxy as Wp.GlobalProxy
import {-# SOURCE #-} qualified GI.Wp.Objects.Object as Wp.Object
import {-# SOURCE #-} qualified GI.Wp.Objects.Port as Wp.Port
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.ObjectInterest as Wp.ObjectInterest
import {-# SOURCE #-} qualified GI.Wp.Structs.Properties as Wp.Properties

#endif

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

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

foreign import ccall "wp_node_get_type"
    c_wp_node_get_type :: IO B.Types.GType

instance B.Types.TypedObject Node where
    glibType = c_wp_node_get_type

instance B.Types.GObject Node

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

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

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

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

#if defined(ENABLE_OVERLOADING)
type family ResolveNodeMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveNodeMethod "abortActivation" o = Wp.Object.ObjectAbortActivationMethodInfo
    ResolveNodeMethod "activate" o = Wp.Object.ObjectActivateMethodInfo
    ResolveNodeMethod "activateClosure" o = Wp.Object.ObjectActivateClosureMethodInfo
    ResolveNodeMethod "activateFinish" o = Wp.Object.ObjectActivateFinishMethodInfo
    ResolveNodeMethod "bind" o = Wp.GlobalProxy.GlobalProxyBindMethodInfo
    ResolveNodeMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveNodeMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveNodeMethod "deactivate" o = Wp.Object.ObjectDeactivateMethodInfo
    ResolveNodeMethod "enumParams" o = Wp.PipewireObject.PipewireObjectEnumParamsMethodInfo
    ResolveNodeMethod "enumParamsFinish" o = Wp.PipewireObject.PipewireObjectEnumParamsFinishMethodInfo
    ResolveNodeMethod "enumParamsSync" o = Wp.PipewireObject.PipewireObjectEnumParamsSyncMethodInfo
    ResolveNodeMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveNodeMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveNodeMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveNodeMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveNodeMethod "lookupPortFull" o = NodeLookupPortFullMethodInfo
    ResolveNodeMethod "newPortsFilteredIteratorFull" o = NodeNewPortsFilteredIteratorFullMethodInfo
    ResolveNodeMethod "newPortsIterator" o = NodeNewPortsIteratorMethodInfo
    ResolveNodeMethod "newPropertiesIterator" o = Wp.PipewireObject.PipewireObjectNewPropertiesIteratorMethodInfo
    ResolveNodeMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveNodeMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveNodeMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveNodeMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveNodeMethod "requestDestroy" o = Wp.GlobalProxy.GlobalProxyRequestDestroyMethodInfo
    ResolveNodeMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveNodeMethod "sendCommand" o = NodeSendCommandMethodInfo
    ResolveNodeMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveNodeMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveNodeMethod "testActiveFeatures" o = Wp.Object.ObjectTestActiveFeaturesMethodInfo
    ResolveNodeMethod "testSupportedFeatures" o = Wp.Object.ObjectTestSupportedFeaturesMethodInfo
    ResolveNodeMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveNodeMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveNodeMethod "updateFeatures" o = Wp.Object.ObjectUpdateFeaturesMethodInfo
    ResolveNodeMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveNodeMethod "getActiveFeatures" o = Wp.Object.ObjectGetActiveFeaturesMethodInfo
    ResolveNodeMethod "getBoundId" o = Wp.Proxy.ProxyGetBoundIdMethodInfo
    ResolveNodeMethod "getCore" o = Wp.Object.ObjectGetCoreMethodInfo
    ResolveNodeMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveNodeMethod "getGlobalProperties" o = Wp.GlobalProxy.GlobalProxyGetGlobalPropertiesMethodInfo
    ResolveNodeMethod "getId" o = Wp.Object.ObjectGetIdMethodInfo
    ResolveNodeMethod "getInterfaceType" o = Wp.Proxy.ProxyGetInterfaceTypeMethodInfo
    ResolveNodeMethod "getNInputPorts" o = NodeGetNInputPortsMethodInfo
    ResolveNodeMethod "getNOutputPorts" o = NodeGetNOutputPortsMethodInfo
    ResolveNodeMethod "getNPorts" o = NodeGetNPortsMethodInfo
    ResolveNodeMethod "getNativeInfo" o = Wp.PipewireObject.PipewireObjectGetNativeInfoMethodInfo
    ResolveNodeMethod "getParamInfo" o = Wp.PipewireObject.PipewireObjectGetParamInfoMethodInfo
    ResolveNodeMethod "getPermissions" o = Wp.GlobalProxy.GlobalProxyGetPermissionsMethodInfo
    ResolveNodeMethod "getProperties" o = Wp.PipewireObject.PipewireObjectGetPropertiesMethodInfo
    ResolveNodeMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveNodeMethod "getPwProxy" o = Wp.Proxy.ProxyGetPwProxyMethodInfo
    ResolveNodeMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveNodeMethod "getState" o = NodeGetStateMethodInfo
    ResolveNodeMethod "getSupportedFeatures" o = Wp.Object.ObjectGetSupportedFeaturesMethodInfo
    ResolveNodeMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveNodeMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveNodeMethod "setParam" o = Wp.PipewireObject.PipewireObjectSetParamMethodInfo
    ResolveNodeMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveNodeMethod "setPwProxy" o = Wp.Proxy.ProxySetPwProxyMethodInfo
    ResolveNodeMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#endif

-- signal Node::ports-changed
-- | /No description available in the introspection data./
type NodePortsChangedCallback =
    IO ()

type C_NodePortsChangedCallback =
    Ptr Node ->                             -- object
    Ptr () ->                               -- user_data
    IO ()

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

wrap_NodePortsChangedCallback :: 
    GObject a => (a -> NodePortsChangedCallback) ->
    C_NodePortsChangedCallback
wrap_NodePortsChangedCallback gi'cb gi'selfPtr _ = do
    B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self) 


-- | Connect a signal handler for the [portsChanged](#signal:portsChanged) 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' node #portsChanged callback
-- @
-- 
-- 
onNodePortsChanged :: (IsNode a, MonadIO m) => a -> ((?self :: a) => NodePortsChangedCallback) -> m SignalHandlerId
onNodePortsChanged obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_NodePortsChangedCallback wrapped
    wrapped'' <- mk_NodePortsChangedCallback wrapped'
    connectSignalFunPtr obj "ports-changed" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [portsChanged](#signal:portsChanged) 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' node #portsChanged 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.
-- 
afterNodePortsChanged :: (IsNode a, MonadIO m) => a -> ((?self :: a) => NodePortsChangedCallback) -> m SignalHandlerId
afterNodePortsChanged obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_NodePortsChangedCallback wrapped
    wrapped'' <- mk_NodePortsChangedCallback wrapped'
    connectSignalFunPtr obj "ports-changed" wrapped'' SignalConnectAfter Nothing


#if defined(ENABLE_OVERLOADING)
data NodePortsChangedSignalInfo
instance SignalInfo NodePortsChangedSignalInfo where
    type HaskellCallbackType NodePortsChangedSignalInfo = NodePortsChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_NodePortsChangedCallback cb
        cb'' <- mk_NodePortsChangedCallback cb'
        connectSignalFunPtr obj "ports-changed" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Node::ports-changed"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Node.html#g:signal:portsChanged"})

#endif

-- signal Node::state-changed
-- | /No description available in the introspection data./
type NodeStateChangedCallback =
    Wp.Enums.NodeState
    -> Wp.Enums.NodeState
    -> IO ()

type C_NodeStateChangedCallback =
    Ptr Node ->                             -- object
    CInt ->
    CInt ->
    Ptr () ->                               -- user_data
    IO ()

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

wrap_NodeStateChangedCallback :: 
    GObject a => (a -> NodeStateChangedCallback) ->
    C_NodeStateChangedCallback
wrap_NodeStateChangedCallback gi'cb gi'selfPtr object p0 _ = do
    let object' = (toEnum . fromIntegral) object
    let p0' = (toEnum . fromIntegral) p0
    B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self)  object' p0'


-- | Connect a signal handler for the [stateChanged](#signal:stateChanged) 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' node #stateChanged callback
-- @
-- 
-- 
onNodeStateChanged :: (IsNode a, MonadIO m) => a -> ((?self :: a) => NodeStateChangedCallback) -> m SignalHandlerId
onNodeStateChanged obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_NodeStateChangedCallback wrapped
    wrapped'' <- mk_NodeStateChangedCallback wrapped'
    connectSignalFunPtr obj "state-changed" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [stateChanged](#signal:stateChanged) 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' node #stateChanged 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.
-- 
afterNodeStateChanged :: (IsNode a, MonadIO m) => a -> ((?self :: a) => NodeStateChangedCallback) -> m SignalHandlerId
afterNodeStateChanged obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_NodeStateChangedCallback wrapped
    wrapped'' <- mk_NodeStateChangedCallback wrapped'
    connectSignalFunPtr obj "state-changed" wrapped'' SignalConnectAfter Nothing


#if defined(ENABLE_OVERLOADING)
data NodeStateChangedSignalInfo
instance SignalInfo NodeStateChangedSignalInfo where
    type HaskellCallbackType NodeStateChangedSignalInfo = NodeStateChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_NodeStateChangedCallback cb
        cb'' <- mk_NodeStateChangedCallback cb'
        connectSignalFunPtr obj "state-changed" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Node::state-changed"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Node.html#g:signal:stateChanged"})

#endif

-- VVV Prop "max-input-ports"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

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

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

-- VVV Prop "max-output-ports"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

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

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

-- VVV Prop "n-input-ports"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

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

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

-- VVV Prop "n-output-ports"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

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

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

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

-- | Get the value of the “@state@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' node #state
-- @
getNodeState :: (MonadIO m, IsNode o) => o -> m Wp.Enums.NodeState
getNodeState obj = MIO.liftIO $ B.Properties.getObjectPropertyEnum obj "state"

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

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Node
type instance O.AttributeList Node = NodeAttributeList
type NodeAttributeList = ('[ '("activeFeatures", Wp.Object.ObjectActiveFeaturesPropertyInfo), '("boundId", Wp.Proxy.ProxyBoundIdPropertyInfo), '("core", Wp.Object.ObjectCorePropertyInfo), '("factoryName", Wp.GlobalProxy.GlobalProxyFactoryNamePropertyInfo), '("globalProperties", Wp.GlobalProxy.GlobalProxyGlobalPropertiesPropertyInfo), '("id", Wp.Object.ObjectIdPropertyInfo), '("maxInputPorts", NodeMaxInputPortsPropertyInfo), '("maxOutputPorts", NodeMaxOutputPortsPropertyInfo), '("nInputPorts", NodeNInputPortsPropertyInfo), '("nOutputPorts", NodeNOutputPortsPropertyInfo), '("nativeInfo", Wp.PipewireObject.PipewireObjectNativeInfoPropertyInfo), '("paramInfo", Wp.PipewireObject.PipewireObjectParamInfoPropertyInfo), '("permissions", Wp.GlobalProxy.GlobalProxyPermissionsPropertyInfo), '("properties", Wp.PipewireObject.PipewireObjectPropertiesPropertyInfo), '("pwProxy", Wp.Proxy.ProxyPwProxyPropertyInfo), '("state", NodeStatePropertyInfo), '("supportedFeatures", Wp.Object.ObjectSupportedFeaturesPropertyInfo)] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
nodeMaxInputPorts :: AttrLabelProxy "maxInputPorts"
nodeMaxInputPorts = AttrLabelProxy

nodeMaxOutputPorts :: AttrLabelProxy "maxOutputPorts"
nodeMaxOutputPorts = AttrLabelProxy

nodeNInputPorts :: AttrLabelProxy "nInputPorts"
nodeNInputPorts = AttrLabelProxy

nodeNOutputPorts :: AttrLabelProxy "nOutputPorts"
nodeNOutputPorts = AttrLabelProxy

nodeState :: AttrLabelProxy "state"
nodeState = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Node = NodeSignalList
type NodeSignalList = ('[ '("bound", Wp.Proxy.ProxyBoundSignalInfo), '("error", Wp.Proxy.ProxyErrorSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("paramsChanged", Wp.PipewireObject.PipewireObjectParamsChangedSignalInfo), '("portsChanged", NodePortsChangedSignalInfo), '("pwProxyCreated", Wp.Proxy.ProxyPwProxyCreatedSignalInfo), '("pwProxyDestroyed", Wp.Proxy.ProxyPwProxyDestroyedSignalInfo), '("stateChanged", NodeStateChangedSignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method Node::new_from_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 pipewire factory name to construct the node"
--                 , 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 "the properties to pass to the factory"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Node" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_node_new_from_factory" wp_node_new_from_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 Node)

-- | Constructs a node on the PipeWire server by asking the remote factory /@factoryName@/ to create it.
-- 
-- 
-- Because of the nature of the PipeWire protocol, this operation completes asynchronously at some point in the future. In order to find out when this is done, you should call 'GI.Wp.Objects.Object.objectActivate', requesting at least WP_PROXY_FEATURE_BOUND. When this feature is ready, the node is ready for use on the server. If the node cannot be created, this activation operation will fail.
nodeNewFromFactory ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.Core.IsCore a) =>
    a
    -- ^ /@core@/: the wireplumber core
    -> T.Text
    -- ^ /@factoryName@/: the pipewire factory name to construct the node
    -> Maybe (Wp.Properties.Properties)
    -- ^ /@properties@/: the properties to pass to the factory
    -> m (Maybe Node)
    -- ^ __Returns:__ the new node or NULL if the core is not connected and therefore the node cannot be created
nodeNewFromFactory 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_node_new_from_factory core' factoryName' maybeProperties
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Node) result'
        return result''
    touchManagedPtr core
    whenJust properties touchManagedPtr
    freeMem factoryName'
    return maybeResult

#if defined(ENABLE_OVERLOADING)
#endif

-- method Node::get_n_input_ports
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Wp" , name = "Node" }
--           , argCType = Just "WpNode*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the node" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "max"
--           , argType = TBasicType TUInt
--           , argCType = Just "guint*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the maximum supported number of input ports"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "wp_node_get_n_input_ports" wp_node_get_n_input_ports :: 
    Ptr Node ->                             -- self : TInterface (Name {namespace = "Wp", name = "Node"})
    Ptr Word32 ->                           -- max : TBasicType TUInt
    IO Word32

-- | Gets the number of input ports of this node.
-- 
-- 
-- Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO
nodeGetNInputPorts ::
    (B.CallStack.HasCallStack, MonadIO m, IsNode a) =>
    a
    -- ^ /@self@/: the node
    -> m ((Word32, Word32))
    -- ^ __Returns:__ the number of input ports of this node, as reported by the node info
nodeGetNInputPorts self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    max <- allocMem :: IO (Ptr Word32)
    result <- wp_node_get_n_input_ports self' max
    max' <- peek max
    touchManagedPtr self
    freeMem max
    return (result, max')

#if defined(ENABLE_OVERLOADING)
data NodeGetNInputPortsMethodInfo
instance (signature ~ (m ((Word32, Word32))), MonadIO m, IsNode a) => O.OverloadedMethod NodeGetNInputPortsMethodInfo a signature where
    overloadedMethod = nodeGetNInputPorts

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


#endif

-- method Node::get_n_output_ports
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Wp" , name = "Node" }
--           , argCType = Just "WpNode*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the node" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "max"
--           , argType = TBasicType TUInt
--           , argCType = Just "guint*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the maximum supported number of output ports"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "wp_node_get_n_output_ports" wp_node_get_n_output_ports :: 
    Ptr Node ->                             -- self : TInterface (Name {namespace = "Wp", name = "Node"})
    Ptr Word32 ->                           -- max : TBasicType TUInt
    IO Word32

-- | Gets the number of output ports of this node.
-- 
-- 
-- Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO
nodeGetNOutputPorts ::
    (B.CallStack.HasCallStack, MonadIO m, IsNode a) =>
    a
    -- ^ /@self@/: the node
    -> m ((Word32, Word32))
    -- ^ __Returns:__ the number of output ports of this node, as reported by the node info
nodeGetNOutputPorts self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    max <- allocMem :: IO (Ptr Word32)
    result <- wp_node_get_n_output_ports self' max
    max' <- peek max
    touchManagedPtr self
    freeMem max
    return (result, max')

#if defined(ENABLE_OVERLOADING)
data NodeGetNOutputPortsMethodInfo
instance (signature ~ (m ((Word32, Word32))), MonadIO m, IsNode a) => O.OverloadedMethod NodeGetNOutputPortsMethodInfo a signature where
    overloadedMethod = nodeGetNOutputPorts

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


#endif

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

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

-- | Gets the number of ports of this node.
-- 
-- 
-- Note that this number may not add up to 'GI.Wp.Objects.Node.nodeGetNInputPorts' + 'GI.Wp.Objects.Node.nodeGetNOutputPorts' because it is discovered by looking at the number of available ports in the registry, however ports may appear there with a delay or may not appear at all if this client does not have permission to read them
-- Requires WP_NODE_FEATURE_PORTS
nodeGetNPorts ::
    (B.CallStack.HasCallStack, MonadIO m, IsNode a) =>
    a
    -- ^ /@self@/: the node
    -> m Word32
    -- ^ __Returns:__ the number of ports of this node.
nodeGetNPorts self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_node_get_n_ports self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data NodeGetNPortsMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsNode a) => O.OverloadedMethod NodeGetNPortsMethodInfo a signature where
    overloadedMethod = nodeGetNPorts

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


#endif

-- method Node::get_state
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Wp" , name = "Node" }
--           , argCType = Just "WpNode*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the node" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "error"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar**"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the error" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "NodeState" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_node_get_state" wp_node_get_state :: 
    Ptr Node ->                             -- self : TInterface (Name {namespace = "Wp", name = "Node"})
    Ptr CString ->                          -- error : TBasicType TUTF8
    IO CInt

-- | Gets the current state of the node.
nodeGetState ::
    (B.CallStack.HasCallStack, MonadIO m, IsNode a) =>
    a
    -- ^ /@self@/: the node
    -> m ((Wp.Enums.NodeState, T.Text))
    -- ^ __Returns:__ the current state of the node
nodeGetState self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    error_ <- callocMem :: IO (Ptr CString)
    result <- wp_node_get_state self' error_
    let result' = (toEnum . fromIntegral) result
    error_' <- peek error_
    error_'' <- cstringToText error_'
    touchManagedPtr self
    freeMem error_
    return (result', error_'')

#if defined(ENABLE_OVERLOADING)
data NodeGetStateMethodInfo
instance (signature ~ (m ((Wp.Enums.NodeState, T.Text))), MonadIO m, IsNode a) => O.OverloadedMethod NodeGetStateMethodInfo a signature where
    overloadedMethod = nodeGetState

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


#endif

-- method Node::lookup_port_full
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Wp" , name = "Node" }
--           , argCType = Just "WpNode*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the node" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "interest"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ObjectInterest" }
--           , argCType = Just "WpObjectInterest*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the interest" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Port" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_node_lookup_port_full" wp_node_lookup_port_full :: 
    Ptr Node ->                             -- self : TInterface (Name {namespace = "Wp", name = "Node"})
    Ptr Wp.ObjectInterest.ObjectInterest -> -- interest : TInterface (Name {namespace = "Wp", name = "ObjectInterest"})
    IO (Ptr Wp.Port.Port)

-- | Retrieves the first port that matches the /@interest@/.
-- 
-- 
-- Requires WP_NODE_FEATURE_PORTS
nodeLookupPortFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsNode a) =>
    a
    -- ^ /@self@/: the node
    -> Wp.ObjectInterest.ObjectInterest
    -- ^ /@interest@/: the interest
    -> m (Maybe Wp.Port.Port)
    -- ^ __Returns:__ the first port that matches the /@interest@/, or NULL if there is no such port
nodeLookupPortFull self interest = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    interest' <- B.ManagedPtr.disownBoxed interest
    result <- wp_node_lookup_port_full self' interest'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Wp.Port.Port) result'
        return result''
    touchManagedPtr self
    touchManagedPtr interest
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data NodeLookupPortFullMethodInfo
instance (signature ~ (Wp.ObjectInterest.ObjectInterest -> m (Maybe Wp.Port.Port)), MonadIO m, IsNode a) => O.OverloadedMethod NodeLookupPortFullMethodInfo a signature where
    overloadedMethod = nodeLookupPortFull

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


#endif

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

foreign import ccall "wp_node_new_ports_filtered_iterator_full" wp_node_new_ports_filtered_iterator_full :: 
    Ptr Node ->                             -- self : TInterface (Name {namespace = "Wp", name = "Node"})
    Ptr Wp.ObjectInterest.ObjectInterest -> -- interest : TInterface (Name {namespace = "Wp", name = "ObjectInterest"})
    IO (Ptr Wp.Iterator.Iterator)

-- | Gets a new iterator that iterates over all the ports that belong to this node and match the /@interest@/.
-- 
-- 
-- Requires WP_NODE_FEATURE_PORTS
nodeNewPortsFilteredIteratorFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsNode a) =>
    a
    -- ^ /@self@/: the node
    -> Wp.ObjectInterest.ObjectInterest
    -- ^ /@interest@/: the interest
    -> m Wp.Iterator.Iterator
    -- ^ __Returns:__ a WpIterator that iterates over WpPort objects
nodeNewPortsFilteredIteratorFull self interest = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    interest' <- B.ManagedPtr.disownBoxed interest
    result <- wp_node_new_ports_filtered_iterator_full self' interest'
    checkUnexpectedReturnNULL "nodeNewPortsFilteredIteratorFull" result
    result' <- (wrapBoxed Wp.Iterator.Iterator) result
    touchManagedPtr self
    touchManagedPtr interest
    return result'

#if defined(ENABLE_OVERLOADING)
data NodeNewPortsFilteredIteratorFullMethodInfo
instance (signature ~ (Wp.ObjectInterest.ObjectInterest -> m Wp.Iterator.Iterator), MonadIO m, IsNode a) => O.OverloadedMethod NodeNewPortsFilteredIteratorFullMethodInfo a signature where
    overloadedMethod = nodeNewPortsFilteredIteratorFull

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


#endif

-- method Node::new_ports_iterator
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Wp" , name = "Node" }
--           , argCType = Just "WpNode*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the node" , 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_node_new_ports_iterator" wp_node_new_ports_iterator :: 
    Ptr Node ->                             -- self : TInterface (Name {namespace = "Wp", name = "Node"})
    IO (Ptr Wp.Iterator.Iterator)

-- | Gets a new iterator that iterates over all the ports that belong to this node.
-- 
-- 
-- Requires WP_NODE_FEATURE_PORTS
nodeNewPortsIterator ::
    (B.CallStack.HasCallStack, MonadIO m, IsNode a) =>
    a
    -- ^ /@self@/: the node
    -> m Wp.Iterator.Iterator
    -- ^ __Returns:__ a WpIterator that iterates over WpPort objects
nodeNewPortsIterator self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_node_new_ports_iterator self'
    checkUnexpectedReturnNULL "nodeNewPortsIterator" result
    result' <- (wrapBoxed Wp.Iterator.Iterator) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data NodeNewPortsIteratorMethodInfo
instance (signature ~ (m Wp.Iterator.Iterator), MonadIO m, IsNode a) => O.OverloadedMethod NodeNewPortsIteratorMethodInfo a signature where
    overloadedMethod = nodeNewPortsIterator

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


#endif

-- method Node::send_command
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Wp" , name = "Node" }
--           , argCType = Just "WpNode*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the node" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "command"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the command" , 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_node_send_command" wp_node_send_command :: 
    Ptr Node ->                             -- self : TInterface (Name {namespace = "Wp", name = "Node"})
    CString ->                              -- command : TBasicType TUTF8
    IO ()

-- | Sends a command to a node.
-- 
-- 
-- Valid commands are the short string reprepsentations of enum spa_node_command. For example, \"Suspend\" or \"Flush\" are valid commands
nodeSendCommand ::
    (B.CallStack.HasCallStack, MonadIO m, IsNode a) =>
    a
    -- ^ /@self@/: the node
    -> T.Text
    -- ^ /@command@/: the command
    -> m ()
nodeSendCommand self command = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    command' <- textToCString command
    wp_node_send_command self' command'
    touchManagedPtr self
    freeMem command'
    return ()

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

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


#endif


