packages feed

gi-wireplumber-0.5.14.2: GI/Wp/Structs/ObjectInterest.hs

{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- An object interest is a helper that is used in WpObjectManager to declare interest in certain kinds of objects.
-- An interest is defined by a GType and a set of constraints on the object\'s properties. An object \"matches\" the interest if it is of the specified GType (either the same type or a descendant of it) and all the constraints are satisfied.

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

module GI.Wp.Structs.ObjectInterest
    ( 

-- * Exported types
    ObjectInterest(..)                      ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [addConstraint]("GI.Wp.Structs.ObjectInterest#g:method:addConstraint"), [findDefinedConstraintValues]("GI.Wp.Structs.ObjectInterest#g:method:findDefinedConstraintValues"), [matches]("GI.Wp.Structs.ObjectInterest#g:method:matches"), [matchesFull]("GI.Wp.Structs.ObjectInterest#g:method:matchesFull"), [ref]("GI.Wp.Structs.ObjectInterest#g:method:ref"), [unref]("GI.Wp.Structs.ObjectInterest#g:method:unref"), [validate]("GI.Wp.Structs.ObjectInterest#g:method:validate").
-- 
-- ==== Getters
-- /None/.
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveObjectInterestMethod             ,
#endif

-- ** addConstraint #method:addConstraint#

#if defined(ENABLE_OVERLOADING)
    ObjectInterestAddConstraintMethodInfo   ,
#endif
    objectInterestAddConstraint             ,


-- ** findDefinedConstraintValues #method:findDefinedConstraintValues#

#if defined(ENABLE_OVERLOADING)
    ObjectInterestFindDefinedConstraintValuesMethodInfo,
#endif
    objectInterestFindDefinedConstraintValues,


-- ** matches #method:matches#

#if defined(ENABLE_OVERLOADING)
    ObjectInterestMatchesMethodInfo         ,
#endif
    objectInterestMatches                   ,


-- ** matchesFull #method:matchesFull#

#if defined(ENABLE_OVERLOADING)
    ObjectInterestMatchesFullMethodInfo     ,
#endif
    objectInterestMatchesFull               ,


-- ** newType #method:newType#

    objectInterestNewType                   ,


-- ** ref #method:ref#

#if defined(ENABLE_OVERLOADING)
    ObjectInterestRefMethodInfo             ,
#endif
    objectInterestRef                       ,


-- ** unref #method:unref#

#if defined(ENABLE_OVERLOADING)
    ObjectInterestUnrefMethodInfo           ,
#endif
    objectInterestUnref                     ,


-- ** validate #method:validate#

#if defined(ENABLE_OVERLOADING)
    ObjectInterestValidateMethodInfo        ,
#endif
    objectInterestValidate                  ,




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

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

#endif

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

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

foreign import ccall "wp_object_interest_get_type" c_wp_object_interest_get_type :: 
    IO GType

type instance O.ParentTypes ObjectInterest = '[]
instance O.HasParentTypes ObjectInterest

instance B.Types.TypedObject ObjectInterest where
    glibType = c_wp_object_interest_get_type

instance B.Types.GBoxed ObjectInterest

-- | Convert t'ObjectInterest' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe ObjectInterest) where
    gvalueGType_ = c_wp_object_interest_get_type
    gvalueSet_ gv P.Nothing = B.GValue.set_boxed gv (FP.nullPtr :: FP.Ptr ObjectInterest)
    gvalueSet_ gv (P.Just obj) = B.ManagedPtr.withManagedPtr obj (B.GValue.set_boxed gv)
    gvalueGet_ gv = do
        ptr <- B.GValue.get_boxed gv :: IO (Ptr ObjectInterest)
        if ptr /= FP.nullPtr
        then P.Just <$> B.ManagedPtr.newBoxed ObjectInterest ptr
        else return P.Nothing
        
    


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ObjectInterest
type instance O.AttributeList ObjectInterest = ObjectInterestAttributeList
type ObjectInterestAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif

-- method ObjectInterest::new_type
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "gtype"
--           , argType = TBasicType TGType
--           , argCType = Just "GType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the type of the object to declare interest in"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Wp" , name = "ObjectInterest" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_object_interest_new_type" wp_object_interest_new_type :: 
    CGType ->                               -- gtype : TBasicType TGType
    IO (Ptr ObjectInterest)

-- | Creates a new interest that declares interest in objects of the specified /@gtype@/, without any property constraints.
-- 
-- 
-- To add property constraints, you can call 'GI.Wp.Structs.ObjectInterest.objectInterestAddConstraint' afterwards.
objectInterestNewType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GType
    -- ^ /@gtype@/: the type of the object to declare interest in
    -> m ObjectInterest
    -- ^ __Returns:__ the new object interest
objectInterestNewType gtype = liftIO $ do
    let gtype' = gtypeToCGType gtype
    result <- wp_object_interest_new_type gtype'
    checkUnexpectedReturnNULL "objectInterestNewType" result
    result' <- (wrapBoxed ObjectInterest) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method ObjectInterest::add_constraint
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ObjectInterest" }
--           , argCType = Just "WpObjectInterest*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the object interest"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "type"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ConstraintType" }
--           , argCType = Just "WpConstraintType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the constraint type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "subject"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the subject that the constraint applies to"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "verb"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ConstraintVerb" }
--           , argCType = Just "WpConstraintVerb"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the operation that is performed to check the constraint"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TVariant
--           , argCType = Just "GVariant*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the value to check for"
--                 , 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_object_interest_add_constraint" wp_object_interest_add_constraint :: 
    Ptr ObjectInterest ->                   -- self : TInterface (Name {namespace = "Wp", name = "ObjectInterest"})
    CUInt ->                                -- type : TInterface (Name {namespace = "Wp", name = "ConstraintType"})
    CString ->                              -- subject : TBasicType TUTF8
    CUInt ->                                -- verb : TInterface (Name {namespace = "Wp", name = "ConstraintVerb"})
    Ptr GVariant ->                         -- value : TVariant
    IO ()

-- | Adds a constraint to this interest. Constraints consist of a /@type@/, a /@subject@/, a /@verb@/ and, depending on the /@verb@/, a /@value@/.
-- 
-- 
-- Constraints are almost like a spoken language sentence that declare a condition that must be true in order to consider that an object can match this interest. For instance, a constraint can be \"pipewire property
-- \'object.id\' equals 10\". This would be translated to:
-- 
-- === /C code/
-- >
-- >  wp_object_interest_add_constraint (i,
-- >     WP_CONSTRAINT_TYPE_PW_PROPERTY, "object.id",
-- >     WP_CONSTRAINT_VERB_EQUALS, g_variant_new_int (10));
-- 
-- Some verbs require a /@value@/ and some others do not. For those that do, the /@value@/ must be of a specific type:
-- * WP_CONSTRAINT_VERB_EQUALS: /@value@/ can be a string, a (u)int32, a (u)int64, a double or a boolean. The /@subject@/ value must equal this value for the constraint to be satisfied
-- * WP_CONSTRAINT_VERB_IN_LIST: /@value@/ must be a tuple that contains any number of items of the same type; the items can be string, (u)int32, (u)int64 or double. These items make a list that the /@subject@/\'s value will be checked against. If any of the items equals the /@subject@/ value, the constraint is satisfied
-- * WP_CONSTRAINT_VERB_IN_RANGE: /@value@/ must be a tuple that contains exactly 2 numbers of the same type ((u)int32, (u)int64 or double), meaning the minimum and maximum (inclusive) of the range. If the /@subject@/ value is a number within this range, the constraint is satisfied
-- * WP_CONSTRAINT_VERB_MATCHES: /@value@/ must be a string that defines a pattern usable with GPatternSpec If the /@subject@/ value matches this pattern, the constraint is satisfied
-- 
-- 
-- In case the type of the /@subject@/ value is not the same type as the one requested by the type of the /@value@/, the /@subject@/ value is converted. For GObject properties, this conversion is done using 'GI.GObject.Structs.Value.valueTransform', so limitations of this function apply. In the case of PipeWire properties, which are /@always@/ strings, conversion is done as follows:
-- * to boolean: \"true\" or \"1\" means TRUE, \"false\" or \"0\" means FALSE
-- * to int \/ uint \/ int64 \/ uint64: One of the @/strtol()/@ family of functions is used to convert, using base 10
-- * to double: @/strtod()/@ is used
-- 
-- 
-- This method does not fail if invalid arguments are given. However, 'GI.Wp.Structs.ObjectInterest.objectInterestValidate' should be called after adding all the constraints on an interest in order to catch errors.
objectInterestAddConstraint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ObjectInterest
    -- ^ /@self@/: the object interest
    -> Wp.Enums.ConstraintType
    -- ^ /@type@/: the constraint type
    -> T.Text
    -- ^ /@subject@/: the subject that the constraint applies to
    -> Wp.Enums.ConstraintVerb
    -- ^ /@verb@/: the operation that is performed to check the constraint
    -> Maybe (GVariant)
    -- ^ /@value@/: the value to check for
    -> m ()
objectInterestAddConstraint self type_ subject verb value = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    let type_' = (fromIntegral . fromEnum) type_
    subject' <- textToCString subject
    let verb' = (fromIntegral . fromEnum) verb
    maybeValue <- case value of
        Nothing -> return FP.nullPtr
        Just jValue -> do
            jValue' <- unsafeManagedPtrGetPtr jValue
            return jValue'
    wp_object_interest_add_constraint self' type_' subject' verb' maybeValue
    touchManagedPtr self
    whenJust value touchManagedPtr
    freeMem subject'
    return ()

#if defined(ENABLE_OVERLOADING)
data ObjectInterestAddConstraintMethodInfo
instance (signature ~ (Wp.Enums.ConstraintType -> T.Text -> Wp.Enums.ConstraintVerb -> Maybe (GVariant) -> m ()), MonadIO m) => O.OverloadedMethod ObjectInterestAddConstraintMethodInfo ObjectInterest signature where
    overloadedMethod = objectInterestAddConstraint

instance O.OverloadedMethodInfo ObjectInterestAddConstraintMethodInfo ObjectInterest where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Structs.ObjectInterest.objectInterestAddConstraint",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Structs-ObjectInterest.html#v:objectInterestAddConstraint"
        })


