{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- WpSettings loads and parses the \"sm-settings\" (default value) metadata, which contains wireplumber settings, and provides APIs to its clients (modules, lua scripts etc) to access them.
-- Being a WpObject subclass, the settings inherits WpObject\'s activation system.

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

module GI.Wp.Objects.Settings
    ( 

-- * Exported types
    Settings(..)                            ,
    IsSettings                              ,
    toSettings                              ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [abortActivation]("GI.Wp.Objects.Object#g:method:abortActivation"), [activate]("GI.Wp.Objects.Object#g:method:activate"), [activateClosure]("GI.Wp.Objects.Object#g:method:activateClosure"), [activateFinish]("GI.Wp.Objects.Object#g:method:activateFinish"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [deactivate]("GI.Wp.Objects.Object#g:method:deactivate"), [delete]("GI.Wp.Objects.Settings#g:method:delete"), [deleteAll]("GI.Wp.Objects.Settings#g:method:deleteAll"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [get]("GI.Wp.Objects.Settings#g:method:get"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [newIterator]("GI.Wp.Objects.Settings#g:method:newIterator"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [reset]("GI.Wp.Objects.Settings#g:method:reset"), [resetAll]("GI.Wp.Objects.Settings#g:method:resetAll"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [save]("GI.Wp.Objects.Settings#g:method:save"), [saveAll]("GI.Wp.Objects.Settings#g:method:saveAll"), [set]("GI.Wp.Objects.Settings#g:method:set"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [subscribe]("GI.Wp.Objects.Settings#g:method:subscribe"), [subscribeClosure]("GI.Wp.Objects.Settings#g:method:subscribeClosure"), [testActiveFeatures]("GI.Wp.Objects.Object#g:method:testActiveFeatures"), [testSupportedFeatures]("GI.Wp.Objects.Object#g:method:testSupportedFeatures"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [unsubscribe]("GI.Wp.Objects.Settings#g:method:unsubscribe"), [updateFeatures]("GI.Wp.Objects.Object#g:method:updateFeatures"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getActiveFeatures]("GI.Wp.Objects.Object#g:method:getActiveFeatures"), [getCore]("GI.Wp.Objects.Object#g:method:getCore"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getId]("GI.Wp.Objects.Object#g:method:getId"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getSaved]("GI.Wp.Objects.Settings#g:method:getSaved"), [getSpec]("GI.Wp.Objects.Settings#g:method:getSpec"), [getSupportedFeatures]("GI.Wp.Objects.Object#g:method:getSupportedFeatures").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveSettingsMethod                   ,
#endif

-- ** delete #method:delete#

#if defined(ENABLE_OVERLOADING)
    SettingsDeleteMethodInfo                ,
#endif
    settingsDelete                          ,


-- ** deleteAll #method:deleteAll#

#if defined(ENABLE_OVERLOADING)
    SettingsDeleteAllMethodInfo             ,
#endif
    settingsDeleteAll                       ,


-- ** find #method:find#

    settingsFind                            ,


-- ** get #method:get#

#if defined(ENABLE_OVERLOADING)
    SettingsGetMethodInfo                   ,
#endif
    settingsGet                             ,


-- ** getSaved #method:getSaved#

#if defined(ENABLE_OVERLOADING)
    SettingsGetSavedMethodInfo              ,
#endif
    settingsGetSaved                        ,


-- ** getSpec #method:getSpec#

#if defined(ENABLE_OVERLOADING)
    SettingsGetSpecMethodInfo               ,
#endif
    settingsGetSpec                         ,


-- ** new #method:new#

    settingsNew                             ,


-- ** newIterator #method:newIterator#

#if defined(ENABLE_OVERLOADING)
    SettingsNewIteratorMethodInfo           ,
#endif
    settingsNewIterator                     ,


-- ** reset #method:reset#

#if defined(ENABLE_OVERLOADING)
    SettingsResetMethodInfo                 ,
#endif
    settingsReset                           ,


-- ** resetAll #method:resetAll#

#if defined(ENABLE_OVERLOADING)
    SettingsResetAllMethodInfo              ,
#endif
    settingsResetAll                        ,


-- ** save #method:save#

#if defined(ENABLE_OVERLOADING)
    SettingsSaveMethodInfo                  ,
#endif
    settingsSave                            ,


-- ** saveAll #method:saveAll#

#if defined(ENABLE_OVERLOADING)
    SettingsSaveAllMethodInfo               ,
#endif
    settingsSaveAll                         ,


-- ** set #method:set#

#if defined(ENABLE_OVERLOADING)
    SettingsSetMethodInfo                   ,
#endif
    settingsSet                             ,


-- ** subscribe #method:subscribe#

#if defined(ENABLE_OVERLOADING)
    SettingsSubscribeMethodInfo             ,
#endif
    settingsSubscribe                       ,


-- ** subscribeClosure #method:subscribeClosure#

#if defined(ENABLE_OVERLOADING)
    SettingsSubscribeClosureMethodInfo      ,
#endif
    settingsSubscribeClosure                ,


-- ** unsubscribe #method:unsubscribe#

#if defined(ENABLE_OVERLOADING)
    SettingsUnsubscribeMethodInfo           ,
#endif
    settingsUnsubscribe                     ,




 -- * Properties


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

#if defined(ENABLE_OVERLOADING)
    SettingsMetadataNamePropertyInfo        ,
#endif
    constructSettingsMetadataName           ,
    getSettingsMetadataName                 ,
#if defined(ENABLE_OVERLOADING)
    settingsMetadataName                    ,
#endif




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.MainContext as GLib.MainContext
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Wp.Callbacks as Wp.Callbacks
import {-# SOURCE #-} qualified GI.Wp.Enums as Wp.Enums
import {-# SOURCE #-} qualified GI.Wp.Flags as Wp.Flags
import {-# SOURCE #-} qualified GI.Wp.Objects.Conf as Wp.Conf
import {-# SOURCE #-} qualified GI.Wp.Objects.Core as Wp.Core
import {-# SOURCE #-} qualified GI.Wp.Objects.Object as Wp.Object
import {-# SOURCE #-} qualified GI.Wp.Objects.ObjectManager as Wp.ObjectManager
import {-# SOURCE #-} qualified GI.Wp.Structs.Iterator as Wp.Iterator
import {-# SOURCE #-} qualified GI.Wp.Structs.IteratorMethods as Wp.IteratorMethods
import {-# SOURCE #-} qualified GI.Wp.Structs.ObjectInterest as Wp.ObjectInterest
import {-# SOURCE #-} qualified GI.Wp.Structs.Properties as Wp.Properties
import {-# SOURCE #-} qualified GI.Wp.Structs.SettingsSpec as Wp.SettingsSpec
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaJson as Wp.SpaJson

#else
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Wp.Callbacks as Wp.Callbacks
import {-# SOURCE #-} qualified GI.Wp.Objects.Core as Wp.Core
import {-# SOURCE #-} qualified GI.Wp.Objects.Object as Wp.Object
import {-# SOURCE #-} qualified GI.Wp.Structs.Iterator as Wp.Iterator
import {-# SOURCE #-} qualified GI.Wp.Structs.SettingsSpec as Wp.SettingsSpec
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaJson as Wp.SpaJson

#endif

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

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

foreign import ccall "wp_settings_get_type"
    c_wp_settings_get_type :: IO B.Types.GType

instance B.Types.TypedObject Settings where
    glibType = c_wp_settings_get_type

instance B.Types.GObject Settings

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

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

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

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

#if defined(ENABLE_OVERLOADING)
type family ResolveSettingsMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveSettingsMethod "abortActivation" o = Wp.Object.ObjectAbortActivationMethodInfo
    ResolveSettingsMethod "activate" o = Wp.Object.ObjectActivateMethodInfo
    ResolveSettingsMethod "activateClosure" o = Wp.Object.ObjectActivateClosureMethodInfo
    ResolveSettingsMethod "activateFinish" o = Wp.Object.ObjectActivateFinishMethodInfo
    ResolveSettingsMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSettingsMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSettingsMethod "deactivate" o = Wp.Object.ObjectDeactivateMethodInfo
    ResolveSettingsMethod "delete" o = SettingsDeleteMethodInfo
    ResolveSettingsMethod "deleteAll" o = SettingsDeleteAllMethodInfo
    ResolveSettingsMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSettingsMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSettingsMethod "get" o = SettingsGetMethodInfo
    ResolveSettingsMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveSettingsMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSettingsMethod "newIterator" o = SettingsNewIteratorMethodInfo
    ResolveSettingsMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSettingsMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSettingsMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSettingsMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSettingsMethod "reset" o = SettingsResetMethodInfo
    ResolveSettingsMethod "resetAll" o = SettingsResetAllMethodInfo
    ResolveSettingsMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSettingsMethod "save" o = SettingsSaveMethodInfo
    ResolveSettingsMethod "saveAll" o = SettingsSaveAllMethodInfo
    ResolveSettingsMethod "set" o = SettingsSetMethodInfo
    ResolveSettingsMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSettingsMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSettingsMethod "subscribe" o = SettingsSubscribeMethodInfo
    ResolveSettingsMethod "subscribeClosure" o = SettingsSubscribeClosureMethodInfo
    ResolveSettingsMethod "testActiveFeatures" o = Wp.Object.ObjectTestActiveFeaturesMethodInfo
    ResolveSettingsMethod "testSupportedFeatures" o = Wp.Object.ObjectTestSupportedFeaturesMethodInfo
    ResolveSettingsMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSettingsMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSettingsMethod "unsubscribe" o = SettingsUnsubscribeMethodInfo
    ResolveSettingsMethod "updateFeatures" o = Wp.Object.ObjectUpdateFeaturesMethodInfo
    ResolveSettingsMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSettingsMethod "getActiveFeatures" o = Wp.Object.ObjectGetActiveFeaturesMethodInfo
    ResolveSettingsMethod "getCore" o = Wp.Object.ObjectGetCoreMethodInfo
    ResolveSettingsMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSettingsMethod "getId" o = Wp.Object.ObjectGetIdMethodInfo
    ResolveSettingsMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSettingsMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSettingsMethod "getSaved" o = SettingsGetSavedMethodInfo
    ResolveSettingsMethod "getSpec" o = SettingsGetSpecMethodInfo
    ResolveSettingsMethod "getSupportedFeatures" o = Wp.Object.ObjectGetSupportedFeaturesMethodInfo
    ResolveSettingsMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSettingsMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveSettingsMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSettingsMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#endif

-- VVV Prop "metadata-name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@metadata-name@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' settings #metadataName
-- @
getSettingsMetadataName :: (MonadIO m, IsSettings o) => o -> m (Maybe T.Text)
getSettingsMetadataName obj = MIO.liftIO $ B.Properties.getObjectPropertyString obj "metadata-name"

-- | Construct a t'GValueConstruct' with valid value for the “@metadata-name@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSettingsMetadataName :: (IsSettings o, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructSettingsMetadataName val = MIO.liftIO $ do
    MIO.liftIO $ B.Properties.constructObjectPropertyString "metadata-name" (P.Just val)

#if defined(ENABLE_OVERLOADING)
data SettingsMetadataNamePropertyInfo
instance AttrInfo SettingsMetadataNamePropertyInfo where
    type AttrAllowedOps SettingsMetadataNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint SettingsMetadataNamePropertyInfo = IsSettings
    type AttrSetTypeConstraint SettingsMetadataNamePropertyInfo = (~) T.Text
    type AttrTransferTypeConstraint SettingsMetadataNamePropertyInfo = (~) T.Text
    type AttrTransferType SettingsMetadataNamePropertyInfo = T.Text
    type AttrGetType SettingsMetadataNamePropertyInfo = (Maybe T.Text)
    type AttrLabel SettingsMetadataNamePropertyInfo = "metadata-name"
    type AttrOrigin SettingsMetadataNamePropertyInfo = Settings
    attrGet = getSettingsMetadataName
    attrSet = undefined
    attrPut = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructSettingsMetadataName
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.Settings.metadataName"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-Settings.html#g:attr:metadataName"
        })
#endif

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

#if defined(ENABLE_OVERLOADING)
settingsMetadataName :: AttrLabelProxy "metadataName"
settingsMetadataName = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Settings = SettingsSignalList
type SettingsSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method Settings::new
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "core"
--           , argType = TInterface Name { namespace = "Wp" , name = "Core" }
--           , argCType = Just "WpCore*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the WpCore" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "metadata_name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the name of the metadata object to associate with the settings object; NULL means the default \"sm-settings\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Settings" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_settings_new" wp_settings_new :: 
    Ptr Wp.Core.Core ->                     -- core : TInterface (Name {namespace = "Wp", name = "Core"})
    CString ->                              -- metadata_name : TBasicType TUTF8
    IO (Ptr Settings)

-- | Creates a new WpSettings object.
settingsNew ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.Core.IsCore a) =>
    a
    -- ^ /@core@/: the WpCore
    -> Maybe (T.Text)
    -- ^ /@metadataName@/: the name of the metadata object to associate with the settings object; NULL means the default \"sm-settings\"
    -> m Settings
    -- ^ __Returns:__ a new WpSettings object
settingsNew core metadataName = liftIO $ do
    core' <- unsafeManagedPtrCastPtr core
    maybeMetadataName <- case metadataName of
        Nothing -> return FP.nullPtr
        Just jMetadataName -> do
            jMetadataName' <- textToCString jMetadataName
            return jMetadataName'
    result <- wp_settings_new core' maybeMetadataName
    checkUnexpectedReturnNULL "settingsNew" result
    result' <- (wrapObject Settings) result
    touchManagedPtr core
    freeMem maybeMetadataName
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Settings::delete
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the saved setting to be deleted"
--                 , 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_settings_delete" wp_settings_delete :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    CString ->                              -- name : TBasicType TUTF8
    IO CInt

-- | Deletes a saved setting to not make it persistent after reboot.
settingsDelete ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> T.Text
    -- ^ /@name@/: the name of the saved setting to be deleted
    -> m Bool
    -- ^ __Returns:__ TRUE if the setting could be deleted, FALSE otherwise
settingsDelete self name = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    name' <- textToCString name
    result <- wp_settings_delete self' name'
    let result' = (/= 0) result
    touchManagedPtr self
    freeMem name'
    return result'

#if defined(ENABLE_OVERLOADING)
data SettingsDeleteMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsDeleteMethodInfo a signature where
    overloadedMethod = settingsDelete

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


#endif

-- method Settings::delete_all
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings 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_settings_delete_all" wp_settings_delete_all :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    IO ()

-- | Deletes all saved setting to not make them persistent after reboot.
settingsDeleteAll ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> m ()
settingsDeleteAll self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    wp_settings_delete_all self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SettingsDeleteAllMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsDeleteAllMethodInfo a signature where
    overloadedMethod = settingsDeleteAll

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


#endif

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

foreign import ccall "wp_settings_get" wp_settings_get :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Wp.SpaJson.SpaJson)

-- | Gets the WpSpaJson value of a setting.
settingsGet ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> T.Text
    -- ^ /@name@/: the name of the setting
    -> m (Maybe Wp.SpaJson.SpaJson)
    -- ^ __Returns:__ The WpSpaJson value of the setting, or NULL if the setting does not exist
settingsGet self name = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    name' <- textToCString name
    result <- wp_settings_get self' name'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Wp.SpaJson.SpaJson) result'
        return result''
    touchManagedPtr self
    freeMem name'
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data SettingsGetMethodInfo
instance (signature ~ (T.Text -> m (Maybe Wp.SpaJson.SpaJson)), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsGetMethodInfo a signature where
    overloadedMethod = settingsGet

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


#endif

-- method Settings::get_saved
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the setting"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "SpaJson" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_settings_get_saved" wp_settings_get_saved :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Wp.SpaJson.SpaJson)

-- | Gets the WpSpaJson saved value of a setting.
settingsGetSaved ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> T.Text
    -- ^ /@name@/: the name of the setting
    -> m (Maybe Wp.SpaJson.SpaJson)
    -- ^ __Returns:__ The WpSpaJson saved value of the setting, or NULL if the setting does not exist
settingsGetSaved self name = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    name' <- textToCString name
    result <- wp_settings_get_saved self' name'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Wp.SpaJson.SpaJson) result'
        return result''
    touchManagedPtr self
    freeMem name'
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data SettingsGetSavedMethodInfo
instance (signature ~ (T.Text -> m (Maybe Wp.SpaJson.SpaJson)), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsGetSavedMethodInfo a signature where
    overloadedMethod = settingsGetSaved

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


#endif

-- method Settings::get_spec
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the setting"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "SettingsSpec" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_settings_get_spec" wp_settings_get_spec :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Wp.SettingsSpec.SettingsSpec)

-- | Gets the specification of a setting.
settingsGetSpec ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> T.Text
    -- ^ /@name@/: the name of the setting
    -> m (Maybe Wp.SettingsSpec.SettingsSpec)
    -- ^ __Returns:__ the specification of the setting
settingsGetSpec self name = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    name' <- textToCString name
    result <- wp_settings_get_spec self' name'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Wp.SettingsSpec.SettingsSpec) result'
        return result''
    touchManagedPtr self
    freeMem name'
    return maybeResult

#if defined(ENABLE_OVERLOADING)
data SettingsGetSpecMethodInfo
instance (signature ~ (T.Text -> m (Maybe Wp.SettingsSpec.SettingsSpec)), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsGetSpecMethodInfo a signature where
    overloadedMethod = settingsGetSpec

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


#endif

-- method Settings::new_iterator
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings 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_settings_new_iterator" wp_settings_new_iterator :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    IO (Ptr Wp.Iterator.Iterator)

-- | Iterates over settings.
settingsNewIterator ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> m Wp.Iterator.Iterator
    -- ^ __Returns:__ an iterator that iterates over the settings.
settingsNewIterator self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_settings_new_iterator self'
    checkUnexpectedReturnNULL "settingsNewIterator" result
    result' <- (wrapBoxed Wp.Iterator.Iterator) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SettingsNewIteratorMethodInfo
instance (signature ~ (m Wp.Iterator.Iterator), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsNewIteratorMethodInfo a signature where
    overloadedMethod = settingsNewIterator

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


#endif

-- method Settings::reset
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the setting to reset"
--                 , 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_settings_reset" wp_settings_reset :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    CString ->                              -- name : TBasicType TUTF8
    IO CInt

-- | Resets the setting to its default value.
settingsReset ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> T.Text
    -- ^ /@name@/: the name of the setting to reset
    -> m Bool
    -- ^ __Returns:__ TRUE if the setting could be reset, FALSE otherwise
settingsReset self name = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    name' <- textToCString name
    result <- wp_settings_reset self' name'
    let result' = (/= 0) result
    touchManagedPtr self
    freeMem name'
    return result'

#if defined(ENABLE_OVERLOADING)
data SettingsResetMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsResetMethodInfo a signature where
    overloadedMethod = settingsReset

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


#endif

-- method Settings::reset_all
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings 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_settings_reset_all" wp_settings_reset_all :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    IO ()

-- | Resets all the settings to their default value.
settingsResetAll ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> m ()
settingsResetAll self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    wp_settings_reset_all self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SettingsResetAllMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsResetAllMethodInfo a signature where
    overloadedMethod = settingsResetAll

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


#endif

-- method Settings::save
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the setting to be saved"
--                 , 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_settings_save" wp_settings_save :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    CString ->                              -- name : TBasicType TUTF8
    IO CInt

-- | Saves a setting to make it persistent after reboot.
settingsSave ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> T.Text
    -- ^ /@name@/: the name of the setting to be saved
    -> m Bool
    -- ^ __Returns:__ TRUE if the setting could be saved, FALSE otherwise
settingsSave self name = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    name' <- textToCString name
    result <- wp_settings_save self' name'
    let result' = (/= 0) result
    touchManagedPtr self
    freeMem name'
    return result'

#if defined(ENABLE_OVERLOADING)
data SettingsSaveMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsSaveMethodInfo a signature where
    overloadedMethod = settingsSave

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


#endif

-- method Settings::save_all
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings 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_settings_save_all" wp_settings_save_all :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    IO ()

-- | Saves all the settings to make them persistent after reboot.
settingsSaveAll ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> m ()
settingsSaveAll self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    wp_settings_save_all self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SettingsSaveAllMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsSaveAllMethodInfo a signature where
    overloadedMethod = settingsSaveAll

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


#endif

-- method Settings::set
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the setting"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaJson" }
--           , argCType = Just "WpSpaJson*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the JSON value of the setting"
--                 , 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_settings_set" wp_settings_set :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    CString ->                              -- name : TBasicType TUTF8
    Ptr Wp.SpaJson.SpaJson ->               -- value : TInterface (Name {namespace = "Wp", name = "SpaJson"})
    IO CInt

-- | Sets a new setting value.
settingsSet ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> T.Text
    -- ^ /@name@/: the name of the setting
    -> Wp.SpaJson.SpaJson
    -- ^ /@value@/: the JSON value of the setting
    -> m Bool
    -- ^ __Returns:__ TRUE if the setting could be set, FALSE otherwise
settingsSet self name value = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    name' <- textToCString name
    value' <- unsafeManagedPtrGetPtr value
    result <- wp_settings_set self' name' value'
    let result' = (/= 0) result
    touchManagedPtr self
    touchManagedPtr value
    freeMem name'
    return result'

#if defined(ENABLE_OVERLOADING)
data SettingsSetMethodInfo
instance (signature ~ (T.Text -> Wp.SpaJson.SpaJson -> m Bool), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsSetMethodInfo a signature where
    overloadedMethod = settingsSet

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


#endif

-- method Settings::subscribe
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pattern"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "name of the pattern to match the settings with"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface
--                 Name { namespace = "Wp" , name = "SettingsChangedCallback" }
--           , argCType = Just "WpSettingsChangedCallback"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the callback triggered when the settings change."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data to pass to @callback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUIntPtr)
-- throws : False
-- Skip return : False

foreign import ccall "wp_settings_subscribe" wp_settings_subscribe :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    CString ->                              -- pattern : TBasicType TUTF8
    FunPtr Wp.Callbacks.C_SettingsChangedCallback -> -- callback : TInterface (Name {namespace = "Wp", name = "SettingsChangedCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO CUIntPtr

-- | Subscribes callback for a given setting pattern(a glob-style pattern matched using g_pattern_match_simple), this allows clients to look for any changes made in settings through metadata.
settingsSubscribe ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> T.Text
    -- ^ /@pattern@/: name of the pattern to match the settings with
    -> Wp.Callbacks.SettingsChangedCallback
    -- ^ /@callback@/: the callback triggered when the settings change.
    -> m CUIntPtr
    -- ^ __Returns:__ the subscription ID (always greater than 0 for successful subscriptions)
settingsSubscribe self pattern callback = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    pattern' <- textToCString pattern
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Wp.Callbacks.C_SettingsChangedCallback))
    callback' <- Wp.Callbacks.mk_SettingsChangedCallback (Wp.Callbacks.wrap_SettingsChangedCallback (Just ptrcallback) (Wp.Callbacks.drop_closures_SettingsChangedCallback callback))
    poke ptrcallback callback'
    let userData = nullPtr
    result <- wp_settings_subscribe self' pattern' callback' userData
    touchManagedPtr self
    freeMem pattern'
    return result

#if defined(ENABLE_OVERLOADING)
data SettingsSubscribeMethodInfo
instance (signature ~ (T.Text -> Wp.Callbacks.SettingsChangedCallback -> m CUIntPtr), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsSubscribeMethodInfo a signature where
    overloadedMethod = settingsSubscribe

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


#endif

-- method Settings::subscribe_closure
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pattern"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "name of the pattern to match the settings with"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "closure"
--           , argType = TGClosure Nothing
--           , argCType = Just "GClosure*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a GAsyncReadyCallback wrapped in a GClosure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUIntPtr)
-- throws : False
-- Skip return : False

foreign import ccall "wp_settings_subscribe_closure" wp_settings_subscribe_closure :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    CString ->                              -- pattern : TBasicType TUTF8
    Ptr (GClosure ()) ->                    -- closure : TGClosure Nothing
    IO CUIntPtr

-- | Subscribes callback for a given setting pattern(a glob-style pattern matched using g_pattern_match_simple), this allows clients to look for any changes made in settings through metadata.
settingsSubscribeClosure ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> T.Text
    -- ^ /@pattern@/: name of the pattern to match the settings with
    -> Maybe (GClosure b)
    -- ^ /@closure@/: a GAsyncReadyCallback wrapped in a GClosure
    -> m CUIntPtr
    -- ^ __Returns:__ the subscription ID (always greater than 0 for success)
settingsSubscribeClosure self pattern closure = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    pattern' <- textToCString pattern
    maybeClosure <- case closure of
        Nothing -> return FP.nullPtr
        Just jClosure -> do
            jClosure' <- unsafeManagedPtrCastPtr jClosure
            return jClosure'
    result <- wp_settings_subscribe_closure self' pattern' maybeClosure
    touchManagedPtr self
    whenJust closure touchManagedPtr
    freeMem pattern'
    return result

#if defined(ENABLE_OVERLOADING)
data SettingsSubscribeClosureMethodInfo
instance (signature ~ (T.Text -> Maybe (GClosure b) -> m CUIntPtr), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsSubscribeClosureMethodInfo a signature where
    overloadedMethod = settingsSubscribeClosure

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


#endif

-- method Settings::unsubscribe
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the settings object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "subscription_id"
--           , argType = TBasicType TUIntPtr
--           , argCType = Just "guintptr"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "identifies the callback"
--                 , 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_settings_unsubscribe" wp_settings_unsubscribe :: 
    Ptr Settings ->                         -- self : TInterface (Name {namespace = "Wp", name = "Settings"})
    CUIntPtr ->                             -- subscription_id : TBasicType TUIntPtr
    IO CInt

-- | Unsubscribes callback for a given subscription_id.
settingsUnsubscribe ::
    (B.CallStack.HasCallStack, MonadIO m, IsSettings a) =>
    a
    -- ^ /@self@/: the settings object
    -> CUIntPtr
    -- ^ /@subscriptionId@/: identifies the callback
    -> m Bool
    -- ^ __Returns:__ TRUE if success, FALSE otherwise
settingsUnsubscribe self subscriptionId = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- wp_settings_unsubscribe self' subscriptionId
    let result' = (/= 0) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SettingsUnsubscribeMethodInfo
instance (signature ~ (CUIntPtr -> m Bool), MonadIO m, IsSettings a) => O.OverloadedMethod SettingsUnsubscribeMethodInfo a signature where
    overloadedMethod = settingsUnsubscribe

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


#endif

-- method Settings::find
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "core"
--           , argType = TInterface Name { namespace = "Wp" , name = "Core" }
--           , argCType = Just "WpCore*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the WpCore" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "metadata_name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the name of the metadata object that the settings object is associated with; NULL returns the first settings object that is found"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "Settings" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_settings_find" wp_settings_find :: 
    Ptr Wp.Core.Core ->                     -- core : TInterface (Name {namespace = "Wp", name = "Core"})
    CString ->                              -- metadata_name : TBasicType TUTF8
    IO (Ptr Settings)

-- | Finds a registered WpSettings object by its metadata name.
settingsFind ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.Core.IsCore a) =>
    a
    -- ^ /@core@/: the WpCore
    -> Maybe (T.Text)
    -- ^ /@metadataName@/: the name of the metadata object that the settings object is associated with; NULL returns the first settings object that is found
    -> m (Maybe Settings)
    -- ^ __Returns:__ the WpSettings object, or NULL if not found
settingsFind core metadataName = liftIO $ do
    core' <- unsafeManagedPtrCastPtr core
    maybeMetadataName <- case metadataName of
        Nothing -> return FP.nullPtr
        Just jMetadataName -> do
            jMetadataName' <- textToCString jMetadataName
            return jMetadataName'
    result <- wp_settings_find core' maybeMetadataName
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Settings) result'
        return result''
    touchManagedPtr core
    freeMem maybeMetadataName
    return maybeResult

#if defined(ENABLE_OVERLOADING)
#endif


