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


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- WpDynamicRules evaluates dynamic rules against added subject objects and triggers the apply-actions and revert-actions signals whenever a rule\'s actions should be applied or reverted respectively.
-- Rules can be added either from JSON with 'GI.Wp.Objects.DynamicRules.dynamicRulesAddJsonRule' or programmatically with 'GI.Wp.Objects.DynamicRules.dynamicRulesAddConditionRule' and 'GI.Wp.Objects.DynamicRules.dynamicRulesAddConditionRuleClosure'. JSON rules may carry an optional conditions block in addition to the standard matches and actions blocks. A condition block lists external objects that must exist for the rule to be satisfied.
-- Rule JSON format:
-- Entries in conditions are AND: all must be satisfied. Entries in a condition\'s matches are OR: any one matching object satisfies it. Rules without a conditions block are always considered satisfied.
-- Use 'GI.Wp.Objects.Object.objectActivate' with WP_DYNAMIC_RULES_LOADED to activate. Call 'GI.Wp.Objects.DynamicRules.dynamicRulesAddObject' to register subject objects to evaluate.

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

module GI.Wp.Objects.DynamicRules
    ( 

-- * Exported types
    DynamicRules(..)                        ,
    IsDynamicRules                          ,
    toDynamicRules                          ,


 -- * 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"), [addConditionRule]("GI.Wp.Objects.DynamicRules#g:method:addConditionRule"), [addConditionRuleClosure]("GI.Wp.Objects.DynamicRules#g:method:addConditionRuleClosure"), [addJsonRule]("GI.Wp.Objects.DynamicRules#g:method:addJsonRule"), [addObject]("GI.Wp.Objects.DynamicRules#g:method:addObject"), [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"), [removeObject]("GI.Wp.Objects.DynamicRules#g:method:removeObject"), [removeRule]("GI.Wp.Objects.DynamicRules#g:method:removeRule"), [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"), [getCore]("GI.Wp.Objects.Object#g:method:getCore"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getId]("GI.Wp.Objects.Object#g:method:getId"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getSupportedFeatures]("GI.Wp.Objects.Object#g:method:getSupportedFeatures").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveDynamicRulesMethod               ,
#endif

-- ** addConditionRule #method:addConditionRule#

#if defined(ENABLE_OVERLOADING)
    DynamicRulesAddConditionRuleMethodInfo  ,
#endif
    dynamicRulesAddConditionRule            ,


-- ** addConditionRuleClosure #method:addConditionRuleClosure#

#if defined(ENABLE_OVERLOADING)
    DynamicRulesAddConditionRuleClosureMethodInfo,
#endif
    dynamicRulesAddConditionRuleClosure     ,


-- ** addJsonRule #method:addJsonRule#

#if defined(ENABLE_OVERLOADING)
    DynamicRulesAddJsonRuleMethodInfo       ,
#endif
    dynamicRulesAddJsonRule                 ,


-- ** addObject #method:addObject#

#if defined(ENABLE_OVERLOADING)
    DynamicRulesAddObjectMethodInfo         ,
#endif
    dynamicRulesAddObject                   ,


-- ** new #method:new#

    dynamicRulesNew                         ,


-- ** removeObject #method:removeObject#

#if defined(ENABLE_OVERLOADING)
    DynamicRulesRemoveObjectMethodInfo      ,
#endif
    dynamicRulesRemoveObject                ,


-- ** removeRule #method:removeRule#

#if defined(ENABLE_OVERLOADING)
    DynamicRulesRemoveRuleMethodInfo        ,
#endif
    dynamicRulesRemoveRule                  ,




 -- * Signals


-- ** applyActions #signal:applyActions#

    DynamicRulesApplyActionsCallback        ,
#if defined(ENABLE_OVERLOADING)
    DynamicRulesApplyActionsSignalInfo      ,
#endif
    afterDynamicRulesApplyActions           ,
    onDynamicRulesApplyActions              ,


-- ** revertActions #signal:revertActions#

    DynamicRulesRevertActionsCallback       ,
#if defined(ENABLE_OVERLOADING)
    DynamicRulesRevertActionsSignalInfo     ,
#endif
    afterDynamicRulesRevertActions          ,
    onDynamicRulesRevertActions             ,




    ) 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.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.Proxy as Wp.Proxy