#endif

-- method ObjectInterest::find_defined_constraint_values
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ObjectInterest" }
--           , argCType = Just "WpObjectInterest*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the object interest"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "type"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ConstraintType" }
--           , argCType = Just "WpConstraintType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the constraint type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "subject"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the subject that the constraint applies to"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TPtrArray TVariant)
-- throws : False
-- Skip return : False

foreign import ccall "wp_object_interest_find_defined_constraint_values" wp_object_interest_find_defined_constraint_values :: 
    Ptr ObjectInterest ->                   -- self : TInterface (Name {namespace = "Wp", name = "ObjectInterest"})
    CUInt ->                                -- type : TInterface (Name {namespace = "Wp", name = "ConstraintType"})
    CString ->                              -- subject : TBasicType TUTF8
    IO (Ptr (GPtrArray (Ptr GVariant)))

-- | Finds all the defined constraint values for a subject in /@self@/.
-- 
-- 
-- A defined constraint value is the value of a constraint with the \'equal\' or \'in-list\' verb, because the full value must be defined with those verbs. This can be useful for cases where we want to enumerate interests that are interested in specific subjects.
-- 
-- /Since: 0.5.13/
objectInterestFindDefinedConstraintValues ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ObjectInterest
    -- ^ /@self@/: the object interest
    -> Wp.Enums.ConstraintType
    -- ^ /@type@/: the constraint type
    -> T.Text
    -- ^ /@subject@/: the subject that the constraint applies to
    -> m (Maybe [GVariant])
    -- ^ __Returns:__ the defined constraint values for this object interest.
