-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

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

module GI.Json.Enums
    ( 

 -- * Enumerations


-- ** NodeType #enum:NodeType#

    NodeType(..)                            ,


-- ** ParserError #enum:ParserError#

    ParserError(..)                         ,
    catchParserError                        ,
    handleParserError                       ,


-- ** PathError #enum:PathError#

    PathError(..)                           ,
    catchPathError                          ,
    handlePathError                         ,


-- ** ReaderError #enum:ReaderError#

    ReaderError(..)                         ,
    catchReaderError                        ,
    handleReaderError                       ,




    ) 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.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


-- Enum ReaderError
-- | Error codes for @JSON_READER_ERROR@.
-- 
-- This enumeration can be extended at later date
-- 
-- /Since: 0.12/
data ReaderError = 
      ReaderErrorNoArray
    -- ^ No array found at the current position
    | ReaderErrorInvalidIndex
    -- ^ Index out of bounds
    | ReaderErrorNoObject
    -- ^ No object found at the current position
    | ReaderErrorInvalidMember
    -- ^ Member not found
    | ReaderErrorInvalidNode
    -- ^ No valid node found at the current position
    | ReaderErrorNoValue
    -- ^ The node at the current position does not
    --   hold a value
    | ReaderErrorInvalidType
    -- ^ The node at the current position does not
    --   hold a value of the desired type
    | AnotherReaderError Int
    -- ^ Catch-all for unknown values
    deriving (Int -> ReaderError -> ShowS
[ReaderError] -> ShowS
ReaderError -> String
(Int -> ReaderError -> ShowS)
-> (ReaderError -> String)
-> ([ReaderError] -> ShowS)
-> Show ReaderError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReaderError -> ShowS
showsPrec :: Int -> ReaderError -> ShowS
$cshow :: ReaderError -> String
show :: ReaderError -> String
$cshowList :: [ReaderError] -> ShowS
showList :: [ReaderError] -> ShowS
Show, ReaderError -> ReaderError -> Bool
(ReaderError -> ReaderError -> Bool)
-> (ReaderError -> ReaderError -> Bool) -> Eq ReaderError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReaderError -> ReaderError -> Bool
== :: ReaderError -> ReaderError -> Bool
$c/= :: ReaderError -> ReaderError -> Bool
/= :: ReaderError -> ReaderError -> Bool
Eq)

instance P.Enum ReaderError where
    fromEnum :: ReaderError -> Int
fromEnum ReaderError
ReaderErrorNoArray = Int
0
    fromEnum ReaderError
ReaderErrorInvalidIndex = Int
1
    fromEnum ReaderError
ReaderErrorNoObject = Int
2
    fromEnum ReaderError
ReaderErrorInvalidMember = Int
3
    fromEnum ReaderError
ReaderErrorInvalidNode = Int
4
    fromEnum ReaderError
ReaderErrorNoValue = Int
5
    fromEnum ReaderError
ReaderErrorInvalidType = Int
6
    fromEnum (AnotherReaderError Int
k) = Int
k

    toEnum :: Int -> ReaderError
toEnum Int
0 = ReaderError
ReaderErrorNoArray
    toEnum Int
1 = ReaderError
ReaderErrorInvalidIndex
    toEnum Int
2 = ReaderError
ReaderErrorNoObject
    toEnum Int
3 = ReaderError
ReaderErrorInvalidMember
    toEnum Int
4 = ReaderError
ReaderErrorInvalidNode
    toEnum Int
5 = ReaderError
ReaderErrorNoValue
    toEnum Int
6 = ReaderError
ReaderErrorInvalidType
    toEnum Int
k = Int -> ReaderError
AnotherReaderError Int
k

instance P.Ord ReaderError where
    compare :: ReaderError -> ReaderError -> Ordering
compare ReaderError
a ReaderError
b = Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
P.compare (ReaderError -> Int
forall a. Enum a => a -> Int
P.fromEnum ReaderError
a) (ReaderError -> Int
forall a. Enum a => a -> Int
P.fromEnum ReaderError
b)

instance GErrorClass ReaderError where
    gerrorClassDomain :: ReaderError -> Text