import {-# SOURCE #-} qualified GI.Wp.Structs.Iterator as Wp.Iterator
import {-# SOURCE #-} qualified GI.Wp.Structs.IteratorMethods as Wp.IteratorMethods
import {-# SOURCE #-} qualified GI.Wp.Structs.ObjectInterest as Wp.ObjectInterest
import {-# SOURCE #-} qualified GI.Wp.Structs.Properties as Wp.Properties
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaJson as Wp.SpaJson

#else
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Wp.Callbacks as Wp.Callbacks
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.Structs.ObjectInterest as Wp.ObjectInterest
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaJson as Wp.SpaJson

#endif

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

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

foreign import ccall "wp_dynamic_rules_get_type"
    c_wp_dynamic_rules_get_type :: IO B.Types.GType

instance B.Types.TypedObject DynamicRules where
    glibType = c_wp_dynamic_rules_get_type

instance B.Types.GObject DynamicRules

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

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

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

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

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

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

#endif

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

#endif

-- signal DynamicRules::apply-actions
-- | /No description available in the introspection data./
type DynamicRulesApplyActionsCallback =
    Word32
    -> T.Text
    -> Wp.SpaJson.SpaJson
    -> Wp.GlobalProxy.GlobalProxy
    -> IO ()

type C_DynamicRulesApplyActionsCallback =
    Ptr DynamicRules ->                     -- object
    Word32 ->
    CString ->
    Ptr Wp.SpaJson.SpaJson ->
    Ptr Wp.GlobalProxy.GlobalProxy ->
    Ptr () ->                               -- user_data
    IO ()

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

wrap_DynamicRulesApplyActionsCallback :: 
    GObject a => (a -> DynamicRulesApplyActionsCallback) ->
    C_DynamicRulesApplyActionsCallback
wrap_DynamicRulesApplyActionsCallback gi'cb gi'selfPtr object p0 p1 p2 _ = do
    p0' <- cstringToText p0
    B.ManagedPtr.withTransient  p1 $ \p1' -> do
        p2' <- (newObject Wp.GlobalProxy.GlobalProxy) p2
        B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self)  object p0' p1' p2'


-- | Connect a signal handler for the [applyActions](#signal:applyActions) 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' dynamicRules #applyActions callback
-- @
-- 
-- 
onDynamicRulesApplyActions :: (IsDynamicRules a, MonadIO m) => a -> ((?self :: a) => DynamicRulesApplyActionsCallback) -> m SignalHandlerId
onDynamicRulesApplyActions obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_DynamicRulesApplyActionsCallback wrapped
    wrapped'' <- mk_DynamicRulesApplyActionsCallback wrapped'
    connectSignalFunPtr obj "apply-actions" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [applyActions](#signal:applyActions) 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' dynamicRules #applyActions 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.
-- 
afterDynamicRulesApplyActions :: (IsDynamicRules a, MonadIO m) => a -> ((?self :: a) => DynamicRulesApplyActionsCallback) -> m SignalHandlerId
afterDynamicRulesApplyActions obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_DynamicRulesApplyActionsCallback wrapped
    wrapped'' <- mk_DynamicRulesApplyActionsCallback wrapped'
    connectSignalFunPtr obj "apply-actions" wrapped'' SignalConnectAfter Nothing


#if defined(ENABLE_OVERLOADING)
data DynamicRulesApplyActionsSignalInfo
instance SignalInfo DynamicRulesApplyActionsSignalInfo where
    type HaskellCallbackType DynamicRulesApplyActionsSignalInfo = DynamicRulesApplyActionsCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DynamicRulesApplyActionsCallback cb
        cb'' <- mk_DynamicRulesApplyActionsCallback cb'
        connectSignalFunPtr obj "apply-actions" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.DynamicRules::apply-actions"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-DynamicRules.html#g:signal:applyActions"})

#endif

-- signal DynamicRules::revert-actions
-- | /No description available in the introspection data./
type DynamicRulesRevertActionsCallback =
    Word32
    -> T.Text
    -> Wp.SpaJson.SpaJson
    -> Wp.GlobalProxy.GlobalProxy
    -> IO ()

type C_DynamicRulesRevertActionsCallback =
    Ptr DynamicRules ->                     -- object
    Word32 ->
    CString ->
    Ptr Wp.SpaJson.SpaJson ->
    Ptr Wp.GlobalProxy.GlobalProxy ->
    Ptr () ->                               -- user_data
    IO ()

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

wrap_DynamicRulesRevertActionsCallback :: 
    GObject a => (a -> DynamicRulesRevertActionsCallback) ->
    C_DynamicRulesRevertActionsCallback
wrap_DynamicRulesRevertActionsCallback gi'cb gi'selfPtr object p0 p1 p2 _ = do
    p0' <- cstringToText p0
    B.ManagedPtr.withTransient  p1 $ \p1' -> do
        p2' <- (newObject Wp.GlobalProxy.GlobalProxy) p2
        B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self)  object p0' p1' p2'


-- | Connect a signal handler for the [revertActions](#signal:revertActions) 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' dynamicRules #revertActions callback
-- @
-- 
-- 
onDynamicRulesRevertActions :: (IsDynamicRules a, MonadIO m) => a -> ((?self :: a) => DynamicRulesRevertActionsCallback) -> m SignalHandlerId
onDynamicRulesRevertActions obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_DynamicRulesRevertActionsCallback wrapped
    wrapped'' <- mk_DynamicRulesRevertActionsCallback wrapped'
    connectSignalFunPtr obj "revert-actions" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [revertActions](#signal:revertActions) 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' dynamicRules #revertActions 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.
-- 
afterDynamicRulesRevertActions :: (IsDynamicRules a, MonadIO m) => a -> ((?self :: a) => DynamicRulesRevertActionsCallback) -> m SignalHandlerId
afterDynamicRulesRevertActions obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_DynamicRulesRevertActionsCallback wrapped
    wrapped'' <- mk_DynamicRulesRevertActionsCallback wrapped'
    connectSignalFunPtr obj "revert-actions" wrapped'' SignalConnectAfter Nothing


#if defined(ENABLE_OVERLOADING)
data DynamicRulesRevertActionsSignalInfo
instance SignalInfo DynamicRulesRevertActionsSignalInfo where
    type HaskellCallbackType DynamicRulesRevertActionsSignalInfo = DynamicRulesRevertActionsCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DynamicRulesRevertActionsCallback cb
        cb'' <- mk_DynamicRulesRevertActionsCallback cb'
        connectSignalFunPtr obj "revert-actions" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.DynamicRules::revert-actions"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-DynamicRules.html#g:signal:revertActions"})

#endif

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

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList DynamicRules = DynamicRulesSignalList
type DynamicRulesSignalList = ('[ '("applyActions", DynamicRulesApplyActionsSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("revertActions", DynamicRulesRevertActionsSignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method DynamicRules::new
-- 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 WpCore" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "DynamicRules" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_dynamic_rules_new" wp_dynamic_rules_new :: 
    Ptr Wp.Core.Core ->                     -- core : TInterface (Name {namespace = "Wp", name = "Core"})
    IO (Ptr DynamicRules)

-- | Creates a new WpDynamicRules object.
-- 
-- 
-- Call 'GI.Wp.Objects.Object.objectActivate' with WP_DYNAMIC_RULES_LOADED to start watching objects. Use 'GI.Wp.Objects.DynamicRules.dynamicRulesAddJsonRule' or 'GI.Wp.Objects.DynamicRules.dynamicRulesAddConditionRule' to add rules to the object.
-- 
-- /Since: 0.5.16/
dynamicRulesNew ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.Core.IsCore a) =>
    a
    -- ^ /@core@/: the WpCore
    -> m DynamicRules
    -- ^ __Returns:__ the new WpDynamicRules
dynamicRulesNew core = liftIO $ do
    core' <- unsafeManagedPtrCastPtr core
    result <- wp_dynamic_rules_new core'
    checkUnexpectedReturnNULL "dynamicRulesNew" result
    result' <- (wrapObject DynamicRules) result
    touchManagedPtr core
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method DynamicRules::add_condition_rule
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "DynamicRules" }
--           , argCType = Just "WpDynamicRules*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the dynamic rules object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "matches"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ObjectInterest" }
--           , argCType = Just "WpObjectInterest*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "object interest that matches subject objects"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "actions"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaJson" }
--           , argCType = Just "WpSpaJson*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "action object emitted by the rule"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface
--                 Name { namespace = "Wp" , name = "DynamicRulesConditionCallback" }
--           , argCType = Just "WpDynamicRulesConditionCallback"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "callback to evaluate the condition"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data to pass to @callback"
--                 , 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_dynamic_rules_add_condition_rule" wp_dynamic_rules_add_condition_rule :: 
    Ptr DynamicRules ->                     -- self : TInterface (Name {namespace = "Wp", name = "DynamicRules"})
    Ptr Wp.ObjectInterest.ObjectInterest -> -- matches : TInterface (Name {namespace = "Wp", name = "ObjectInterest"})
    Ptr Wp.SpaJson.SpaJson ->               -- actions : TInterface (Name {namespace = "Wp", name = "SpaJson"})
    FunPtr Wp.Callbacks.C_DynamicRulesConditionCallback -> -- callback : TInterface (Name {namespace = "Wp", name = "DynamicRulesConditionCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO Word32

-- | Adds a dynamic rule with a condition callback.
-- 
-- 
-- The provided /@matches@/ interest determines if a subject object is matched. The provided /@actions@/ object is emitted when the rule is satisfied. The provided /@callback@/ is evaluated as an additional condition.
-- 
-- /Since: 0.5.16/
dynamicRulesAddConditionRule ::
    (B.CallStack.HasCallStack, MonadIO m, IsDynamicRules a) =>
    a
    -- ^ /@self@/: the dynamic rules object
    -> Wp.ObjectInterest.ObjectInterest
    -- ^ /@matches@/: object interest that matches subject objects
    -> Wp.SpaJson.SpaJson
    -- ^ /@actions@/: action object emitted by the rule
    -> Wp.Callbacks.DynamicRulesConditionCallback
    -- ^ /@callback@/: callback to evaluate the condition
    -> m Word32
    -- ^ __Returns:__ the added rule ID, or SPA_ID_INVALID on error
dynamicRulesAddConditionRule self matches actions callback = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    matches' <- unsafeManagedPtrGetPtr matches
    actions' <- unsafeManagedPtrGetPtr actions
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Wp.Callbacks.C_DynamicRulesConditionCallback))
    callback' <- Wp.Callbacks.mk_DynamicRulesConditionCallback (Wp.Callbacks.wrap_DynamicRulesConditionCallback (Just ptrcallback) (Wp.Callbacks.drop_closures_DynamicRulesConditionCallback callback))
    poke ptrcallback callback'
    let userData = nullPtr
    result <- wp_dynamic_rules_add_condition_rule self' matches' actions' callback' userData
    touchManagedPtr self
    touchManagedPtr matches
    touchManagedPtr actions
    return result

#if defined(ENABLE_OVERLOADING)
data DynamicRulesAddConditionRuleMethodInfo
instance (signature ~ (Wp.ObjectInterest.ObjectInterest -> Wp.SpaJson.SpaJson -> Wp.Callbacks.DynamicRulesConditionCallback -> m Word32), MonadIO m, IsDynamicRules a) => O.OverloadedMethod DynamicRulesAddConditionRuleMethodInfo a signature where
    overloadedMethod = dynamicRulesAddConditionRule

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


#endif

-- method DynamicRules::add_condition_rule_closure
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "DynamicRules" }
--           , argCType = Just "WpDynamicRules*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the dynamic rules object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "matches"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ObjectInterest" }
--           , argCType = Just "WpObjectInterest*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "object interest that matches subject objects"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "actions"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaJson" }
--           , argCType = Just "WpSpaJson*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "action object emitted by the rule"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "closure"
--           , argType = TGClosure Nothing
--           , argCType = Just "GClosure*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "closure to evaluate the condition"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "wp_dynamic_rules_add_condition_rule_closure" wp_dynamic_rules_add_condition_rule_closure :: 
    Ptr DynamicRules ->                     -- self : TInterface (Name {namespace = "Wp", name = "DynamicRules"})
    Ptr Wp.ObjectInterest.ObjectInterest -> -- matches : TInterface (Name {namespace = "Wp", name = "ObjectInterest"})
    Ptr Wp.SpaJson.SpaJson ->               -- actions : TInterface (Name {namespace = "Wp", name = "SpaJson"})
    Ptr (GClosure ()) ->                    -- closure : TGClosure Nothing
    IO Word32

