{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- WpProperties is a data structure that contains string key-value pairs, which are used to send\/receive\/attach arbitrary properties to PipeWire objects.
-- This could be thought of as a hash table with strings as both keys and values. However, the reason that this class exists instead of using GHashTable directly is that in reality it wraps the PipeWire native struct spa_dict and struct pw_properties and therefore it can be easily passed to PipeWire function calls that require a struct spa_dict * or a struct pw_properties * as arguments. Or alternatively, it can easily wrap a struct spa_dict * or a struct pw_properties * that was given from the PipeWire API without necessarily doing an expensive copy operation.
-- WpProperties normally wraps a struct pw_properties, unless it was created with 'GI.Wp.Structs.Properties.propertiesNewWrapDict', in which case it wraps a struct spa_dict and it is immutable (you cannot add\/remove\/modify any key-value pair).
-- In most cases, it actually owns the struct pw_properties internally and manages its lifetime. The exception to that rule is when WpProperties is constructed with 'GI.Wp.Structs.Properties.propertiesNewWrap', in which case the ownership of the struct pw_properties remains outside. This must be used with care, as the struct pw_properties may be free\'ed externally.
-- WpProperties is reference-counted with 'GI.Wp.Structs.Properties.propertiesRef' and 'GI.Wp.Structs.Properties.propertiesUnref'.

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

module GI.Wp.Structs.Properties
    ( 

-- * Exported types
    Properties(..)                          ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [add]("GI.Wp.Structs.Properties#g:method:add"), [addFromDict]("GI.Wp.Structs.Properties#g:method:addFromDict"), [addKeysArray]("GI.Wp.Structs.Properties#g:method:addKeysArray"), [clear]("GI.Wp.Structs.Properties#g:method:clear"), [copy]("GI.Wp.Structs.Properties#g:method:copy"), [ensureUniqueOwner]("GI.Wp.Structs.Properties#g:method:ensureUniqueOwner"), [get]("GI.Wp.Structs.Properties#g:method:get"), [matches]("GI.Wp.Structs.Properties#g:method:matches"), [newIterator]("GI.Wp.Structs.Properties#g:method:newIterator"), [peekDict]("GI.Wp.Structs.Properties#g:method:peekDict"), [ref]("GI.Wp.Structs.Properties#g:method:ref"), [set]("GI.Wp.Structs.Properties#g:method:set"), [sort]("GI.Wp.Structs.Properties#g:method:sort"), [toPwProperties]("GI.Wp.Structs.Properties#g:method:toPwProperties"), [unref]("GI.Wp.Structs.Properties#g:method:unref"), [unrefAndTakePwProperties]("GI.Wp.Structs.Properties#g:method:unrefAndTakePwProperties"), [update]("GI.Wp.Structs.Properties#g:method:update"), [updateFromDict]("GI.Wp.Structs.Properties#g:method:updateFromDict"), [updateFromJson]("GI.Wp.Structs.Properties#g:method:updateFromJson"), [updateKeysArray]("GI.Wp.Structs.Properties#g:method:updateKeysArray").
-- 
-- ==== Getters
-- [getCount]("GI.Wp.Structs.Properties#g:method:getCount").
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolvePropertiesMethod                 ,
#endif

-- ** add #method:add#

#if defined(ENABLE_OVERLOADING)
    PropertiesAddMethodInfo                 ,
#endif
    propertiesAdd                           ,


-- ** addFromDict #method:addFromDict#

#if defined(ENABLE_OVERLOADING)
    PropertiesAddFromDictMethodInfo         ,
#endif
    propertiesAddFromDict                   ,


-- ** addKeysArray #method:addKeysArray#

#if defined(ENABLE_OVERLOADING)
    PropertiesAddKeysArrayMethodInfo        ,
#endif
    propertiesAddKeysArray                  ,


-- ** clear #method:clear#

#if defined(ENABLE_OVERLOADING)
    PropertiesClearMethodInfo               ,
#endif
    propertiesClear                         ,


-- ** copy #method:copy#

#if defined(ENABLE_OVERLOADING)
    PropertiesCopyMethodInfo                ,
#endif
    propertiesCopy                          ,


-- ** ensureUniqueOwner #method:ensureUniqueOwner#

#if defined(ENABLE_OVERLOADING)
    PropertiesEnsureUniqueOwnerMethodInfo   ,
#endif
    propertiesEnsureUniqueOwner             ,


-- ** get #method:get#

#if defined(ENABLE_OVERLOADING)
    PropertiesGetMethodInfo                 ,
#endif
    propertiesGet                           ,


-- ** getCount #method:getCount#

#if defined(ENABLE_OVERLOADING)
    PropertiesGetCountMethodInfo            ,
#endif
    propertiesGetCount                      ,


-- ** matches #method:matches#

#if defined(ENABLE_OVERLOADING)
    PropertiesMatchesMethodInfo             ,
#endif
    propertiesMatches                       ,


-- ** newCopy #method:newCopy#

    propertiesNewCopy                       ,


-- ** newCopyDict #method:newCopyDict#

    propertiesNewCopyDict                   ,


-- ** newEmpty #method:newEmpty#

    propertiesNewEmpty                      ,


-- ** newIterator #method:newIterator#

#if defined(ENABLE_OVERLOADING)
    PropertiesNewIteratorMethodInfo         ,
#endif
    propertiesNewIterator                   ,


-- ** newJson #method:newJson#

    propertiesNewJson                       ,


-- ** newString #method:newString#

    propertiesNewString                     ,


-- ** newTake #method:newTake#

    propertiesNewTake                       ,


-- ** newWrap #method:newWrap#

    propertiesNewWrap                       ,


-- ** newWrapDict #method:newWrapDict#

    propertiesNewWrapDict                   ,


-- ** peekDict #method:peekDict#

#if defined(ENABLE_OVERLOADING)
    PropertiesPeekDictMethodInfo            ,
#endif
    propertiesPeekDict                      ,


-- ** ref #method:ref#

#if defined(ENABLE_OVERLOADING)
    PropertiesRefMethodInfo                 ,
#endif
    propertiesRef                           ,


-- ** set #method:set#

#if defined(ENABLE_OVERLOADING)
    PropertiesSetMethodInfo                 ,
#endif
    propertiesSet                           ,


-- ** sort #method:sort#

#if defined(ENABLE_OVERLOADING)
    PropertiesSortMethodInfo                ,
#endif
    propertiesSort                          ,


-- ** toPwProperties #method:toPwProperties#

#if defined(ENABLE_OVERLOADING)
    PropertiesToPwPropertiesMethodInfo      ,
#endif
    propertiesToPwProperties                ,


-- ** unref #method:unref#

#if defined(ENABLE_OVERLOADING)
    PropertiesUnrefMethodInfo               ,
#endif
    propertiesUnref                         ,


-- ** unrefAndTakePwProperties #method:unrefAndTakePwProperties#

#if defined(ENABLE_OVERLOADING)
    PropertiesUnrefAndTakePwPropertiesMethodInfo,
#endif
    propertiesUnrefAndTakePwProperties      ,


-- ** update #method:update#

#if defined(ENABLE_OVERLOADING)
    PropertiesUpdateMethodInfo              ,
#endif
    propertiesUpdate                        ,


-- ** updateFromDict #method:updateFromDict#

#if defined(ENABLE_OVERLOADING)
    PropertiesUpdateFromDictMethodInfo      ,
#endif
    propertiesUpdateFromDict                ,


-- ** updateFromJson #method:updateFromJson#

#if defined(ENABLE_OVERLOADING)
    PropertiesUpdateFromJsonMethodInfo      ,
#endif
    propertiesUpdateFromJson                ,


-- ** updateKeysArray #method:updateKeysArray#

#if defined(ENABLE_OVERLOADING)
    PropertiesUpdateKeysArrayMethodInfo     ,
#endif
    propertiesUpdateKeysArray               ,




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

#else
import {-# SOURCE #-} qualified GI.Wp.Structs.Iterator as Wp.Iterator
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaJson as Wp.SpaJson

#endif

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

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

foreign import ccall "wp_properties_get_type" c_wp_properties_get_type :: 
    IO GType

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

instance B.Types.TypedObject Properties where
    glibType = c_wp_properties_get_type

instance B.Types.GBoxed Properties

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


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

-- method Properties::new_copy
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "props"
--           , argType = TBasicType TPtr
--           , argCType = Just "const pw_properties*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a native pw_properties structure to copy"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Properties" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_new_copy" wp_properties_new_copy :: 
    Ptr () ->                               -- props : TBasicType TPtr
    IO (Ptr Properties)

-- | Constructs a new WpProperties that contains a copy of all the properties contained in the given /@props@/ structure.
propertiesNewCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@props@/: a native pw_properties structure to copy
    -> m Properties
    -- ^ __Returns:__ the newly constructed properties set
propertiesNewCopy props = liftIO $ do
    result <- wp_properties_new_copy props
    checkUnexpectedReturnNULL "propertiesNewCopy" result
    result' <- (wrapBoxed Properties) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Properties::new_copy_dict
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "dict"
--           , argType = TBasicType TPtr
--           , argCType = Just "const spa_dict*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a native spa_dict structure to copy"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Properties" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_new_copy_dict" wp_properties_new_copy_dict :: 
    Ptr () ->                               -- dict : TBasicType TPtr
    IO (Ptr Properties)

-- | Constructs a new WpProperties that contains a copy of all the properties contained in the given /@dict@/ structure.
propertiesNewCopyDict ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@dict@/: a native spa_dict structure to copy
    -> m Properties
    -- ^ __Returns:__ the newly constructed properties set
propertiesNewCopyDict dict = liftIO $ do
    result <- wp_properties_new_copy_dict dict
    checkUnexpectedReturnNULL "propertiesNewCopyDict" result
    result' <- (wrapBoxed Properties) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Properties::new_empty
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Properties" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_new_empty" wp_properties_new_empty :: 
    IO (Ptr Properties)

-- | Creates a new empty properties set.
propertiesNewEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Properties
    -- ^ __Returns:__ the newly constructed properties set
propertiesNewEmpty  = liftIO $ do
    result <- wp_properties_new_empty
    checkUnexpectedReturnNULL "propertiesNewEmpty" result
    result' <- (wrapBoxed Properties) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Properties::new_json
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "json"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaJson" }
--           , argCType = Just "const WpSpaJson*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a JSON object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Properties" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_new_json" wp_properties_new_json :: 
    Ptr Wp.SpaJson.SpaJson ->               -- json : TInterface (Name {namespace = "Wp", name = "SpaJson"})
    IO (Ptr Properties)

-- | Constructs a new properties set that contains the properties that can be parsed from the given JSON object.
propertiesNewJson ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Wp.SpaJson.SpaJson
    -- ^ /@json@/: a JSON object
    -> m Properties
    -- ^ __Returns:__ the newly constructed properties set
propertiesNewJson json = liftIO $ do
    json' <- unsafeManagedPtrGetPtr json
    result <- wp_properties_new_json json'
    checkUnexpectedReturnNULL "propertiesNewJson" result
    result' <- (wrapBoxed Properties) result
    touchManagedPtr json
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Properties::new_string
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a string containing either a whitespace separated list of key=value pairs (ex. \"key1=value1 key2=value2\") or a JSON object (ex. '{\"key1\":\"value1\"}')"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Properties" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_new_string" wp_properties_new_string :: 
    CString ->                              -- str : TBasicType TUTF8
    IO (Ptr Properties)

-- | Constructs a new properties set that contains the properties that can be parsed from the given string.
propertiesNewString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@str@/: a string containing either a whitespace separated list of key=value pairs (ex. \"key1=value1 key2=value2\") or a JSON object (ex. \'{\"key1\":\"value1\"}\')
    -> m Properties
    -- ^ __Returns:__ the newly constructed properties set
propertiesNewString str = liftIO $ do
    str' <- textToCString str
    result <- wp_properties_new_string str'
    checkUnexpectedReturnNULL "propertiesNewString" result
    result' <- (wrapBoxed Properties) result
    freeMem str'
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Properties::new_take
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "props"
--           , argType = TBasicType TPtr
--           , argCType = Just "pw_properties*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a native pw_properties structure to wrap"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Properties" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_new_take" wp_properties_new_take :: 
    Ptr () ->                               -- props : TBasicType TPtr
    IO (Ptr Properties)

-- | Constructs a new WpProperties that wraps the given /@props@/ structure, allowing reading & writing properties on that /@props@/ structure through the WpProperties API.
-- 
-- 
-- In contrast with 'GI.Wp.Structs.Properties.propertiesNewWrap', this function assumes ownership of the /@props@/ structure, so it will try to free /@props@/ when it is destroyed.
propertiesNewTake ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@props@/: a native pw_properties structure to wrap
    -> m Properties
    -- ^ __Returns:__ the newly constructed properties set
propertiesNewTake props = liftIO $ do
    result <- wp_properties_new_take props
    checkUnexpectedReturnNULL "propertiesNewTake" result
    result' <- (wrapBoxed Properties) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Properties::new_wrap
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "props"
--           , argType = TBasicType TPtr
--           , argCType = Just "const pw_properties*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a native pw_properties structure to wrap"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Properties" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_new_wrap" wp_properties_new_wrap :: 
    Ptr () ->                               -- props : TBasicType TPtr
    IO (Ptr Properties)

-- | Constructs a new WpProperties that wraps the given /@props@/ structure, allowing reading properties on that /@props@/ structure through the WpProperties API.
-- 
-- 
-- Care must be taken when using this function, since the returned WpProperties object does not own the /@props@/ structure. Therefore, if the owner decides to free /@props@/, the returned WpProperties will crash when used. In addition, the returned WpProperties object will not try to free /@props@/ when destroyed.
-- Furthermore, note that the returned WpProperties object is immutable. That means that you cannot add or modify any properties on it, unless you make a copy first.
propertiesNewWrap ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@props@/: a native pw_properties structure to wrap
    -> m Properties
    -- ^ __Returns:__ the newly constructed properties set
propertiesNewWrap props = liftIO $ do
    result <- wp_properties_new_wrap props
    checkUnexpectedReturnNULL "propertiesNewWrap" result
    result' <- (wrapBoxed Properties) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Properties::new_wrap_dict
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "dict"
--           , argType = TBasicType TPtr
--           , argCType = Just "const spa_dict*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a native spa_dict structure to wrap"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Properties" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_new_wrap_dict" wp_properties_new_wrap_dict :: 
    Ptr () ->                               -- dict : TBasicType TPtr
    IO (Ptr Properties)

-- | Constructs a new WpProperties that wraps the given /@dict@/ structure, allowing reading properties from that /@dict@/ through the WpProperties API.
-- 
-- 
-- Note that the returned object does not own the /@dict@/, so care must be taken not to free it externally while this WpProperties object is alive.
-- In addition, note that the returned WpProperties object is immutable. That means that you cannot add or modify any properties on it, since there is no defined method for modifying a struct spa_dict. If you need to change this properties set later, you should make a copy with 'GI.Wp.Structs.Properties.propertiesCopy'.
propertiesNewWrapDict ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@dict@/: a native spa_dict structure to wrap
    -> m Properties
    -- ^ __Returns:__ the newly constructed properties set
propertiesNewWrapDict dict = liftIO $ do
    result <- wp_properties_new_wrap_dict dict
    checkUnexpectedReturnNULL "propertiesNewWrapDict" result
    result' <- (wrapBoxed Properties) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Properties::add
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a properties set that contains properties to add"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_add" wp_properties_add :: 
    Ptr Properties ->                       -- self : TInterface (Name {namespace = "Wp", name = "Properties"})
    Ptr Properties ->                       -- props : TInterface (Name {namespace = "Wp", name = "Properties"})
    IO Int32

-- | Adds new properties in /@self@/, using the given /@props@/ as a source.
-- 
-- 
-- Properties (keys) from /@props@/ that are already contained in /@self@/ are not modified, unlike what happens with 'GI.Wp.Structs.Properties.propertiesUpdate'. Properties in /@self@/ that are not contained in /@props@/ are left untouched.
propertiesAdd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> Properties
    -- ^ /@props@/: a properties set that contains properties to add
    -> m Int32
    -- ^ __Returns:__ the number of properties that were changed
propertiesAdd self props = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    props' <- unsafeManagedPtrGetPtr props
    result <- wp_properties_add self' props'
    touchManagedPtr self
    touchManagedPtr props
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesAddMethodInfo
instance (signature ~ (Properties -> m Int32), MonadIO m) => O.OverloadedMethod PropertiesAddMethodInfo Properties signature where
    overloadedMethod = propertiesAdd

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


#endif

-- method Properties::add_from_dict
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dict"
--           , argType = TBasicType TPtr
--           , argCType = Just "const spa_dict*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a spa_dict that contains properties to add"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_add_from_dict" wp_properties_add_from_dict :: 
    Ptr Properties ->                       -- self : TInterface (Name {namespace = "Wp", name = "Properties"})
    Ptr () ->                               -- dict : TBasicType TPtr
    IO Int32

-- | Adds new properties in /@self@/, using the given /@dict@/ as a source.
-- 
-- 
-- Properties (keys) from /@dict@/ that are already contained in /@self@/ are not modified, unlike what happens with 'GI.Wp.Structs.Properties.propertiesUpdateFromDict'. Properties in /@self@/ that are not contained in /@dict@/ are left untouched.
propertiesAddFromDict ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> Ptr ()
    -- ^ /@dict@/: a spa_dict that contains properties to add
    -> m Int32
    -- ^ __Returns:__ the number of properties that were changed
propertiesAddFromDict self dict = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_properties_add_from_dict self' dict
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesAddFromDictMethodInfo
instance (signature ~ (Ptr () -> m Int32), MonadIO m) => O.OverloadedMethod PropertiesAddFromDictMethodInfo Properties signature where
    overloadedMethod = propertiesAddFromDict

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


#endif

-- method Properties::add_keys_array
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a properties set that contains properties to add"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "keys"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , argCType = Just "const gchar**"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the properties to add"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_add_keys_array" wp_properties_add_keys_array :: 
    Ptr Properties ->                       -- self : TInterface (Name {namespace = "Wp", name = "Properties"})
    Ptr Properties ->                       -- props : TInterface (Name {namespace = "Wp", name = "Properties"})
    Ptr CString ->                          -- keys : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO Int32

-- | The same as @/wp_properties_add_keys()/@, using a NULL-terminated array for specifying the keys to add.
propertiesAddKeysArray ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties set
    -> Properties
    -- ^ /@props@/: a properties set that contains properties to add
    -> [T.Text]
    -- ^ /@keys@/: the properties to add
    -> m Int32
    -- ^ __Returns:__ the number of properties that were changed
propertiesAddKeysArray self props keys = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    props' <- unsafeManagedPtrGetPtr props
    keys' <- packZeroTerminatedUTF8CArray keys
    result <- wp_properties_add_keys_array self' props' keys'
    touchManagedPtr self
    touchManagedPtr props
    mapZeroTerminatedCArray freeMem keys'
    freeMem keys'
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesAddKeysArrayMethodInfo
instance (signature ~ (Properties -> [T.Text] -> m Int32), MonadIO m) => O.OverloadedMethod PropertiesAddKeysArrayMethodInfo Properties signature where
    overloadedMethod = propertiesAddKeysArray

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


#endif

-- method Properties::clear
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

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

-- | Clears all properties from /@self@/.
propertiesClear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> m ()
propertiesClear self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    wp_properties_clear self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data PropertiesClearMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod PropertiesClearMethodInfo Properties signature where
    overloadedMethod = propertiesClear

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


#endif

-- method Properties::copy
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Properties" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_copy" wp_properties_copy :: 
    Ptr Properties ->                       -- other : TInterface (Name {namespace = "Wp", name = "Properties"})
    IO (Ptr Properties)

-- | Constructs and returns a new WpProperties object that contains a copy of all the properties contained in /@other@/.
propertiesCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@other@/: a properties object
    -> m Properties
    -- ^ __Returns:__ the newly constructed properties set
propertiesCopy other = liftIO $ do
    other' <- unsafeManagedPtrGetPtr other
    result <- wp_properties_copy other'
    checkUnexpectedReturnNULL "propertiesCopy" result
    result' <- (wrapBoxed Properties) result
    touchManagedPtr other
    return result'

#if defined(ENABLE_OVERLOADING)
data PropertiesCopyMethodInfo
instance (signature ~ (m Properties), MonadIO m) => O.OverloadedMethod PropertiesCopyMethodInfo Properties signature where
    overloadedMethod = propertiesCopy

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


#endif

-- method Properties::ensure_unique_owner
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Properties" })
-- throws : False
-- Skip return : False

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

-- | Ensures that the given properties set is uniquely owned.
-- 
-- 
-- \"Uniquely owned\" means that:
-- * its reference count is 1
-- * it is not wrapping a native spa_dict or pw_properties object
-- 
-- 
-- If /@self@/ is not uniquely owned already, then it is unrefed and a copy of it is returned instead. You should always consider /@self@/ as unsafe to use after this call and you should use the returned object instead.
propertiesEnsureUniqueOwner ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> m Properties
    -- ^ __Returns:__ the uniquely owned properties object
propertiesEnsureUniqueOwner self = liftIO $ do
    self' <- B.ManagedPtr.disownBoxed self
    result <- wp_properties_ensure_unique_owner self'
    checkUnexpectedReturnNULL "propertiesEnsureUniqueOwner" result
    result' <- (wrapBoxed Properties) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data PropertiesEnsureUniqueOwnerMethodInfo
instance (signature ~ (m Properties), MonadIO m) => O.OverloadedMethod PropertiesEnsureUniqueOwnerMethodInfo Properties signature where
    overloadedMethod = propertiesEnsureUniqueOwner

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


#endif

-- method Properties::get
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a property key" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_get" wp_properties_get :: 
    Ptr Properties ->                       -- self : TInterface (Name {namespace = "Wp", name = "Properties"})
    CString ->                              -- key : TBasicType TUTF8
    IO CString

-- | Looks up a given property value from a key.
propertiesGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> T.Text
    -- ^ /@key@/: a property key
    -> m (Maybe T.Text)
    -- ^ __Returns:__ the value of the property identified with /@key@/, or NULL if this property is not contained in /@self@/
propertiesGet self key = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    key' <- textToCString key
    result <- wp_properties_get self' key'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr self
    freeMem key'
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data PropertiesGetMethodInfo
instance (signature ~ (T.Text -> m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod PropertiesGetMethodInfo Properties signature where
    overloadedMethod = propertiesGet

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


#endif

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

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

-- | Gets the number of properties contained in this object.
-- 
-- /Since: 0.4.10/
propertiesGetCount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> m Word32
    -- ^ __Returns:__ the number of properties contained in this object
propertiesGetCount self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_properties_get_count self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesGetCountMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.OverloadedMethod PropertiesGetCountMethodInfo Properties signature where
    overloadedMethod = propertiesGetCount

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


#endif

-- method Properties::matches
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a set of properties to 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_properties_matches" wp_properties_matches :: 
    Ptr Properties ->                       -- self : TInterface (Name {namespace = "Wp", name = "Properties"})
    Ptr Properties ->                       -- other : TInterface (Name {namespace = "Wp", name = "Properties"})
    IO CInt

-- | Checks if all property values contained in /@other@/ are matching with the values in /@self@/.
-- 
-- 
-- If a property is contained in /@other@/ and not in /@self@/, the result is not matched. If a property is contained in both sets, then the value of the property in /@other@/ is interpreted as a glob-style pattern (using 'GI.GLib.Functions.patternMatchSimple') and the value in /@self@/ is checked to see if it matches with this pattern.
propertiesMatches ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> Properties
    -- ^ /@other@/: a set of properties to match
    -> m Bool
    -- ^ __Returns:__ TRUE if all matches were successful, FALSE if at least one property value did not match
propertiesMatches self other = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    other' <- unsafeManagedPtrGetPtr other
    result <- wp_properties_matches self' other'
    let result' = (/= 0) result
    touchManagedPtr self
    touchManagedPtr other
    return result'

#if defined(ENABLE_OVERLOADING)
data PropertiesMatchesMethodInfo
instance (signature ~ (Properties -> m Bool), MonadIO m) => O.OverloadedMethod PropertiesMatchesMethodInfo Properties signature where
    overloadedMethod = propertiesMatches

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


#endif

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

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

-- | Iterates through all the properties in the properties object.
propertiesNewIterator ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> m Wp.Iterator.Iterator
    -- ^ __Returns:__ an iterator that iterates over the properties. The items in the iterator are of type WpPropertiesItem. Use 'GI.Wp.Structs.PropertiesItem.propertiesItemGetKey' and 'GI.Wp.Structs.PropertiesItem.propertiesItemGetValue' to retrieve their contents.
propertiesNewIterator self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_properties_new_iterator self'
    checkUnexpectedReturnNULL "propertiesNewIterator" result
    result' <- (wrapBoxed Wp.Iterator.Iterator) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data PropertiesNewIteratorMethodInfo
instance (signature ~ (m Wp.Iterator.Iterator), MonadIO m) => O.OverloadedMethod PropertiesNewIteratorMethodInfo Properties signature where
    overloadedMethod = propertiesNewIterator

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


#endif

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

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

-- | Gets the dictionary wrapped by a properties object.
propertiesPeekDict ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> m (Ptr ())
    -- ^ __Returns:__ the internal properties set as a struct spa_dict *
propertiesPeekDict self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_properties_peek_dict self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesPeekDictMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m) => O.OverloadedMethod PropertiesPeekDictMethodInfo Properties signature where
    overloadedMethod = propertiesPeekDict

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


#endif

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

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

-- | /No description available in the introspection data./
propertiesRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -> m Properties
propertiesRef self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_properties_ref self'
    checkUnexpectedReturnNULL "propertiesRef" result
    result' <- (wrapBoxed Properties) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data PropertiesRefMethodInfo
instance (signature ~ (m Properties), MonadIO m) => O.OverloadedMethod PropertiesRefMethodInfo Properties signature where
    overloadedMethod = propertiesRef

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


#endif

-- method Properties::set
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a property key" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a property value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_set" wp_properties_set :: 
    Ptr Properties ->                       -- self : TInterface (Name {namespace = "Wp", name = "Properties"})
    CString ->                              -- key : TBasicType TUTF8
    CString ->                              -- value : TBasicType TUTF8
    IO Int32

-- | Sets the given property /@key@/ - /@value@/ pair on /@self@/.
-- 
-- 
-- If the property already existed, the value is overwritten with the new one.
-- If the /@value@/ is NULL, then the specified property is removed from /@self@/
propertiesSet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> T.Text
    -- ^ /@key@/: a property key
    -> Maybe (T.Text)
    -- ^ /@value@/: a property value
    -> m Int32
    -- ^ __Returns:__ 1 if the property was changed. 0 if nothing was changed because the property already existed with the same value or because the key to remove did not exist.
propertiesSet self key value = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    key' <- textToCString key
    maybeValue <- case value of
        Nothing -> return FP.nullPtr
        Just jValue -> do
            jValue' <- textToCString jValue
            return jValue'
    result <- wp_properties_set self' key' maybeValue
    touchManagedPtr self
    freeMem key'
    freeMem maybeValue
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesSetMethodInfo
instance (signature ~ (T.Text -> Maybe (T.Text) -> m Int32), MonadIO m) => O.OverloadedMethod PropertiesSetMethodInfo Properties signature where
    overloadedMethod = propertiesSet

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


#endif

-- method Properties::sort
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

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

-- | Sorts the keys in alphabetical order.
propertiesSort ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> m ()
propertiesSort self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    wp_properties_sort self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data PropertiesSortMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod PropertiesSortMethodInfo Properties signature where
    overloadedMethod = propertiesSort

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


#endif

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

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

-- | Gets a copy of the properties object as a struct pw_properties.
propertiesToPwProperties ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> m (Ptr ())
    -- ^ __Returns:__ a copy of the properties in /@self@/ as a struct pw_properties
propertiesToPwProperties self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_properties_to_pw_properties self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesToPwPropertiesMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m) => O.OverloadedMethod PropertiesToPwPropertiesMethodInfo Properties signature where
    overloadedMethod = propertiesToPwProperties

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


#endif

-- method Properties::unref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , 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_properties_unref" wp_properties_unref :: 
    Ptr Properties ->                       -- self : TInterface (Name {namespace = "Wp", name = "Properties"})
    IO ()

-- | Decreases the reference count on /@self@/ and frees it when the ref count reaches zero.
propertiesUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> m ()
propertiesUnref self = liftIO $ do
    self' <- B.ManagedPtr.disownBoxed self
    wp_properties_unref self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data PropertiesUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod PropertiesUnrefMethodInfo Properties signature where
    overloadedMethod = propertiesUnref

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


#endif

-- method Properties::unref_and_take_pw_properties
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

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

-- | Similar to 'GI.Wp.Structs.Properties.propertiesToPwProperties', but this method avoids making a copy of the properties by returning the struct pw_properties that is stored internally and then freeing the WpProperties wrapper.
-- 
-- 
-- If /@self@/ is not uniquely owned (see 'GI.Wp.Structs.Properties.propertiesEnsureUniqueOwner'), then this method does make a copy and is the same as 'GI.Wp.Structs.Properties.propertiesToPwProperties', performance-wise.
propertiesUnrefAndTakePwProperties ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> m (Ptr ())
    -- ^ __Returns:__ the properties in /@self@/ as a struct pw_properties
propertiesUnrefAndTakePwProperties self = liftIO $ do
    self' <- B.ManagedPtr.disownBoxed self
    result <- wp_properties_unref_and_take_pw_properties self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesUnrefAndTakePwPropertiesMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m) => O.OverloadedMethod PropertiesUnrefAndTakePwPropertiesMethodInfo Properties signature where
    overloadedMethod = propertiesUnrefAndTakePwProperties

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


#endif

-- method Properties::update
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a properties set that contains properties to update"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_update" wp_properties_update :: 
    Ptr Properties ->                       -- self : TInterface (Name {namespace = "Wp", name = "Properties"})
    Ptr Properties ->                       -- props : TInterface (Name {namespace = "Wp", name = "Properties"})
    IO Int32

-- | Updates (adds new or modifies existing) properties in /@self@/, using the given /@props@/ as a source.
-- 
-- 
-- Any properties that are not contained in /@props@/ are left untouched.
propertiesUpdate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> Properties
    -- ^ /@props@/: a properties set that contains properties to update
    -> m Int32
    -- ^ __Returns:__ the number of properties that were changed
propertiesUpdate self props = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    props' <- unsafeManagedPtrGetPtr props
    result <- wp_properties_update self' props'
    touchManagedPtr self
    touchManagedPtr props
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesUpdateMethodInfo
instance (signature ~ (Properties -> m Int32), MonadIO m) => O.OverloadedMethod PropertiesUpdateMethodInfo Properties signature where
    overloadedMethod = propertiesUpdate

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


#endif

-- method Properties::update_from_dict
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dict"
--           , argType = TBasicType TPtr
--           , argCType = Just "const spa_dict*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a spa_dict that contains properties to update"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_update_from_dict" wp_properties_update_from_dict :: 
    Ptr Properties ->                       -- self : TInterface (Name {namespace = "Wp", name = "Properties"})
    Ptr () ->                               -- dict : TBasicType TPtr
    IO Int32

-- | Updates (adds new or modifies existing) properties in /@self@/, using the given /@dict@/ as a source.
-- 
-- 
-- Any properties that are not contained in /@dict@/ are left untouched.
propertiesUpdateFromDict ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> Ptr ()
    -- ^ /@dict@/: a spa_dict that contains properties to update
    -> m Int32
    -- ^ __Returns:__ the number of properties that were changed
propertiesUpdateFromDict self dict = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_properties_update_from_dict self' dict
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesUpdateFromDictMethodInfo
instance (signature ~ (Ptr () -> m Int32), MonadIO m) => O.OverloadedMethod PropertiesUpdateFromDictMethodInfo Properties signature where
    overloadedMethod = propertiesUpdateFromDict

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


#endif

-- method Properties::update_from_json
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "json"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaJson" }
--           , argCType = Just "const WpSpaJson*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a JSON object that contains properties to update"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_update_from_json" wp_properties_update_from_json :: 
    Ptr Properties ->                       -- self : TInterface (Name {namespace = "Wp", name = "Properties"})
    Ptr Wp.SpaJson.SpaJson ->               -- json : TInterface (Name {namespace = "Wp", name = "SpaJson"})
    IO Int32

-- | Updates (adds new or modifies existing) properties in /@self@/, using the given /@json@/ as a source.
-- 
-- 
-- Any properties that are not contained in /@json@/ are left untouched.
propertiesUpdateFromJson ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties object
    -> Wp.SpaJson.SpaJson
    -- ^ /@json@/: a JSON object that contains properties to update
    -> m Int32
    -- ^ __Returns:__ the number of properties that were changed
propertiesUpdateFromJson self json = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    json' <- unsafeManagedPtrGetPtr json
    result <- wp_properties_update_from_json self' json'
    touchManagedPtr self
    touchManagedPtr json
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesUpdateFromJsonMethodInfo
instance (signature ~ (Wp.SpaJson.SpaJson -> m Int32), MonadIO m) => O.OverloadedMethod PropertiesUpdateFromJsonMethodInfo Properties signature where
    overloadedMethod = propertiesUpdateFromJson

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


#endif

-- method Properties::update_keys_array
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a properties set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a properties set that contains properties to update"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "keys"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , argCType = Just "const gchar**"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the properties to update"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wp_properties_update_keys_array" wp_properties_update_keys_array :: 
    Ptr Properties ->                       -- self : TInterface (Name {namespace = "Wp", name = "Properties"})
    Ptr Properties ->                       -- props : TInterface (Name {namespace = "Wp", name = "Properties"})
    Ptr CString ->                          -- keys : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO Int32

-- | The same as @/wp_properties_update_keys()/@, using a NULL-terminated array for specifying the keys to update.
propertiesUpdateKeysArray ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Properties
    -- ^ /@self@/: a properties set
    -> Properties
    -- ^ /@props@/: a properties set that contains properties to update
    -> [T.Text]
    -- ^ /@keys@/: the properties to update
    -> m Int32
    -- ^ __Returns:__ the number of properties that were changed
propertiesUpdateKeysArray self props keys = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    props' <- unsafeManagedPtrGetPtr props
    keys' <- packZeroTerminatedUTF8CArray keys
    result <- wp_properties_update_keys_array self' props' keys'
    touchManagedPtr self
    touchManagedPtr props
    mapZeroTerminatedCArray freeMem keys'
    freeMem keys'
    return result

#if defined(ENABLE_OVERLOADING)
data PropertiesUpdateKeysArrayMethodInfo
instance (signature ~ (Properties -> [T.Text] -> m Int32), MonadIO m) => O.OverloadedMethod PropertiesUpdateKeysArrayMethodInfo Properties signature where
    overloadedMethod = propertiesUpdateKeysArray

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


#endif

#if defined(ENABLE_OVERLOADING)
type family ResolvePropertiesMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolvePropertiesMethod "add" o = PropertiesAddMethodInfo
    ResolvePropertiesMethod "addFromDict" o = PropertiesAddFromDictMethodInfo
    ResolvePropertiesMethod "addKeysArray" o = PropertiesAddKeysArrayMethodInfo
    ResolvePropertiesMethod "clear" o = PropertiesClearMethodInfo
    ResolvePropertiesMethod "copy" o = PropertiesCopyMethodInfo
    ResolvePropertiesMethod "ensureUniqueOwner" o = PropertiesEnsureUniqueOwnerMethodInfo
    ResolvePropertiesMethod "get" o = PropertiesGetMethodInfo
    ResolvePropertiesMethod "matches" o = PropertiesMatchesMethodInfo
    ResolvePropertiesMethod "newIterator" o = PropertiesNewIteratorMethodInfo
    ResolvePropertiesMethod "peekDict" o = PropertiesPeekDictMethodInfo
    ResolvePropertiesMethod "ref" o = PropertiesRefMethodInfo
    ResolvePropertiesMethod "set" o = PropertiesSetMethodInfo
    ResolvePropertiesMethod "sort" o = PropertiesSortMethodInfo
    ResolvePropertiesMethod "toPwProperties" o = PropertiesToPwPropertiesMethodInfo
    ResolvePropertiesMethod "unref" o = PropertiesUnrefMethodInfo
    ResolvePropertiesMethod "unrefAndTakePwProperties" o = PropertiesUnrefAndTakePwPropertiesMethodInfo
    ResolvePropertiesMethod "update" o = PropertiesUpdateMethodInfo
    ResolvePropertiesMethod "updateFromDict" o = PropertiesUpdateFromDictMethodInfo
    ResolvePropertiesMethod "updateFromJson" o = PropertiesUpdateFromJsonMethodInfo
    ResolvePropertiesMethod "updateKeysArray" o = PropertiesUpdateKeysArrayMethodInfo
    ResolvePropertiesMethod "getCount" o = PropertiesGetCountMethodInfo
    ResolvePropertiesMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#endif