gerrorClassDomain ReaderError
_ = Text
"json-reader-error-quark"

-- | Catch exceptions of type `ReaderError`. This is a specialized version of `Data.GI.Base.GError.catchGErrorJustDomain`.
catchReaderError ::
    IO a ->
    (ReaderError -> GErrorMessage -> IO a) ->
    IO a
catchReaderError :: forall a. IO a -> (ReaderError -> Text -> IO a) -> IO a
catchReaderError = IO a -> (ReaderError -> Text -> IO a) -> IO a
forall err a.
GErrorClass err =>
IO a -> (err -> Text -> IO a) -> IO a
catchGErrorJustDomain

-- | Handle exceptions of type `ReaderError`. This is a specialized version of `Data.GI.Base.GError.handleGErrorJustDomain`.
handleReaderError ::
    (ReaderError -> GErrorMessage -> IO a) ->
    IO a ->
    IO a
handleReaderError :: forall a. (ReaderError -> Text -> IO a) -> IO a -> IO a
handleReaderError = (ReaderError -> Text -> IO a) -> IO a -> IO a
forall err a.
GErrorClass err =>
(err -> Text -> IO a) -> IO a -> IO a
handleGErrorJustDomain

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

foreign import ccall "json_reader_error_get_type" c_json_reader_error_get_type :: 
    IO GType

instance B.Types.TypedObject ReaderError where
    glibType :: IO GType
glibType = IO GType
c_json_reader_error_get_type

instance B.Types.BoxedEnum ReaderError

-- Enum PathError
-- | Error codes for @JSON_PATH_ERROR@.
-- 
-- This enumeration can be extended at later date
-- 
-- /Since: 0.14/
data PathError = 
      PathErrorQuery
    -- ^ Invalid query
    | AnotherPathError Int
    -- ^ Catch-all for unknown values
    deriving (Int -> PathError -> ShowS
[PathError] -> ShowS
PathError -> String
(Int -> PathError -> ShowS)
-> (PathError -> String)
-> ([PathError] -> ShowS)
-> Show PathError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PathError -> ShowS
showsPrec :: Int -> PathError -> ShowS
$cshow :: PathError -> String
show :: PathError -> String
$cshowList :: [PathError] -> ShowS
showList :: [PathError] -> ShowS
Show, PathError -> PathError -> Bool
(PathError -> PathError -> Bool)
-> (PathError -> PathError -> Bool) -> Eq PathError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PathError -> PathError -> Bool
== :: PathError -> PathError -> Bool
$c/= :: PathError -> PathError -> Bool
/= :: PathError -> PathError -> Bool
Eq)

instance P.Enum PathError where
    fromEnum :: PathError -> Int
fromEnum PathError
PathErrorQuery = Int
0
    fromEnum (AnotherPathError Int
k) = Int
k

    toEnum :: Int -> PathError
toEnum Int
0 = PathError
PathErrorQuery
    toEnum Int
k = Int -> PathError
AnotherPathError Int
k

instance P.Ord PathError where
    compare :: PathError -> PathError -> Ordering
compare PathError
a PathError
b = Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
P.compare (PathError -> Int
forall a. Enum a => a -> Int
P.fromEnum PathError
a) (PathError -> Int
forall a. Enum a => a -> Int
P.fromEnum PathError
b)

instance GErrorClass PathError where
    gerrorClassDomain :: PathError -> Text
gerrorClassDomain PathError
_ = Text
"json-path-error-quark"

-- | Catch exceptions of type `PathError`. This is a specialized version of `Data.GI.Base.GError.catchGErrorJustDomain`.
catchPathError ::
    IO a ->
    (PathError -> GErrorMessage -> IO a) ->
    IO a
catchPathError :: forall a. IO a -> (PathError -> Text -> IO a) -> IO a
catchPathError = IO a -> (PathError -> Text -> IO a) -> IO a
forall err a.
GErrorClass err =>
IO a -> (err -> Text -> IO a) -> IO a
catchGErrorJustDomain

-- | Handle exceptions of type `PathError`. This is a specialized version of `Data.GI.Base.GError.handleGErrorJustDomain`.
handlePathError ::
    (PathError -> GErrorMessage -> IO a) ->
    IO a ->
    IO a