-- | Adds a dynamic rule with a condition closure.
-- 
-- 
-- The provided /@matches@/ interest determines if a subject object is matched. The provided /@actions@/ object is emitted when the rule is satisfied. The provided /@closure@/ is evaluated as an additional condition.
-- 
-- /Since: 0.5.16/
dynamicRulesAddConditionRuleClosure ::
    (B.CallStack.HasCallStack, MonadIO m, IsDynamicRules a) =>
    a
    -- ^ /@self@/: the dynamic rules object
    -> Wp.ObjectInterest.ObjectInterest
    -- ^ /@matches@/: object interest that matches subject objects
    -> Wp.SpaJson.SpaJson
    -- ^ /@actions@/: action object emitted by the rule
    -> GClosure b
    -- ^ /@closure@/: closure to evaluate the condition
    -> m Word32
    -- ^ __Returns:__ the added rule ID, or SPA_ID_INVALID on error
dynamicRulesAddConditionRuleClosure self matches actions closure = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    matches' <- unsafeManagedPtrGetPtr matches
    actions' <- unsafeManagedPtrGetPtr actions
    closure' <- FP.castPtr <$> B.GClosure.disownGClosure closure
    result <- wp_dynamic_rules_add_condition_rule_closure self' matches' actions' closure'
    touchManagedPtr self
    touchManagedPtr matches
    touchManagedPtr actions
    touchManagedPtr closure
    return result