objectInterestFindDefinedConstraintValues self type_ subject = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    let type_' = (fromIntegral . fromEnum) type_
    subject' <- textToCString subject
    result <- wp_object_interest_find_defined_constraint_values self' type_' subject'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- unpackGPtrArray result'
        result''' <- mapM B.GVariant.wrapGVariantPtr result''
        unrefPtrArray result'
        return result'''
    touchManagedPtr self
    freeMem subject'
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data ObjectInterestFindDefinedConstraintValuesMethodInfo
instance (signature ~ (Wp.Enums.ConstraintType -> T.Text -> m (Maybe [GVariant])), MonadIO m) => O.OverloadedMethod ObjectInterestFindDefinedConstraintValuesMethodInfo ObjectInterest signature where
    overloadedMethod = objectInterestFindDefinedConstraintValues

instance O.OverloadedMethodInfo ObjectInterestFindDefinedConstraintValuesMethodInfo ObjectInterest where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Structs.ObjectInterest.objectInterestFindDefinedConstraintValues",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Structs-ObjectInterest.html#v:objectInterestFindDefinedConstraintValues"
        })


#endif

-- method ObjectInterest::matches
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ObjectInterest" }
--           , argCType = Just "WpObjectInterest*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the object interest"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the target object to check for a match"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wp_object_interest_matches" wp_object_interest_matches :: 
    Ptr ObjectInterest ->                   -- self : TInterface (Name {namespace = "Wp", name = "ObjectInterest"})
    Ptr () ->                               -- object : TBasicType TPtr
    IO CInt