handlePathError :: forall a. (PathError -> Text -> IO a) -> IO a -> IO a
handlePathError = (PathError -> Text -> IO a) -> IO a -> IO a
forall err a.
GErrorClass err =>
(err -> Text -> IO a) -> IO a -> IO a
handleGErrorJustDomain

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

foreign import ccall "json_path_error_get_type" c_json_path_error_get_type :: 
    IO GType

instance B.Types.TypedObject PathError where
    glibType :: IO GType
glibType = IO GType
c_json_path_error_get_type

instance B.Types.BoxedEnum PathError

-- Enum ParserError
-- | Error codes for @JSON_PARSER_ERROR@.
-- 
-- This enumeration can be extended at later date
data ParserError = 
      ParserErrorParse
    -- ^ parse error
    | ParserErrorTrailingComma
    -- ^ unexpected trailing comma
    | ParserErrorMissingComma
    -- ^ expected comma
    | ParserErrorMissingColon
    -- ^ expected colon
    | ParserErrorInvalidBareword
    -- ^ invalid bareword
    | ParserErrorEmptyMemberName
    -- ^ empty member name (Since: 0.16)
    | ParserErrorInvalidData
    -- ^ invalid data (Since: 0.18)
    | ParserErrorUnknown
    -- ^ unknown error
    | AnotherParserError Int
    -- ^ Catch-all for unknown values
    deriving (Int -> ParserError -> ShowS
[ParserError] -> ShowS
ParserError -> String
(Int -> ParserError -> ShowS)
-> (ParserError -> String)
-> ([ParserError] -> ShowS)
-> Show ParserError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ParserError -> ShowS
showsPrec :: Int -> ParserError -> ShowS
$cshow :: ParserError -> String
show :: ParserError -> String
$cshowList :: [ParserError] -> ShowS
showList :: [ParserError] -> ShowS
Show, ParserError -> ParserError -> Bool
(ParserError -> ParserError -> Bool)
-> (ParserError -> ParserError -> Bool) -> Eq ParserError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ParserError -> ParserError -> Bool
== :: ParserError -> ParserError -> Bool
$c/= :: ParserError -> ParserError -> Bool
/= :: ParserError -> ParserError -> Bool
Eq)

instance P.Enum ParserError where
    fromEnum :: ParserError -> Int
fromEnum ParserError
ParserErrorParse = Int
0
    fromEnum ParserError
ParserErrorTrailingComma = Int
1
    fromEnum ParserError
ParserErrorMissingComma = Int
2
    fromEnum ParserError
ParserErrorMissingColon = Int
3
    fromEnum ParserError
ParserErrorInvalidBareword = Int
4
    fromEnum ParserError
ParserErrorEmptyMemberName = Int
5
    fromEnum ParserError
ParserErrorInvalidData = Int
6
    fromEnum ParserError
ParserErrorUnknown = Int
7
    fromEnum (AnotherParserError Int
k) = Int
k

    toEnum :: Int -> ParserError
toEnum Int
0 = ParserError
ParserErrorParse
    toEnum Int
1 = ParserError
ParserErrorTrailingComma
    toEnum Int
2 = ParserError
ParserErrorMissingComma
    toEnum Int
3 = ParserError
ParserErrorMissingColon
    toEnum Int
4 = ParserError
ParserErrorInvalidBareword
    toEnum Int
5 = ParserError
ParserErrorEmptyMemberName
    toEnum Int
6 = ParserError
ParserErrorInvalidData
    toEnum Int
7 = ParserError
ParserErrorUnknown
    toEnum Int
k = Int -> ParserError
AnotherParserError Int
k

instance P.Ord ParserError where
    compare :: ParserError -> ParserError -> Ordering
compare ParserError
a ParserError
b = Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
P.compare (ParserError -> Int
forall a. Enum a => a -> Int
P.fromEnum ParserError
a) (ParserError -> Int
forall a. Enum a => a -> Int
P.fromEnum ParserError
b)

instance GErrorClass ParserError where
    gerrorClassDomain :: ParserError -> Text