#if defined(ENABLE_OVERLOADING)
data DynamicRulesAddConditionRuleClosureMethodInfo
instance (signature ~ (Wp.ObjectInterest.ObjectInterest -> Wp.SpaJson.SpaJson -> GClosure b -> m Word32), MonadIO m, IsDynamicRules a) => O.OverloadedMethod DynamicRulesAddConditionRuleClosureMethodInfo a signature where
    overloadedMethod = dynamicRulesAddConditionRuleClosure

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


#endif

-- method DynamicRules::add_json_rule
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "DynamicRules" }
--           , argCType = Just "WpDynamicRules*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the dynamic rules object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "json_rule"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaJson" }
--           , argCType = Just "WpSpaJson*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "JSON object defining the rule"
--                 , 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_dynamic_rules_add_json_rule" wp_dynamic_rules_add_json_rule :: 
    Ptr DynamicRules ->                     -- self : TInterface (Name {namespace = "Wp", name = "DynamicRules"})
    Ptr Wp.SpaJson.SpaJson ->               -- json_rule : TInterface (Name {namespace = "Wp", name = "SpaJson"})
    IO Word32

-- | Adds a dynamic rule from a JSON object.
-- 
-- 
-- The JSON object must have \"matches\" and \"actions\" properties. It may optionally have a \"conditions\" array property.
-- 
-- /Since: 0.5.16/
dynamicRulesAddJsonRule ::
    (B.CallStack.HasCallStack, MonadIO m, IsDynamicRules a) =>
    a
    -- ^ /@self@/: the dynamic rules object
    -> Wp.SpaJson.SpaJson
    -- ^ /@jsonRule@/: JSON object defining the rule
    -> m Word32
    -- ^ __Returns:__ the added rule ID, or SPA_ID_INVALID on error
