{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Used to load PipeWire modules within the WirePlumber process. This is slightly different from other objects in that the module is not exported to PipeWire, but it may create an export objects itself.
-- When the \"client-context\" component is loaded, which is the case in the default daemon configuration, the module is loaded in a secondary pw_context that runs on its own thread, so that it is not affected by anything that blocks WirePlumber\'s main loop. The WpImplModule itself stays on the thread that created it and its API is unchanged; the module\'s own callbacks, though, run on that other thread. If the component is not loaded, the module is loaded in the core\'s pw_context instead.
-- 
-- /Since: 0.4.2/

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

module GI.Wp.Objects.ImplModule
    ( 

-- * Exported types
    ImplModule(..)                          ,
    IsImplModule                            ,
    toImplModule                            ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unload]("GI.Wp.Objects.ImplModule#g:method:unload"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== 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)
    ResolveImplModuleMethod                 ,
#endif

-- ** load #method:load#

    implModuleLoad                          ,


-- ** unload #method:unload#

#if defined(ENABLE_OVERLOADING)
    ImplModuleUnloadMethodInfo              ,
#endif
    implModuleUnload                        ,




 -- * Properties


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

#if defined(ENABLE_OVERLOADING)
    ImplModuleArgumentsPropertyInfo         ,
#endif
    constructImplModuleArguments            ,
    getImplModuleArguments                  ,
#if defined(ENABLE_OVERLOADING)
    implModuleArguments                     ,
#endif


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

#if defined(ENABLE_OVERLOADING)
    ImplModuleCorePropertyInfo              ,
#endif
    constructImplModuleCore                 ,
    getImplModuleCore                       ,
#if defined(ENABLE_OVERLOADING)
    implModuleCore                          ,
#endif


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

#if defined(ENABLE_OVERLOADING)
    ImplModuleNamePropertyInfo              ,
#endif
    constructImplModuleName                 ,
    getImplModuleName                       ,
#if defined(ENABLE_OVERLOADING)
    implModuleName                          ,
#endif


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

#if defined(ENABLE_OVERLOADING)
    ImplModulePropertiesPropertyInfo        ,
#endif
    clearImplModuleProperties               ,
    constructImplModuleProperties           ,
    getImplModuleProperties                 ,
#if defined(ENABLE_OVERLOADING)
    implModuleProperties                    ,
#endif
    setImplModuleProperties                 ,


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

#if defined(ENABLE_OVERLOADING)
    ImplModulePwImplModulePropertyInfo      ,
#endif
    getImplModulePwImplModule               ,
#if defined(ENABLE_OVERLOADING)
    implModulePwImplModule                  ,
#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.SpaJson as Wp.SpaJson

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

#endif

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

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

foreign import ccall "wp_impl_module_get_type"
    c_wp_impl_module_get_type :: IO B.Types.GType

instance B.Types.TypedObject ImplModule where
    glibType = c_wp_impl_module_get_type

instance B.Types.GObject ImplModule

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

instance O.HasParentTypes ImplModule
type instance O.ParentTypes ImplModule = '[GObject.Object.Object]

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

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

#if defined(ENABLE_OVERLOADING)
type family ResolveImplModuleMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveImplModuleMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveImplModuleMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveImplModuleMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveImplModuleMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveImplModuleMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveImplModuleMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveImplModuleMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveImplModuleMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveImplModuleMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveImplModuleMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveImplModuleMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveImplModuleMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveImplModuleMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveImplModuleMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveImplModuleMethod "unload" o = ImplModuleUnloadMethodInfo
    ResolveImplModuleMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveImplModuleMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveImplModuleMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveImplModuleMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveImplModuleMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveImplModuleMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveImplModuleMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveImplModuleMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveImplModuleMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#endif

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

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

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

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

-- VVV Prop "core"
   -- Type: TBasicType TPtr
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@core@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' implModule #core
-- @
getImplModuleCore :: (MonadIO m, IsImplModule o) => o -> m (Ptr ())
getImplModuleCore obj = MIO.liftIO $ B.Properties.getObjectPropertyPtr obj "core"

-- | Construct a t'GValueConstruct' with valid value for the “@core@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructImplModuleCore :: (IsImplModule o, MIO.MonadIO m) => Ptr () -> m (GValueConstruct o)
constructImplModuleCore val = MIO.liftIO $ do
    MIO.liftIO $ B.Properties.constructObjectPropertyPtr "core" val

#if defined(ENABLE_OVERLOADING)
data ImplModuleCorePropertyInfo
instance AttrInfo ImplModuleCorePropertyInfo where
    type AttrAllowedOps ImplModuleCorePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrBaseTypeConstraint ImplModuleCorePropertyInfo = IsImplModule
    type AttrSetTypeConstraint ImplModuleCorePropertyInfo = (~) (Ptr ())
    type AttrTransferTypeConstraint ImplModuleCorePropertyInfo = (~) (Ptr ())
    type AttrTransferType ImplModuleCorePropertyInfo = Ptr ()
    type AttrGetType ImplModuleCorePropertyInfo = (Ptr ())
    type AttrLabel ImplModuleCorePropertyInfo = "core"
    type AttrOrigin ImplModuleCorePropertyInfo = ImplModule
    attrGet = getImplModuleCore
    attrSet = undefined
    attrPut = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructImplModuleCore
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.ImplModule.core"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-ImplModule.html#g:attr:core"
        })