-- | Checks if the specified /@object@/ matches the type and all the constraints that are described in /@self@/.
-- 
-- 
-- If /@self@/ is configured to match GObject subclasses, this is equivalent to wp_object_interest_matches_full (self, G_OBJECT_TYPE (object), object, NULL, NULL) and if it is configured to match WpProperties, this is equivalent to wp_object_interest_matches_full (self, self->gtype, NULL, (WpProperties *) object, NULL);
objectInterestMatches ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ObjectInterest
    -- ^ /@self@/: the object interest
    -> Ptr ()
    -- ^ /@object@/: the target object to check for a match
    -> m Bool
    -- ^ __Returns:__ TRUE if the object matches, FALSE otherwise
objectInterestMatches self object = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_object_interest_matches self' object
    let result' = (/= 0) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data ObjectInterestMatchesMethodInfo
instance (signature ~ (Ptr () -> m Bool), MonadIO m) => O.OverloadedMethod ObjectInterestMatchesMethodInfo ObjectInterest signature where
    overloadedMethod = objectInterestMatches

instance O.OverloadedMethodInfo ObjectInterestMatchesMethodInfo ObjectInterest where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Structs.ObjectInterest.objectInterestMatches",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Structs-ObjectInterest.html#v:objectInterestMatches"
        })


#endif