gerrorClassDomain ParserError
_ = Text
"json-parser-error-quark"

-- | Catch exceptions of type `ParserError`. This is a specialized version of `Data.GI.Base.GError.catchGErrorJustDomain`.
catchParserError ::
    IO a ->
    (ParserError -> GErrorMessage -> IO a) ->
    IO a
catchParserError :: forall a. IO a -> (ParserError -> Text -> IO a) -> IO a
catchParserError = IO a -> (ParserError -> Text -> IO a) -> IO a
forall err a.
GErrorClass err =>
IO a -> (err -> Text -> IO a) -> IO a
catchGErrorJustDomain

-- | Handle exceptions of type `ParserError`. This is a specialized version of `Data.GI.Base.GError.handleGErrorJustDomain`.
handleParserError ::
    (ParserError -> GErrorMessage -> IO a) ->
    IO a ->
    IO a
handleParserError :: forall a. (ParserError -> Text -> IO a) -> IO a -> IO a
handleParserError = (ParserError -> Text -> IO a) -> IO a -> IO a
forall err a.
GErrorClass err =>
(err -> Text -> IO a) -> IO a -> IO a
handleGErrorJustDomain

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

foreign import ccall "json_parser_error_get_type" c_json_parser_error_get_type :: 
    IO GType

instance B.Types.TypedObject ParserError where
    glibType :: IO GType
glibType = IO GType
c_json_parser_error_get_type

instance B.Types.BoxedEnum ParserError

-- Enum NodeType
-- | Indicates the content of a node.
data NodeType = 
      NodeTypeObject
    -- ^ The node contains a JSON object
    | NodeTypeArray
    -- ^ The node contains a JSON array
    | NodeTypeValue
    -- ^ The node contains a fundamental type
    | NodeTypeNull
    -- ^ Special type, for nodes containing null
    | AnotherNodeType Int
    -- ^ Catch-all for unknown values
    deriving (Int -> NodeType -> ShowS
[NodeType] -> ShowS
NodeType -> String
(Int -> NodeType -> ShowS)
-> (NodeType -> String) -> ([NodeType] -> ShowS) -> Show NodeType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NodeType -> ShowS
showsPrec :: Int -> NodeType -> ShowS
$cshow :: NodeType -> String
show :: NodeType -> String
$cshowList :: [NodeType] -> ShowS
showList :: [NodeType] -> ShowS
Show, NodeType -> NodeType -> Bool
(NodeType -> NodeType -> Bool)
-> (NodeType -> NodeType -> Bool) -> Eq NodeType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NodeType -> NodeType -> Bool
== :: NodeType -> NodeType -> Bool
$c/= :: NodeType -> NodeType -> Bool
/= :: NodeType -> NodeType -> Bool
Eq)

instance P.Enum NodeType where
    fromEnum :: NodeType -> Int
fromEnum NodeType
NodeTypeObject = Int
0
    fromEnum NodeType
NodeTypeArray = Int
1
    fromEnum NodeType
NodeTypeValue = Int
2
    fromEnum NodeType
NodeTypeNull = Int
3
    fromEnum (AnotherNodeType Int
k) = Int
k

    toEnum :: Int -> NodeType
toEnum Int
0 = NodeType
NodeTypeObject
    toEnum Int
1 = NodeType
NodeTypeArray
    toEnum Int
2 = NodeType
NodeTypeValue
    toEnum Int
3 = NodeType
NodeTypeNull
    toEnum Int
k = Int -> NodeType
AnotherNodeType Int
k

instance P.Ord NodeType where
    compare :: NodeType -> NodeType -> Ordering
compare NodeType
a NodeType
b = Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
P.compare (NodeType -> Int
forall a. Enum a => a -> Int
P.fromEnum NodeType
a) (NodeType -> Int
forall a. Enum a => a -> Int
P.fromEnum NodeType
b)

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

foreign import ccall "json_node_type_get_type" c_json_node_type_get_type :: 
    IO GType

instance B.Types.TypedObject NodeType where
    glibType :: IO GType
glibType = IO GType
c_json_node_type_get_type

instance B.Types.BoxedEnum NodeType