dynamicRulesAddJsonRule self jsonRule = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    jsonRule' <- unsafeManagedPtrGetPtr jsonRule
    result <- wp_dynamic_rules_add_json_rule self' jsonRule'
    touchManagedPtr self
    touchManagedPtr jsonRule
    return result

#if defined(ENABLE_OVERLOADING)
data DynamicRulesAddJsonRuleMethodInfo
instance (signature ~ (Wp.SpaJson.SpaJson -> m Word32), MonadIO m, IsDynamicRules a) => O.OverloadedMethod DynamicRulesAddJsonRuleMethodInfo a signature where
    overloadedMethod = dynamicRulesAddJsonRule

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


#endif

-- method DynamicRules::add_object
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "DynamicRules" }
--           , argCType = Just "WpDynamicRules*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the dynamic rules object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "GlobalProxy" }
--           , argCType = Just "WpGlobalProxy*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the subject object to add"
--                 , 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_dynamic_rules_add_object" wp_dynamic_rules_add_object :: 
    Ptr DynamicRules ->                     -- self : TInterface (Name {namespace = "Wp", name = "DynamicRules"})
    Ptr Wp.GlobalProxy.GlobalProxy ->       -- object : TInterface (Name {namespace = "Wp", name = "GlobalProxy"})
    IO ()