#endif

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

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

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

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

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

-- | Get the value of the “@properties@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' implModule #properties
-- @
getImplModuleProperties :: (MonadIO m, IsImplModule o) => o -> m (Maybe Wp.Properties.Properties)
getImplModuleProperties obj = MIO.liftIO $ B.Properties.getObjectPropertyBoxed obj "properties" Wp.Properties.Properties

-- | Set the value of the “@properties@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' implModule [ #properties 'Data.GI.Base.Attributes.:=' value ]
-- @
setImplModuleProperties :: (MonadIO m, IsImplModule o) => o -> Wp.Properties.Properties -> m ()
setImplModuleProperties obj val = MIO.liftIO $ do
    B.Properties.setObjectPropertyBoxed obj "properties" (Just val)

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

-- | Set the value of the “@properties@” property to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #properties
-- @
clearImplModuleProperties :: (MonadIO m, IsImplModule o) => o -> m ()
clearImplModuleProperties obj = liftIO $ B.Properties.setObjectPropertyBoxed obj "properties" (Nothing :: Maybe Wp.Properties.Properties)

#if defined(ENABLE_OVERLOADING)
data ImplModulePropertiesPropertyInfo
instance AttrInfo ImplModulePropertiesPropertyInfo where
    type AttrAllowedOps ImplModulePropertiesPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ImplModulePropertiesPropertyInfo = IsImplModule
    type AttrSetTypeConstraint ImplModulePropertiesPropertyInfo = (~) Wp.Properties.Properties
    type AttrTransferTypeConstraint ImplModulePropertiesPropertyInfo = (~) Wp.Properties.Properties
    type AttrTransferType ImplModulePropertiesPropertyInfo = Wp.Properties.Properties
    type AttrGetType ImplModulePropertiesPropertyInfo = (Maybe Wp.Properties.Properties)
    type AttrLabel ImplModulePropertiesPropertyInfo = "properties"
    type AttrOrigin ImplModulePropertiesPropertyInfo = ImplModule
    attrGet = getImplModuleProperties
    attrSet = setImplModuleProperties
    attrPut = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructImplModuleProperties
    attrClear = clearImplModuleProperties
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Wp.Objects.ImplModule.properties"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-wireplumber-0.5.14.2/docs/GI-Wp-Objects-ImplModule.html#g:attr:properties"
        })
#endif

-- VVV Prop "pw-impl-module"
   -- Type: TBasicType TPtr
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@pw-impl-module@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' implModule #pwImplModule
-- @
getImplModulePwImplModule :: (MonadIO m, IsImplModule o) => o -> m (Ptr ())
getImplModulePwImplModule obj = MIO.liftIO $ B.Properties.getObjectPropertyPtr obj "pw-impl-module"

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

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ImplModule
type instance O.AttributeList ImplModule = ImplModuleAttributeList
type ImplModuleAttributeList = ('[ '("arguments", ImplModuleArgumentsPropertyInfo), '("core", ImplModuleCorePropertyInfo), '("name", ImplModuleNamePropertyInfo), '("properties", ImplModulePropertiesPropertyInfo), '("pwImplModule", ImplModulePwImplModulePropertyInfo)] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
implModuleArguments :: AttrLabelProxy "arguments"
implModuleArguments = AttrLabelProxy

