{-# 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.SpaJsonParser
    ( 

-- * Exported types
    SpaJsonParser(..)                       ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [end]("GI.Wp.Structs.SpaJsonParser#g:method:end"), [ref]("GI.Wp.Structs.SpaJsonParser#g:method:ref"), [unref]("GI.Wp.Structs.SpaJsonParser#g:method:unref").
-- 
-- ==== Getters
-- [getBoolean]("GI.Wp.Structs.SpaJsonParser#g:method:getBoolean"), [getFloat]("GI.Wp.Structs.SpaJsonParser#g:method:getFloat"), [getInt]("GI.Wp.Structs.SpaJsonParser#g:method:getInt"), [getJson]("GI.Wp.Structs.SpaJsonParser#g:method:getJson"), [getNull]("GI.Wp.Structs.SpaJsonParser#g:method:getNull"), [getString]("GI.Wp.Structs.SpaJsonParser#g:method:getString").
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveSpaJsonParserMethod              ,
#endif

-- ** end #method:end#

#if defined(ENABLE_OVERLOADING)
    SpaJsonParserEndMethodInfo              ,
#endif
    spaJsonParserEnd                        ,


-- ** getBoolean #method:getBoolean#

#if defined(ENABLE_OVERLOADING)
    SpaJsonParserGetBooleanMethodInfo       ,
#endif
    spaJsonParserGetBoolean                 ,


-- ** getFloat #method:getFloat#

#if defined(ENABLE_OVERLOADING)
    SpaJsonParserGetFloatMethodInfo         ,
#endif
    spaJsonParserGetFloat                   ,


-- ** getInt #method:getInt#

#if defined(ENABLE_OVERLOADING)
    SpaJsonParserGetIntMethodInfo           ,
#endif
    spaJsonParserGetInt                     ,


-- ** getJson #method:getJson#

#if defined(ENABLE_OVERLOADING)
    SpaJsonParserGetJsonMethodInfo          ,
#endif
    spaJsonParserGetJson                    ,


-- ** getNull #method:getNull#

#if defined(ENABLE_OVERLOADING)
    SpaJsonParserGetNullMethodInfo          ,
#endif
    spaJsonParserGetNull                    ,


-- ** getString #method:getString#

#if defined(ENABLE_OVERLOADING)
    SpaJsonParserGetStringMethodInfo        ,
#endif
    spaJsonParserGetString                  ,


-- ** newArray #method:newArray#

    spaJsonParserNewArray                   ,


-- ** newObject #method:newObject#

    spaJsonParserNewObject                  ,


-- ** newUndefined #method:newUndefined#

    spaJsonParserNewUndefined               ,


-- ** ref #method:ref#

#if defined(ENABLE_OVERLOADING)
    SpaJsonParserRefMethodInfo              ,
#endif
    spaJsonParserRef                        ,


-- ** unref #method:unref#

#if defined(ENABLE_OVERLOADING)
    SpaJsonParserUnrefMethodInfo            ,
#endif
    spaJsonParserUnref                      ,




    ) 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 SpaJsonParser = SpaJsonParser (SP.ManagedPtr SpaJsonParser)
    deriving (Eq)

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

foreign import ccall "wp_spa_json_parser_get_type" c_wp_spa_json_parser_get_type :: 
    IO GType

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

instance B.Types.TypedObject SpaJsonParser where
    glibType = c_wp_spa_json_parser_get_type

instance B.Types.GBoxed SpaJsonParser

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


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

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

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

-- | Creates a spa json array parser. The /@json@/ object must be valid for the entire life-cycle of the returned parser.
spaJsonParserNewArray ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Wp.SpaJson.SpaJson
    -- ^ /@json@/: the spa json array to parse
    -> m SpaJsonParser
    -- ^ __Returns:__ The new spa json parser
spaJsonParserNewArray json = liftIO $ do
    json' <- unsafeManagedPtrGetPtr json
    result <- wp_spa_json_parser_new_array json'
    checkUnexpectedReturnNULL "spaJsonParserNewArray" result
    result' <- (wrapBoxed SpaJsonParser) result
    touchManagedPtr json
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

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

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

-- | Creates a spa json object parser. The /@json@/ object must be valid for the entire life-cycle of the returned parser.
spaJsonParserNewObject ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Wp.SpaJson.SpaJson
    -- ^ /@json@/: the spa json object to parse
    -> m SpaJsonParser
    -- ^ __Returns:__ The new spa json parser
spaJsonParserNewObject json = liftIO $ do
    json' <- unsafeManagedPtrGetPtr json
    result <- wp_spa_json_parser_new_object json'
    checkUnexpectedReturnNULL "spaJsonParserNewObject" result
    result' <- (wrapBoxed SpaJsonParser) result
    touchManagedPtr json
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

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

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

-- | Creates a new spa json parser for undefined type of data. The /@json@/ object must be valid for the entire life-cycle of the returned parser.
-- 
-- 
-- This function allows creating a parser object for any type of spa json and is mostly useful to parse non-standard JSON data that should be treated as if it were an object or array, but does not start with a \'{\' or \'[\' character. Such data can be for instance a comma-separated list of single values (array) or key-value pairs (object). Such data is also the main configuration file, which is an object but doesn\'t start with a \'{\' character.
-- If the data is an array or object, the parser will not enter it and the only token it will be able to parse is the same /@json@/ object that is passed in as an argument. Use 'GI.Wp.Structs.SpaJsonParser.spaJsonParserNewArray' or 'GI.Wp.Structs.SpaJsonParser.spaJsonParserNewObject' to parse arrays or objects.
-- 
-- /Since: 0.5.0/
spaJsonParserNewUndefined ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Wp.SpaJson.SpaJson
    -- ^ /@json@/: the spa json to parse
    -> m SpaJsonParser
    -- ^ __Returns:__ The new spa json parser
spaJsonParserNewUndefined json = liftIO $ do
    json' <- unsafeManagedPtrGetPtr json
    result <- wp_spa_json_parser_new_undefined json'
    checkUnexpectedReturnNULL "spaJsonParserNewUndefined" result
    result' <- (wrapBoxed SpaJsonParser) result
    touchManagedPtr json
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method SpaJsonParser::end
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonParser" }
--           , argCType = Just "WpSpaJsonParser*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json parser"
--                 , 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_parser_end" wp_spa_json_parser_end :: 
    Ptr SpaJsonParser ->                    -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonParser"})
    IO ()

-- | Ends the parsing session.
-- 
-- 
-- After this is called, no more tokens can be parsed with /@self@/.
spaJsonParserEnd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonParser
    -- ^ /@self@/: the spa json parser
    -> m ()
spaJsonParserEnd self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    wp_spa_json_parser_end self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SpaJsonParserEndMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SpaJsonParserEndMethodInfo SpaJsonParser signature where
    overloadedMethod = spaJsonParserEnd

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


#endif

-- method SpaJsonParser::get_boolean
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonParser" }
--           , argCType = Just "WpSpaJsonParser*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json parser 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 = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the boolean value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_json_parser_get_boolean" wp_spa_json_parser_get_boolean :: 
    Ptr SpaJsonParser ->                    -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonParser"})
    Ptr CInt ->                             -- value : TBasicType TBoolean
    IO CInt

-- | Gets the boolean value from a spa json parser.
spaJsonParserGetBoolean ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonParser
    -- ^ /@self@/: the spa json parser object
    -> m ((Bool, Bool))
    -- ^ __Returns:__ TRUE if the value was obtained, FALSE otherwise
spaJsonParserGetBoolean self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    value <- allocMem :: IO (Ptr CInt)
    result <- wp_spa_json_parser_get_boolean self' value
    let result' = (/= 0) result
    value' <- peek value
    let value'' = (/= 0) value'
    touchManagedPtr self
    freeMem value
    return (result', value'')

#if defined(ENABLE_OVERLOADING)
data SpaJsonParserGetBooleanMethodInfo
instance (signature ~ (m ((Bool, Bool))), MonadIO m) => O.OverloadedMethod SpaJsonParserGetBooleanMethodInfo SpaJsonParser signature where
    overloadedMethod = spaJsonParserGetBoolean

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


#endif

-- method SpaJsonParser::get_float
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonParser" }
--           , argCType = Just "WpSpaJsonParser*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json parser 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 = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the float value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_json_parser_get_float" wp_spa_json_parser_get_float :: 
    Ptr SpaJsonParser ->                    -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonParser"})
    Ptr CFloat ->                           -- value : TBasicType TFloat
    IO CInt

-- | Gets the float value from a spa json parser object.
spaJsonParserGetFloat ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonParser
    -- ^ /@self@/: the spa json parser object
    -> m ((Bool, Float))
    -- ^ __Returns:__ TRUE if the value was obtained, FALSE otherwise
spaJsonParserGetFloat self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    value <- allocMem :: IO (Ptr CFloat)
    result <- wp_spa_json_parser_get_float self' value
    let result' = (/= 0) result
    value' <- peek value
    let value'' = realToFrac value'
    touchManagedPtr self
    freeMem value
    return (result', value'')

#if defined(ENABLE_OVERLOADING)
data SpaJsonParserGetFloatMethodInfo
instance (signature ~ (m ((Bool, Float))), MonadIO m) => O.OverloadedMethod SpaJsonParserGetFloatMethodInfo SpaJsonParser signature where
    overloadedMethod = spaJsonParserGetFloat

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


#endif

-- method SpaJsonParser::get_int
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonParser" }
--           , argCType = Just "WpSpaJsonParser*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json parser 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 = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the int value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wp_spa_json_parser_get_int" wp_spa_json_parser_get_int :: 
    Ptr SpaJsonParser ->                    -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonParser"})
    Ptr Int32 ->                            -- value : TBasicType TInt
    IO CInt

-- | Gets the int value from a spa json parser object.
spaJsonParserGetInt ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonParser
    -- ^ /@self@/: the spa json parser object
    -> m ((Bool, Int32))
    -- ^ __Returns:__ TRUE if the value was obtained, FALSE otherwise
spaJsonParserGetInt self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    value <- allocMem :: IO (Ptr Int32)
    result <- wp_spa_json_parser_get_int self' value
    let result' = (/= 0) result
    value' <- peek value
    touchManagedPtr self
    freeMem value
    return (result', value')

#if defined(ENABLE_OVERLOADING)
data SpaJsonParserGetIntMethodInfo
instance (signature ~ (m ((Bool, Int32))), MonadIO m) => O.OverloadedMethod SpaJsonParserGetIntMethodInfo SpaJsonParser signature where
    overloadedMethod = spaJsonParserGetInt

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


#endif

-- method SpaJsonParser::get_json
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonParser" }
--           , argCType = Just "WpSpaJsonParser*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json parser 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_parser_get_json" wp_spa_json_parser_get_json :: 
    Ptr SpaJsonParser ->                    -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonParser"})
    IO (Ptr Wp.SpaJson.SpaJson)

-- | Gets the spa json value from a spa json parser object.
-- 
-- 
-- the returned spa json object references the original data instead of copying it, therefore the original data must be valid for the entire life-cycle of the returned object
spaJsonParserGetJson ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonParser
    -- ^ /@self@/: the spa json parser object
    -> m Wp.SpaJson.SpaJson
    -- ^ __Returns:__ The spa json value or NULL if it could not be obtained
spaJsonParserGetJson self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_spa_json_parser_get_json self'
    checkUnexpectedReturnNULL "spaJsonParserGetJson" result
    result' <- (wrapBoxed Wp.SpaJson.SpaJson) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaJsonParserGetJsonMethodInfo
instance (signature ~ (m Wp.SpaJson.SpaJson), MonadIO m) => O.OverloadedMethod SpaJsonParserGetJsonMethodInfo SpaJsonParser signature where
    overloadedMethod = spaJsonParserGetJson

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


#endif

-- method SpaJsonParser::get_null
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonParser" }
--           , argCType = Just "WpSpaJsonParser*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the spa json parser object"
--                 , 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_spa_json_parser_get_null" wp_spa_json_parser_get_null :: 
    Ptr SpaJsonParser ->                    -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonParser"})
    IO CInt

-- | Gets the null value from a spa json parser.
spaJsonParserGetNull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonParser
    -- ^ /@self@/: the spa json parser object
    -> m Bool
    -- ^ __Returns:__ TRUE if the null value is present, FALSE otherwise
spaJsonParserGetNull self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_spa_json_parser_get_null self'
    let result' = (/= 0) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaJsonParserGetNullMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.OverloadedMethod SpaJsonParserGetNullMethodInfo SpaJsonParser signature where
    overloadedMethod = spaJsonParserGetNull

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


#endif

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

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

-- | Gets the string value from a spa json parser object.
spaJsonParserGetString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    SpaJsonParser
    -- ^ /@self@/: the spa json parser object
    -> m T.Text
    -- ^ __Returns:__ The newly allocated parsed string
spaJsonParserGetString self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    result <- wp_spa_json_parser_get_string self'
    checkUnexpectedReturnNULL "spaJsonParserGetString" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SpaJsonParserGetStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.OverloadedMethod SpaJsonParserGetStringMethodInfo SpaJsonParser signature where
    overloadedMethod = spaJsonParserGetString

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


#endif

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

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

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

#if defined(ENABLE_OVERLOADING)
data SpaJsonParserRefMethodInfo
instance (signature ~ (m SpaJsonParser), MonadIO m) => O.OverloadedMethod SpaJsonParserRefMethodInfo SpaJsonParser signature where
    overloadedMethod = spaJsonParserRef

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


#endif

-- method SpaJsonParser::unref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "SpaJsonParser" }
--           , argCType = Just "WpSpaJsonParser*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a spa json parser 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_parser_unref" wp_spa_json_parser_unref :: 
    Ptr SpaJsonParser ->                    -- self : TInterface (Name {namespace = "Wp", name = "SpaJsonParser"})
    IO ()

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

#if defined(ENABLE_OVERLOADING)
data SpaJsonParserUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SpaJsonParserUnrefMethodInfo SpaJsonParser signature where
    overloadedMethod = spaJsonParserUnref

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


#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveSpaJsonParserMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveSpaJsonParserMethod "end" o = SpaJsonParserEndMethodInfo
    ResolveSpaJsonParserMethod "ref" o = SpaJsonParserRefMethodInfo
    ResolveSpaJsonParserMethod "unref" o = SpaJsonParserUnrefMethodInfo
    ResolveSpaJsonParserMethod "getBoolean" o = SpaJsonParserGetBooleanMethodInfo
    ResolveSpaJsonParserMethod "getFloat" o = SpaJsonParserGetFloatMethodInfo
    ResolveSpaJsonParserMethod "getInt" o = SpaJsonParserGetIntMethodInfo
    ResolveSpaJsonParserMethod "getJson" o = SpaJsonParserGetJsonMethodInfo
    ResolveSpaJsonParserMethod "getNull" o = SpaJsonParserGetNullMethodInfo
    ResolveSpaJsonParserMethod "getString" o = SpaJsonParserGetStringMethodInfo
    ResolveSpaJsonParserMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#endif