-- | Adds an object to be evaluated against the rules.
-- 
-- 
-- If already loaded, the object is evaluated immediately and apply-actions or revert-actions signals are emitted as appropriate.
-- 
-- /Since: 0.5.16/
dynamicRulesAddObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsDynamicRules a, Wp.GlobalProxy.IsGlobalProxy b) =>
    a
    -- ^ /@self@/: the dynamic rules object
    -> b
    -- ^ /@object@/: the subject object to add
    -> m ()
dynamicRulesAddObject self object = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    object' <- unsafeManagedPtrCastPtr object
    wp_dynamic_rules_add_object self' object'
    touchManagedPtr self
    touchManagedPtr object
    return ()

#if defined(ENABLE_OVERLOADING)
data DynamicRulesAddObjectMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDynamicRules a, Wp.GlobalProxy.IsGlobalProxy b) => O.OverloadedMethod DynamicRulesAddObjectMethodInfo a signature where
    overloadedMethod = dynamicRulesAddObject

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


#endif

-- method DynamicRules::remove_object
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "DynamicRules" }
--           , argCType = Just "WpDynamicRules*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the dynamic rules object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "GlobalProxy" }
--           , argCType = Just "WpGlobalProxy*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the subject object to remove"
--                 , 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_dynamic_rules_remove_object" wp_dynamic_rules_remove_object :: 
    Ptr DynamicRules ->                     -- self : TInterface (Name {namespace = "Wp", name = "DynamicRules"})
    Ptr Wp.GlobalProxy.GlobalProxy ->       -- object : TInterface (Name {namespace = "Wp", name = "GlobalProxy"})
    IO ()

-- | Removes a previously added object.
-- 
-- /Since: 0.5.16/
dynamicRulesRemoveObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsDynamicRules a, Wp.GlobalProxy.IsGlobalProxy b) =>
    a
    -- ^ /@self@/: the dynamic rules object
    -> b
    -- ^ /@object@/: the subject object to remove
    -> m ()
dynamicRulesRemoveObject self object = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    object' <- unsafeManagedPtrCastPtr object
    wp_dynamic_rules_remove_object self' object'
    touchManagedPtr self
    touchManagedPtr object
    return ()

#if defined(ENABLE_OVERLOADING)
data DynamicRulesRemoveObjectMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDynamicRules a, Wp.GlobalProxy.IsGlobalProxy b) => O.OverloadedMethod DynamicRulesRemoveObjectMethodInfo a signature where
    overloadedMethod = dynamicRulesRemoveObject

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


#endif

-- method DynamicRules::remove_rule
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "DynamicRules" }
--           , argCType = Just "WpDynamicRules*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the dynamic rules object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "rule_id"
--           , argType = TBasicType TUInt32
--           , argCType = Just "guint32"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the rule ID returned by wp_dynamic_rules_add_condition_rule() or wp_dynamic_rules_add_json_rule()"
--                 , 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_dynamic_rules_remove_rule" wp_dynamic_rules_remove_rule :: 
    Ptr DynamicRules ->                     -- self : TInterface (Name {namespace = "Wp", name = "DynamicRules"})
    Word32 ->                               -- rule_id : TBasicType TUInt32
    IO ()

-- | Removes a previously added dynamic rule.
-- 
-- /Since: 0.5.16/
dynamicRulesRemoveRule ::
    (B.CallStack.HasCallStack, MonadIO m, IsDynamicRules a) =>
    a
    -- ^ /@self@/: the dynamic rules object
    -> Word32
    -- ^ /@ruleId@/: the rule ID returned by 'GI.Wp.Objects.DynamicRules.dynamicRulesAddConditionRule' or 'GI.Wp.Objects.DynamicRules.dynamicRulesAddJsonRule'
    -> m ()
dynamicRulesRemoveRule self ruleId = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    wp_dynamic_rules_remove_rule self' ruleId
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data DynamicRulesRemoveRuleMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsDynamicRules a) => O.OverloadedMethod DynamicRulesRemoveRuleMethodInfo a signature where
    overloadedMethod = dynamicRulesRemoveRule

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


#endif