-- method ObjectInterest::matches_full
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ObjectInterest" }
--           , argCType = Just "WpObjectInterest*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the object interest"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "InterestMatchFlags" }
--           , argCType = Just "WpInterestMatchFlags"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "flags to alter the behavior of this function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_type"
--           , argType = TBasicType TGType
--           , argCType = Just "GType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the type to be checked against the interest's type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the object to be used for checking constraints of type WP_CONSTRAINT_TYPE_G_PROPERTY"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pw_props"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the properties to be used for checking constraints of type WP_CONSTRAINT_TYPE_PW_PROPERTY"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pw_global_props"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the properties to be used for checking constraints of type WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Wp" , name = "InterestMatch" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_object_interest_matches_full" wp_object_interest_matches_full :: 
    Ptr ObjectInterest ->                   -- self : TInterface (Name {namespace = "Wp", name = "ObjectInterest"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Wp", name = "InterestMatchFlags"})
    CGType ->                               -- object_type : TBasicType TGType
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    Ptr Wp.Properties.Properties ->         -- pw_props : TInterface (Name {namespace = "Wp", name = "Properties"})
    Ptr Wp.Properties.Properties ->         -- pw_global_props : TInterface (Name {namespace = "Wp", name = "Properties"})
    IO CUInt

-- | A low-level version of 'GI.Wp.Structs.ObjectInterest.objectInterestMatches'.
-- 
-- 
-- In this version, the object\'s type is directly given in /@objectType@/ and is not inferred from the /@object@/. /@object@/ is only used to check for constraints against GObject properties.
-- /@pwProps@/ and /@pwGlobalProps@/ are used to check constraints against PipeWire object properties and global properties, respectively.
-- /@object@/, /@pwProps@/ and /@pwGlobalProps@/ may be NULL, but in case there are any constraints that require them, the match will fail. As a special case, if /@object@/ is not NULL and is a subclass of WpProxy, then /@pwProps@/ and /@pwGlobalProps@/, if required, will be internally retrieved from /@object@/ by calling 'GI.Wp.Interfaces.PipewireObject.pipewireObjectGetProperties' and 'GI.Wp.Objects.GlobalProxy.globalProxyGetGlobalProperties' respectively.
-- When /@flags@/ contains WP_INTEREST_MATCH_FLAGS_CHECK_ALL, all the constraints are checked and the returned value contains accurate information about which types of constraints have failed to match, if any. When this flag is not present, this function returns after the first failure has been encountered. This means that the returned flags set will contain all but one flag, which will indicate the kind of constraint that failed (more could have failed, but they are not checked...)
objectInterestMatchesFull ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
    ObjectInterest
    -- ^ /@self@/: the object interest
    -> [Wp.Flags.InterestMatchFlags]
    -- ^ /@flags@/: flags to alter the behavior of this function
    -> GType
    -- ^ /@objectType@/: the type to be checked against the interest\'s type
    -> Maybe (a)
    -- ^ /@object@/: the object to be used for checking constraints of type WP_CONSTRAINT_TYPE_G_PROPERTY
    -> Maybe (Wp.Properties.Properties)
    -- ^ /@pwProps@/: the properties to be used for checking constraints of type WP_CONSTRAINT_TYPE_PW_PROPERTY
    -> Maybe (Wp.Properties.Properties)
    -- ^ /@pwGlobalProps@/: the properties to be used for checking constraints of type WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY
    -> m [Wp.Flags.InterestMatch]
    -- ^ __Returns:__ flags that indicate which components of the interest match. WP_INTEREST_MATCH_ALL indicates a fully successful match; any other combination indicates a failure on the component(s) that do not appear on the flag set
objectInterestMatchesFull self flags objectType object pwProps pwGlobalProps = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    let flags' = gflagsToWord flags
    let objectType' = gtypeToCGType objectType
    maybeObject <- case object of
        Nothing -> return FP.nullPtr
        Just jObject -> do
            jObject' <- unsafeManagedPtrCastPtr jObject
            return jObject'
    maybePwProps <- case pwProps of
        Nothing -> return FP.nullPtr
        Just jPwProps -> do
            jPwProps' <- unsafeManagedPtrGetPtr jPwProps
            return jPwProps'
    maybePwGlobalProps <- case pwGlobalProps of
        Nothing -> return FP.nullPtr
        Just jPwGlobalProps -> do
            jPwGlobalProps' <- unsafeManagedPtrGetPtr jPwGlobalProps
            return jPwGlobalProps'
    result <- wp_object_interest_matches_full self' flags' objectType' maybeObject maybePwProps maybePwGlobalProps
    let result' = wordToGFlags result
    touchManagedPtr self
    whenJust object touchManagedPtr
    whenJust pwProps touchManagedPtr
    whenJust pwGlobalProps touchManagedPtr
    return result'

#if defined(ENABLE_OVERLOADING)
data ObjectInterestMatchesFullMethodInfo
instance (signature ~ ([Wp.Flags.InterestMatchFlags] -> GType -> Maybe (a) -> Maybe (Wp.Properties.Properties) -> Maybe (Wp.Properties.Properties) -> m [Wp.Flags.InterestMatch]), MonadIO m, GObject.Object.IsObject a) => O.OverloadedMethod ObjectInterestMatchesFullMethodInfo ObjectInterest signature where
    overloadedMethod = objectInterestMatchesFull

instance O.OverloadedMethodInfo ObjectInterestMatchesFullMethodInfo ObjectInterest where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Structs.ObjectInterest.objectInterestMatchesFull",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Structs-ObjectInterest.html#v:objectInterestMatchesFull"
        })


