{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./
-- 
-- /Since: 0.4.8/

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

module GI.Wp.Structs.SpaJsonBuilder
    ( 

-- * Exported types
    SpaJsonBuilder(..)                      ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [addBoolean]("GI.Wp.Structs.SpaJsonBuilder#g:method:addBoolean"), [addFloat]("GI.Wp.Structs.SpaJsonBuilder#g:method:addFloat"), [addFromString]("GI.Wp.Structs.SpaJsonBuilder#g:method:addFromString"), [addFromStringn]("GI.Wp.Structs.SpaJsonBuilder#g:method:addFromStringn"), [addInt]("GI.Wp.Structs.SpaJsonBuilder#g:method:addInt"), [addJson]("GI.Wp.Structs.SpaJsonBuilder#g:method:addJson"), [addNull]("GI.Wp.Structs.SpaJsonBuilder#g:method:addNull"), [addProperty]("GI.Wp.Structs.SpaJsonBuilder#g:method:addProperty"), [addString]("GI.Wp.Structs.SpaJsonBuilder#g:method:addString"), [end]("GI.Wp.Structs.SpaJsonBuilder#g:method:end"), [ref]("GI.Wp.Structs.SpaJsonBuilder#g:method:ref"), [unref]("GI.Wp.Structs.SpaJsonBuilder#g:method:unref").
-- 
-- ==== Getters
-- /None/.
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveSpaJsonBuilderMethod             ,
#endif

-- ** addBoolean #method:addBoolean#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderAddBooleanMethodInfo      ,
#endif
    spaJsonBuilderAddBoolean                ,


-- ** addFloat #method:addFloat#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderAddFloatMethodInfo        ,
#endif
    spaJsonBuilderAddFloat                  ,


-- ** addFromString #method:addFromString#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderAddFromStringMethodInfo   ,
#endif
    spaJsonBuilderAddFromString             ,


-- ** addFromStringn #method:addFromStringn#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderAddFromStringnMethodInfo  ,
#endif
    spaJsonBuilderAddFromStringn            ,


-- ** addInt #method:addInt#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderAddIntMethodInfo          ,
#endif
    spaJsonBuilderAddInt                    ,


-- ** addJson #method:addJson#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderAddJsonMethodInfo         ,
#endif
    spaJsonBuilderAddJson                   ,


-- ** addNull #method:addNull#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderAddNullMethodInfo         ,
#endif
    spaJsonBuilderAddNull                   ,


-- ** addProperty #method:addProperty#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderAddPropertyMethodInfo     ,
#endif
    spaJsonBuilderAddProperty               ,


-- ** addString #method:addString#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderAddStringMethodInfo       ,
#endif
    spaJsonBuilderAddString                 ,


-- ** end #method:end#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderEndMethodInfo             ,
#endif
    spaJsonBuilderEnd                       ,


-- ** newArray #method:newArray#

    spaJsonBuilderNewArray                  ,


-- ** newObject #method:newObject#

    spaJsonBuilderNewObject                 ,


-- ** ref #method:ref#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderRefMethodInfo             ,
#endif
    spaJsonBuilderRef                       ,


-- ** unref #method:unref#

#if defined(ENABLE_OVERLOADING)
    SpaJsonBuilderUnrefMethodInfo           ,
#endif
    spaJsonBuilderUnref                     ,




    ) where

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

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

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.Wp.Callbacks as Wp.Callbacks
import {-# SOURCE #-} qualified GI.Wp.Structs.Iterator as Wp.Iterator
import {-# SOURCE #-} qualified GI.Wp.Structs.IteratorMethods as Wp.IteratorMethods
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaJson as Wp.SpaJson

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

#endif

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

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

foreign import ccall "wp_spa_json_builder_get_type" c_wp_spa_json_builder_get_type :: 
    IO GType

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

instance B.Types.TypedObject SpaJsonBuilder where
    glibType = c_wp_spa_json_builder_get_type

instance B.Types.GBoxed SpaJsonBuilder

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


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

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

foreign import ccall "wp_spa_json_builder_new_array" wp_spa_json_builder_new_array :: 
    IO (Ptr SpaJsonBuilder)

-- | Creates a spa json builder of type array.
spaJsonBuilderNewArray ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m SpaJsonBuilder
    -- ^ __Returns:__ the new spa json builder
spaJsonBuilderNewArray  = liftIO $ do
    result <- wp_spa_json_builder_new_array
    checkUnexpectedReturnNULL "spaJsonBuilderNewArray" result
    result' <- (wrapBoxed SpaJsonBuilder) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

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

foreign import ccall "wp_spa_json_builder_new_object" wp_spa_json_builder_new_object :: 
    IO (Ptr SpaJsonBuilder)

-- | Creates a spa json builder of type object.
spaJsonBuilderNewObject ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m SpaJsonBuilder
    -- ^ __Returns:__ the new spa json builder
spaJsonBuilderNewObject  = liftIO $ do
    result <- wp_spa_json_builder_new_object
    checkUnexpectedReturnNULL "spaJsonBuilderNewObject" result
    result' <- (wrapBoxed SpaJsonBuilder) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method SpaJsonBuilder::add_boolean
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonBuilder" }
--           , argCType = Just "WpSpaJsonBuilder*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json builder object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TBoolean
--           , argCType = Just "gboolean"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the boolean value" , 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_spa_json_builder_add_boolean" wp_spa_json_builder_add_boolean :: 
    Ptr SpaJsonBuilder ->                   -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonBuilder"})
    CInt ->                                 -- value : TBasicType TBoolean
    IO ()

-- | Adds a boolean value into the builder.
spaJsonBuilderAddBoolean ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonBuilder
    -- ^ /@self@/: the spa json builder object
    -> Bool
    -- ^ /@value@/: the boolean value
    -> m ()
spaJsonBuilderAddBoolean self value = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    let value' = (P.fromIntegral . P.fromEnum) value
    wp_spa_json_builder_add_boolean self' value'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderAddBooleanMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.OverloadedMethod SpaJsonBuilderAddBooleanMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderAddBoolean

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


#endif

-- method SpaJsonBuilder::add_float
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonBuilder" }
--           , argCType = Just "WpSpaJsonBuilder*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json builder object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the float value" , 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_spa_json_builder_add_float" wp_spa_json_builder_add_float :: 
    Ptr SpaJsonBuilder ->                   -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonBuilder"})
    CFloat ->                               -- value : TBasicType TFloat
    IO ()

-- | Adds a float value into the builder.
spaJsonBuilderAddFloat ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonBuilder
    -- ^ /@self@/: the spa json builder object
    -> Float
    -- ^ /@value@/: the float value
    -> m ()
spaJsonBuilderAddFloat self value = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    let value' = realToFrac value
    wp_spa_json_builder_add_float self' value'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderAddFloatMethodInfo
instance (signature ~ (Float -> m ()), MonadIO m) => O.OverloadedMethod SpaJsonBuilderAddFloatMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderAddFloat

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


#endif

-- method SpaJsonBuilder::add_from_string
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonBuilder" }
--           , argCType = Just "WpSpaJsonBuilder*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json builder object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "json_str"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the json string" , 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_spa_json_builder_add_from_string" wp_spa_json_builder_add_from_string :: 
    Ptr SpaJsonBuilder ->                   -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonBuilder"})
    CString ->                              -- json_str : TBasicType TUTF8
    IO ()

-- | Adds a json string into the builder.
spaJsonBuilderAddFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonBuilder
    -- ^ /@self@/: the spa json builder object
    -> T.Text
    -- ^ /@jsonStr@/: the json string
    -> m ()
spaJsonBuilderAddFromString self jsonStr = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    jsonStr' <- textToCString jsonStr
    wp_spa_json_builder_add_from_string self' jsonStr'
    touchManagedPtr self
    freeMem jsonStr'
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderAddFromStringMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.OverloadedMethod SpaJsonBuilderAddFromStringMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderAddFromString

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


#endif

-- method SpaJsonBuilder::add_from_stringn
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonBuilder" }
--           , argCType = Just "WpSpaJsonBuilder*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json builder object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "json_str"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the json string" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TSize
--           , argCType = Just "size_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the specific length of the json string"
--                 , 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_spa_json_builder_add_from_stringn" wp_spa_json_builder_add_from_stringn :: 
    Ptr SpaJsonBuilder ->                   -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonBuilder"})
    CString ->                              -- json_str : TBasicType TUTF8
    FCT.CSize ->                            -- len : TBasicType TSize
    IO ()

-- | Adds a json string with specific length into the builder.
spaJsonBuilderAddFromStringn ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonBuilder
    -- ^ /@self@/: the spa json builder object
    -> T.Text
    -- ^ /@jsonStr@/: the json string
    -> FCT.CSize
    -- ^ /@len@/: the specific length of the json string
    -> m ()
spaJsonBuilderAddFromStringn self jsonStr len = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    jsonStr' <- textToCString jsonStr
    wp_spa_json_builder_add_from_stringn self' jsonStr' len
    touchManagedPtr self
    freeMem jsonStr'
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderAddFromStringnMethodInfo
instance (signature ~ (T.Text -> FCT.CSize -> m ()), MonadIO m) => O.OverloadedMethod SpaJsonBuilderAddFromStringnMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderAddFromStringn

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


#endif

-- method SpaJsonBuilder::add_int
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonBuilder" }
--           , argCType = Just "WpSpaJsonBuilder*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json builder object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TInt
--           , argCType = Just "gint"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the int value" , 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_spa_json_builder_add_int" wp_spa_json_builder_add_int :: 
    Ptr SpaJsonBuilder ->                   -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonBuilder"})
    Int32 ->                                -- value : TBasicType TInt
    IO ()

-- | Adds a int value into the builder.
spaJsonBuilderAddInt ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonBuilder
    -- ^ /@self@/: the spa json builder object
    -> Int32
    -- ^ /@value@/: the int value
    -> m ()
spaJsonBuilderAddInt self value = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    wp_spa_json_builder_add_int self' value
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderAddIntMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m) => O.OverloadedMethod SpaJsonBuilderAddIntMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderAddInt

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


#endif

-- method SpaJsonBuilder::add_json
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonBuilder" }
--           , argCType = Just "WpSpaJsonBuilder*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json builder object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "json"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaJson" }
--           , argCType = Just "WpSpaJson*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the json value" , 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_spa_json_builder_add_json" wp_spa_json_builder_add_json :: 
    Ptr SpaJsonBuilder ->                   -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonBuilder"})
    Ptr Wp.SpaJson.SpaJson ->               -- json : TInterface (Name {namespace = "Wp", name = "SpaJson"})
    IO ()

-- | Adds a json value into the builder.
spaJsonBuilderAddJson ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonBuilder
    -- ^ /@self@/: the spa json builder object
    -> Wp.SpaJson.SpaJson
    -- ^ /@json@/: the json value
    -> m ()
spaJsonBuilderAddJson self json = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    json' <- unsafeManagedPtrGetPtr json
    wp_spa_json_builder_add_json self' json'
    touchManagedPtr self
    touchManagedPtr json
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderAddJsonMethodInfo
instance (signature ~ (Wp.SpaJson.SpaJson -> m ()), MonadIO m) => O.OverloadedMethod SpaJsonBuilderAddJsonMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderAddJson

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


#endif

-- method SpaJsonBuilder::add_null
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonBuilder" }
--           , argCType = Just "WpSpaJsonBuilder*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json builder 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_spa_json_builder_add_null" wp_spa_json_builder_add_null :: 
    Ptr SpaJsonBuilder ->                   -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonBuilder"})
    IO ()

-- | Adds a null value into the builder.
spaJsonBuilderAddNull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonBuilder
    -- ^ /@self@/: the spa json builder object
    -> m ()
spaJsonBuilderAddNull self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    wp_spa_json_builder_add_null self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderAddNullMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SpaJsonBuilderAddNullMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderAddNull

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


#endif

-- method SpaJsonBuilder::add_property
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonBuilder" }
--           , argCType = Just "WpSpaJsonBuilder*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json builder object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the property"
--                 , 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_spa_json_builder_add_property" wp_spa_json_builder_add_property :: 
    Ptr SpaJsonBuilder ->                   -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonBuilder"})
    CString ->                              -- key : TBasicType TUTF8
    IO ()

-- | Adds a property into the builder.
spaJsonBuilderAddProperty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonBuilder
    -- ^ /@self@/: the spa json builder object
    -> T.Text
    -- ^ /@key@/: the name of the property
    -> m ()
spaJsonBuilderAddProperty self key = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    key' <- textToCString key
    wp_spa_json_builder_add_property self' key'
    touchManagedPtr self
    freeMem key'
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderAddPropertyMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.OverloadedMethod SpaJsonBuilderAddPropertyMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderAddProperty

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


#endif

-- method SpaJsonBuilder::add_string
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonBuilder" }
--           , argCType = Just "WpSpaJsonBuilder*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json builder object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the string value" , 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_spa_json_builder_add_string" wp_spa_json_builder_add_string :: 
    Ptr SpaJsonBuilder ->                   -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonBuilder"})
    CString ->                              -- value : TBasicType TUTF8
    IO ()

-- | Adds a string value into the builder.
spaJsonBuilderAddString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonBuilder
    -- ^ /@self@/: the spa json builder object
    -> T.Text
    -- ^ /@value@/: the string value
    -> m ()
spaJsonBuilderAddString self value = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    value' <- textToCString value
    wp_spa_json_builder_add_string self' value'
    touchManagedPtr self
    freeMem value'
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderAddStringMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.OverloadedMethod SpaJsonBuilderAddStringMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderAddString

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


#endif

-- method SpaJsonBuilder::end
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonBuilder" }
--           , argCType = Just "WpSpaJsonBuilder*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json builder object"
--                 , 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_spa_json_builder_end" wp_spa_json_builder_end :: 
    Ptr SpaJsonBuilder ->                   -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonBuilder"})
    IO (Ptr Wp.SpaJson.SpaJson)

-- | Ends the builder process and returns the constructed spa json object.
spaJsonBuilderEnd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonBuilder
    -- ^ /@self@/: the spa json builder object
    -> m Wp.SpaJson.SpaJson
    -- ^ __Returns:__ the constructed spa json object
spaJsonBuilderEnd self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_spa_json_builder_end self'
    checkUnexpectedReturnNULL "spaJsonBuilderEnd" result
    result' <- (wrapBoxed Wp.SpaJson.SpaJson) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderEndMethodInfo
instance (signature ~ (m Wp.SpaJson.SpaJson), MonadIO m) => O.OverloadedMethod SpaJsonBuilderEndMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderEnd

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


#endif

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

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

-- | Increases the reference count of a spa json builder.
spaJsonBuilderRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonBuilder
    -- ^ /@self@/: a spa json builder object
    -> m SpaJsonBuilder
    -- ^ __Returns:__ /@self@/ with an additional reference count on it
spaJsonBuilderRef self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_spa_json_builder_ref self'
    checkUnexpectedReturnNULL "spaJsonBuilderRef" result
    result' <- (wrapBoxed SpaJsonBuilder) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderRefMethodInfo
instance (signature ~ (m SpaJsonBuilder), MonadIO m) => O.OverloadedMethod SpaJsonBuilderRefMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderRef

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


#endif

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

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

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

#if defined(ENABLE_OVERLOADING)
data SpaJsonBuilderUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SpaJsonBuilderUnrefMethodInfo SpaJsonBuilder signature where
    overloadedMethod = spaJsonBuilderUnref

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


#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveSpaJsonBuilderMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveSpaJsonBuilderMethod "addBoolean" o = SpaJsonBuilderAddBooleanMethodInfo
    ResolveSpaJsonBuilderMethod "addFloat" o = SpaJsonBuilderAddFloatMethodInfo
    ResolveSpaJsonBuilderMethod "addFromString" o = SpaJsonBuilderAddFromStringMethodInfo
    ResolveSpaJsonBuilderMethod "addFromStringn" o = SpaJsonBuilderAddFromStringnMethodInfo
    ResolveSpaJsonBuilderMethod "addInt" o = SpaJsonBuilderAddIntMethodInfo
    ResolveSpaJsonBuilderMethod "addJson" o = SpaJsonBuilderAddJsonMethodInfo
    ResolveSpaJsonBuilderMethod "addNull" o = SpaJsonBuilderAddNullMethodInfo
    ResolveSpaJsonBuilderMethod "addProperty" o = SpaJsonBuilderAddPropertyMethodInfo
    ResolveSpaJsonBuilderMethod "addString" o = SpaJsonBuilderAddStringMethodInfo
    ResolveSpaJsonBuilderMethod "end" o = SpaJsonBuilderEndMethodInfo
    ResolveSpaJsonBuilderMethod "ref" o = SpaJsonBuilderRefMethodInfo
    ResolveSpaJsonBuilderMethod "unref" o = SpaJsonBuilderUnrefMethodInfo
    ResolveSpaJsonBuilderMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#endif