implModuleCore :: AttrLabelProxy "core"
implModuleCore = AttrLabelProxy

implModuleName :: AttrLabelProxy "name"
implModuleName = AttrLabelProxy

implModuleProperties :: AttrLabelProxy "properties"
implModuleProperties = AttrLabelProxy

implModulePwImplModule :: AttrLabelProxy "pwImplModule"
implModulePwImplModule = AttrLabelProxy

#endif

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

#endif

-- method ImplModule::unload
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ImplModule" }
--           , argCType = Just "WpImplModule*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the module" , 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_impl_module_unload" wp_impl_module_unload :: 
    Ptr ImplModule ->                       -- self : TInterface (Name {namespace = "Wp", name = "ImplModule"})
    IO ()

-- | Unloads the PipeWire module immediately.
-- 
-- 
-- Normally, the module is unloaded when the last reference to /@self@/ is dropped and the object is finalized. This method allows unloading the module at a deterministic point in time, without having to rely on the object\'s lifetime, which is useful when the module needs to be torn down before another one that provides the same objects is loaded.
-- It is safe to call this method multiple times; subsequent calls have no effect. The WpImplModule object itself remains valid after the call.
-- 
-- /Since: 0.5.16/
implModuleUnload ::
    (B.CallStack.HasCallStack, MonadIO m, IsImplModule a) =>
    a
    -- ^ /@self@/: the module
    -> m ()
implModuleUnload self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    wp_impl_module_unload self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data ImplModuleUnloadMethodInfo
instance (signature ~ (m ()), MonadIO m, IsImplModule a) => O.OverloadedMethod ImplModuleUnloadMethodInfo a signature where
    overloadedMethod = implModuleUnload

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


#endif

-- method ImplModule::load
-- 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 WirePlumber core"
--                 , 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 module to load"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "arguments"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "arguments to be passed to the module"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "properties"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Properties" }
--           , argCType = Just "WpProperties*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "additional properties to be provided to the module"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Wp" , name = "ImplModule" })
-- throws : False
-- Skip return : False

foreign import ccall "wp_impl_module_load" wp_impl_module_load :: 
    Ptr Wp.Core.Core ->                     -- core : TInterface (Name {namespace = "Wp", name = "Core"})
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- arguments : TBasicType TUTF8
    Ptr Wp.Properties.Properties ->         -- properties : TInterface (Name {namespace = "Wp", name = "Properties"})
    IO (Ptr ImplModule)

-- | Loads a PipeWire module into the WirePlumber process.
-- 
-- /Since: 0.4.2/
implModuleLoad ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.Core.IsCore a) =>
    a
    -- ^ /@core@/: The WirePlumber core
    -> T.Text
    -- ^ /@name@/: the name of the module to load
    -> Maybe (T.Text)
    -- ^ /@arguments@/: arguments to be passed to the module
    -> Maybe (Wp.Properties.Properties)
    -- ^ /@properties@/: additional properties to be provided to the module
    -> m (Maybe ImplModule)
    -- ^ __Returns:__ the WpImplModule for the module that was loaded on success, NULL on failure.
implModuleLoad core name arguments properties = liftIO $ do
    core' <- unsafeManagedPtrCastPtr core
    name' <- textToCString name
    maybeArguments <- case arguments of
        Nothing -> return FP.nullPtr
        Just jArguments -> do
            jArguments' <- textToCString jArguments
            return jArguments'
    maybeProperties <- case properties of
        Nothing -> return FP.nullPtr
        Just jProperties -> do
            jProperties' <- unsafeManagedPtrGetPtr jProperties
            return jProperties'
    result <- wp_impl_module_load core' name' maybeArguments maybeProperties
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject ImplModule) result'
        return result''
    touchManagedPtr core
    whenJust properties touchManagedPtr
    freeMem name'
    freeMem maybeArguments
    return maybeResult

#if defined(ENABLE_OVERLOADING)
#endif