#endif

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

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

-- | Increases the reference count of an object interest.
objectInterestRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ObjectInterest
    -- ^ /@self@/: the object interest to ref
    -> m ObjectInterest
    -- ^ __Returns:__ /@self@/ with an additional reference count on it
objectInterestRef self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_object_interest_ref self'
    checkUnexpectedReturnNULL "objectInterestRef" result
    result' <- (wrapBoxed ObjectInterest) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data ObjectInterestRefMethodInfo
instance (signature ~ (m ObjectInterest), MonadIO m) => O.OverloadedMethod ObjectInterestRefMethodInfo ObjectInterest signature where
    overloadedMethod = objectInterestRef

instance O.OverloadedMethodInfo ObjectInterestRefMethodInfo ObjectInterest where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Structs.ObjectInterest.objectInterestRef",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Structs-ObjectInterest.html#v:objectInterestRef"
        })


#endif

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

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

-- | Decreases the reference count on /@self@/ and frees it when the ref count reaches zero.
objectInterestUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ObjectInterest
    -- ^ /@self@/: the object interest to unref
    -> m ()
objectInterestUnref self = liftIO $ do
    self' <- B.ManagedPtr.disownBoxed self
    wp_object_interest_unref self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data ObjectInterestUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod ObjectInterestUnrefMethodInfo ObjectInterest signature where
    overloadedMethod = objectInterestUnref

instance O.OverloadedMethodInfo ObjectInterestUnrefMethodInfo ObjectInterest where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Structs.ObjectInterest.objectInterestUnref",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Structs-ObjectInterest.html#v:objectInterestUnref"
        })


#endif

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

foreign import ccall "wp_object_interest_validate" wp_object_interest_validate :: 
    Ptr ObjectInterest ->                   -- self : TInterface (Name {namespace = "Wp", name = "ObjectInterest"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Validates the interest, ensuring that the interest GType is a valid object and that all the constraints have been expressed properly.
-- 
-- 
-- This is called internally when /@self@/ is first used to find a match, so it is not necessary to call it explicitly
objectInterestValidate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ObjectInterest
    -- ^ /@self@/: the object interest to validate
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
objectInterestValidate self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    onException (do
        _ <- propagateGError $ wp_object_interest_validate self'
        touchManagedPtr self
        return ()
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING)
data ObjectInterestValidateMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod ObjectInterestValidateMethodInfo ObjectInterest signature where
    overloadedMethod = objectInterestValidate

instance O.OverloadedMethodInfo ObjectInterestValidateMethodInfo ObjectInterest where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Structs.ObjectInterest.objectInterestValidate",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Structs-ObjectInterest.html#v:objectInterestValidate"
        })


#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveObjectInterestMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveObjectInterestMethod "addConstraint" o = ObjectInterestAddConstraintMethodInfo
    ResolveObjectInterestMethod "findDefinedConstraintValues" o = ObjectInterestFindDefinedConstraintValuesMethodInfo
    ResolveObjectInterestMethod "matches" o = ObjectInterestMatchesMethodInfo
    ResolveObjectInterestMethod "matchesFull" o = ObjectInterestMatchesFullMethodInfo
    ResolveObjectInterestMethod "ref" o = ObjectInterestRefMethodInfo
    ResolveObjectInterestMethod "unref" o = ObjectInterestUnrefMethodInfo
    ResolveObjectInterestMethod "validate" o = ObjectInterestValidateMethodInfo
    ResolveObjectInterestMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#endif