{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
-}

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

module GI.GIRepository.Enums
    (

 -- * Enumerations
-- ** ArrayType #enum:ArrayType#

    ArrayType(..)                           ,


-- ** Direction #enum:Direction#

    Direction(..)                           ,


-- ** InfoType #enum:InfoType#

    InfoType(..)                            ,


-- ** NvokeError #enum:NvokeError#

    NvokeError(..)                          ,


-- ** RepositoryError #enum:RepositoryError#

    RepositoryError(..)                     ,


-- ** ScopeType #enum:ScopeType#

    ScopeType(..)                           ,


-- ** Transfer #enum:Transfer#

    Transfer(..)                            ,


-- ** TypeTag #enum:TypeTag#

    TypeTag(..)                             ,




    ) 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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.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


-- Enum nvokeError
{- |
An error occuring while invoking a function via
@/g_function_info_invoke()/@.
-}
data NvokeError =
      NvokeErrorFailed
    {- ^
    invokation failed, unknown error.
    -}
    | NvokeErrorSymbolNotFound
    {- ^
    symbol couldn\'t be found in any of the
    libraries associated with the typelib of the function.
    -}
    | NvokeErrorArgumentMismatch
    {- ^
    the arguments provided didn\'t match
    the expected arguments for the functions type signature.
    -}
    | AnotherNvokeError Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum NvokeError where
    fromEnum NvokeErrorFailed = 0
    fromEnum NvokeErrorSymbolNotFound = 1
    fromEnum NvokeErrorArgumentMismatch = 2
    fromEnum (AnotherNvokeError k) = k

    toEnum 0 = NvokeErrorFailed
    toEnum 1 = NvokeErrorSymbolNotFound
    toEnum 2 = NvokeErrorArgumentMismatch
    toEnum k = AnotherNvokeError k

instance P.Ord NvokeError where
    compare a b = P.compare (P.fromEnum a) (P.fromEnum b)

-- Enum TypeTag
{- |
The type tag of a @/GITypeInfo/@.
-}
data TypeTag =
      TypeTagVoid
    {- ^
    void
    -}
    | TypeTagBoolean
    {- ^
    boolean
    -}
    | TypeTagInt8
    {- ^
    8-bit signed integer
    -}
    | TypeTagUint8
    {- ^
    8-bit unsigned integer
    -}
    | TypeTagInt16
    {- ^
    16-bit signed integer
    -}
    | TypeTagUint16
    {- ^
    16-bit unsigned integer
    -}
    | TypeTagInt32
    {- ^
    32-bit signed integer
    -}
    | TypeTagUint32
    {- ^
    32-bit unsigned integer
    -}
    | TypeTagInt64
    {- ^
    64-bit signed integer
    -}
    | TypeTagUint64
    {- ^
    64-bit unsigned integer
    -}
    | TypeTagFloat
    {- ^
    float
    -}
    | TypeTagDouble
    {- ^
    double floating point
    -}
    | TypeTagGtype
    {- ^
    a 'GType'
    -}
    | TypeTagUtf8
    {- ^
    a UTF-8 encoded string
    -}
    | TypeTagFilename
    {- ^
    a filename, encoded in the same encoding
      as the native filesystem is using.
    -}
    | TypeTagArray
    {- ^
    an array
    -}
    | TypeTagInterface
    {- ^
    an extended interface object
    -}
    | TypeTagGlist
    {- ^
    a 'GI.GLib.Structs.List.List'
    -}
    | TypeTagGslist
    {- ^
    a 'GI.GLib.Structs.SList.SList'
    -}
    | TypeTagGhash
    {- ^
    a 'GI.GLib.Structs.HashTable.HashTable'
    -}
    | TypeTagError
    {- ^
    a 'GError'
    -}
    | TypeTagUnichar
    {- ^
    Unicode character
    -}
    | AnotherTypeTag Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum TypeTag where
    fromEnum TypeTagVoid = 0
    fromEnum TypeTagBoolean = 1
    fromEnum TypeTagInt8 = 2
    fromEnum TypeTagUint8 = 3
    fromEnum TypeTagInt16 = 4
    fromEnum TypeTagUint16 = 5
    fromEnum TypeTagInt32 = 6
    fromEnum TypeTagUint32 = 7
    fromEnum TypeTagInt64 = 8
    fromEnum TypeTagUint64 = 9
    fromEnum TypeTagFloat = 10
    fromEnum TypeTagDouble = 11
    fromEnum TypeTagGtype = 12
    fromEnum TypeTagUtf8 = 13
    fromEnum TypeTagFilename = 14
    fromEnum TypeTagArray = 15
    fromEnum TypeTagInterface = 16
    fromEnum TypeTagGlist = 17
    fromEnum TypeTagGslist = 18
    fromEnum TypeTagGhash = 19
    fromEnum TypeTagError = 20
    fromEnum TypeTagUnichar = 21
    fromEnum (AnotherTypeTag k) = k

    toEnum 0 = TypeTagVoid
    toEnum 1 = TypeTagBoolean
    toEnum 2 = TypeTagInt8
    toEnum 3 = TypeTagUint8
    toEnum 4 = TypeTagInt16
    toEnum 5 = TypeTagUint16
    toEnum 6 = TypeTagInt32
    toEnum 7 = TypeTagUint32
    toEnum 8 = TypeTagInt64
    toEnum 9 = TypeTagUint64
    toEnum 10 = TypeTagFloat
    toEnum 11 = TypeTagDouble
    toEnum 12 = TypeTagGtype
    toEnum 13 = TypeTagUtf8
    toEnum 14 = TypeTagFilename
    toEnum 15 = TypeTagArray
    toEnum 16 = TypeTagInterface
    toEnum 17 = TypeTagGlist
    toEnum 18 = TypeTagGslist
    toEnum 19 = TypeTagGhash
    toEnum 20 = TypeTagError
    toEnum 21 = TypeTagUnichar
    toEnum k = AnotherTypeTag k

instance P.Ord TypeTag where
    compare a b = P.compare (P.fromEnum a) (P.fromEnum b)

-- Enum Transfer
{- |
The transfer is the exchange of data between two parts, from the callee to
the caller. The callee is either a function\/method\/signal or an
object\/interface where a property is defined. The caller is the side
accessing a property or calling a function.
'GI.GIRepository.Enums.Transfer' specifies who\'s responsible for freeing the resources after the
ownership transfer is complete. In case of a containing type such as a list,
an array or a hash table the container itself is specified differently from
the items within the container itself. Each container is freed differently,
check the documentation for the types themselves for information on how to
free them.
-}
data Transfer =
      TransferNothing
    {- ^
    transfer nothing from the callee (function or the type
    instance the property belongs to) to the caller. The callee retains the
    ownership of the transfer and the caller doesn\'t need to do anything to free
    up the resources of this transfer.
    -}
    | TransferContainer
    {- ^
    transfer the container (list, array, hash table) from
    the callee to the caller. The callee retains the ownership of the individual
    items in the container and the caller has to free up the container resources
    (@/g_list_free()/@\/'GI.GLib.Functions.hashTableDestroy' etc) of this transfer.
    -}
    | TransferEverything
    {- ^
    transfer everything, eg the container and its
    contents from the callee to the caller. This is the case when the callee
    creates a copy of all the data it returns. The caller is responsible for
    cleaning up the container and item resources of this transfer.
    -}
    | AnotherTransfer Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum Transfer where
    fromEnum TransferNothing = 0
    fromEnum TransferContainer = 1
    fromEnum TransferEverything = 2
    fromEnum (AnotherTransfer k) = k

    toEnum 0 = TransferNothing
    toEnum 1 = TransferContainer
    toEnum 2 = TransferEverything
    toEnum k = AnotherTransfer k

instance P.Ord Transfer where
    compare a b = P.compare (P.fromEnum a) (P.fromEnum b)

-- Enum ScopeType
{- |
Scope type of a @/GIArgInfo/@ representing callback, determines how the
callback is invoked and is used to decided when the invoke structs
can be freed.
-}
data ScopeType =
      ScopeTypeInvalid
    {- ^
    The argument is not of callback type.
    -}
    | ScopeTypeCall
    {- ^
    The callback and associated user_data is only
    used during the call to this function.
    -}
    | ScopeTypeAsync
    {- ^
    The callback and associated user_data is
    only used until the callback is invoked, and the callback.
    is invoked always exactly once.
    -}
    | ScopeTypeNotified
    {- ^
    The callback and and associated
    user_data is used until the caller is notfied via the destroy_notify.
    -}
    | AnotherScopeType Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum ScopeType where
    fromEnum ScopeTypeInvalid = 0
    fromEnum ScopeTypeCall = 1
    fromEnum ScopeTypeAsync = 2
    fromEnum ScopeTypeNotified = 3
    fromEnum (AnotherScopeType k) = k

    toEnum 0 = ScopeTypeInvalid
    toEnum 1 = ScopeTypeCall
    toEnum 2 = ScopeTypeAsync
    toEnum 3 = ScopeTypeNotified
    toEnum k = AnotherScopeType k

instance P.Ord ScopeType where
    compare a b = P.compare (P.fromEnum a) (P.fromEnum b)

-- Enum RepositoryError
{- |
An error code used with @/G_IREPOSITORY_ERROR/@ in a 'GError' returned
from a 'GI.GIRepository.Objects.Repository.Repository' routine.
-}
data RepositoryError =
      RepositoryErrorTypelibNotFound
    {- ^
    the typelib could not be found.
    -}
    | RepositoryErrorNamespaceMismatch
    {- ^
    the namespace does not match the
      requested namespace.
    -}
    | RepositoryErrorNamespaceVersionConflict
    {- ^
    the version of the
      typelib does not match the requested version.
    -}
    | RepositoryErrorLibraryNotFound
    {- ^
    the library used by the typelib
      could not be found.
    -}
    | AnotherRepositoryError Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum RepositoryError where
    fromEnum RepositoryErrorTypelibNotFound = 0
    fromEnum RepositoryErrorNamespaceMismatch = 1
    fromEnum RepositoryErrorNamespaceVersionConflict = 2
    fromEnum RepositoryErrorLibraryNotFound = 3
    fromEnum (AnotherRepositoryError k) = k

    toEnum 0 = RepositoryErrorTypelibNotFound
    toEnum 1 = RepositoryErrorNamespaceMismatch
    toEnum 2 = RepositoryErrorNamespaceVersionConflict
    toEnum 3 = RepositoryErrorLibraryNotFound
    toEnum k = AnotherRepositoryError k

instance P.Ord RepositoryError where
    compare a b = P.compare (P.fromEnum a) (P.fromEnum b)

-- Enum InfoType
{- |
The type of a GIBaseInfo struct.
-}
data InfoType =
      InfoTypeInvalid
    {- ^
    invalid type
    -}
    | InfoTypeFunction
    {- ^
    function, see @/GIFunctionInfo/@
    -}
    | InfoTypeCallback
    {- ^
    callback, see @/GIFunctionInfo/@
    -}
    | InfoTypeStruct
    {- ^
    struct, see @/GIStructInfo/@
    -}
    | InfoTypeBoxed
    {- ^
    boxed, see @/GIStructInfo/@ or @/GIUnionInfo/@
    -}
    | InfoTypeEnum
    {- ^
    enum, see @/GIEnumInfo/@
    -}
    | InfoTypeFlags
    {- ^
    flags, see @/GIEnumInfo/@
    -}
    | InfoTypeObject
    {- ^
    object, see @/GIObjectInfo/@
    -}
    | InfoTypeInterface
    {- ^
    interface, see @/GIInterfaceInfo/@
    -}
    | InfoTypeConstant
    {- ^
    contant, see @/GIConstantInfo/@
    -}
    | InfoTypeInvalid0
    {- ^
    deleted, used to be GI_INFO_TYPE_ERROR_DOMAIN.
    -}
    | InfoTypeUnion
    {- ^
    union, see @/GIUnionInfo/@
    -}
    | InfoTypeValue
    {- ^
    enum value, see @/GIValueInfo/@
    -}
    | InfoTypeSignal
    {- ^
    signal, see @/GISignalInfo/@
    -}
    | InfoTypeVfunc
    {- ^
    virtual function, see @/GIVFuncInfo/@
    -}
    | InfoTypeProperty
    {- ^
    GObject property, see @/GIPropertyInfo/@
    -}
    | InfoTypeField
    {- ^
    struct or union field, see @/GIFieldInfo/@
    -}
    | InfoTypeArg
    {- ^
    argument of a function or callback, see @/GIArgInfo/@
    -}
    | InfoTypeType
    {- ^
    type information, see @/GITypeInfo/@
    -}
    | InfoTypeUnresolved
    {- ^
    unresolved type, a type which is not present in
      the typelib, or any of its dependencies.
    -}
    | AnotherInfoType Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum InfoType where
    fromEnum InfoTypeInvalid = 0
    fromEnum InfoTypeFunction = 1
    fromEnum InfoTypeCallback = 2
    fromEnum InfoTypeStruct = 3
    fromEnum InfoTypeBoxed = 4
    fromEnum InfoTypeEnum = 5
    fromEnum InfoTypeFlags = 6
    fromEnum InfoTypeObject = 7
    fromEnum InfoTypeInterface = 8
    fromEnum InfoTypeConstant = 9
    fromEnum InfoTypeInvalid0 = 10
    fromEnum InfoTypeUnion = 11
    fromEnum InfoTypeValue = 12
    fromEnum InfoTypeSignal = 13
    fromEnum InfoTypeVfunc = 14
    fromEnum InfoTypeProperty = 15
    fromEnum InfoTypeField = 16
    fromEnum InfoTypeArg = 17
    fromEnum InfoTypeType = 18
    fromEnum InfoTypeUnresolved = 19
    fromEnum (AnotherInfoType k) = k

    toEnum 0 = InfoTypeInvalid
    toEnum 1 = InfoTypeFunction
    toEnum 2 = InfoTypeCallback
    toEnum 3 = InfoTypeStruct
    toEnum 4 = InfoTypeBoxed
    toEnum 5 = InfoTypeEnum
    toEnum 6 = InfoTypeFlags
    toEnum 7 = InfoTypeObject
    toEnum 8 = InfoTypeInterface
    toEnum 9 = InfoTypeConstant
    toEnum 10 = InfoTypeInvalid0
    toEnum 11 = InfoTypeUnion
    toEnum 12 = InfoTypeValue
    toEnum 13 = InfoTypeSignal
    toEnum 14 = InfoTypeVfunc
    toEnum 15 = InfoTypeProperty
    toEnum 16 = InfoTypeField
    toEnum 17 = InfoTypeArg
    toEnum 18 = InfoTypeType
    toEnum 19 = InfoTypeUnresolved
    toEnum k = AnotherInfoType k

instance P.Ord InfoType where
    compare a b = P.compare (P.fromEnum a) (P.fromEnum b)

-- Enum Direction
{- |
The direction of a @/GIArgInfo/@.
-}
data Direction =
      DirectionIn
    {- ^
    in argument.
    -}
    | DirectionOut
    {- ^
    out argument.
    -}
    | DirectionInout
    {- ^
    in and out argument.
    -}
    | AnotherDirection Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum Direction where
    fromEnum DirectionIn = 0
    fromEnum DirectionOut = 1
    fromEnum DirectionInout = 2
    fromEnum (AnotherDirection k) = k

    toEnum 0 = DirectionIn
    toEnum 1 = DirectionOut
    toEnum 2 = DirectionInout
    toEnum k = AnotherDirection k

instance P.Ord Direction where
    compare a b = P.compare (P.fromEnum a) (P.fromEnum b)

-- Enum ArrayType
{- |
The type of array in a @/GITypeInfo/@.
-}
data ArrayType =
      ArrayTypeC
    {- ^
    a C array, char[] for instance
    -}
    | ArrayTypeArray
    {- ^
    a /@gArray@/ array
    -}
    | ArrayTypePtrArray
    {- ^
    a 'GI.GLib.Structs.PtrArray.PtrArray' array
    -}
    | ArrayTypeByteArray
    {- ^
    a 'GI.GLib.Structs.ByteArray.ByteArray' array
    -}
    | AnotherArrayType Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum ArrayType where
    fromEnum ArrayTypeC = 0
    fromEnum ArrayTypeArray = 1
    fromEnum ArrayTypePtrArray = 2
    fromEnum ArrayTypeByteArray = 3
    fromEnum (AnotherArrayType k) = k

    toEnum 0 = ArrayTypeC
    toEnum 1 = ArrayTypeArray
    toEnum 2 = ArrayTypePtrArray
    toEnum 3 = ArrayTypeByteArray
    toEnum k = AnotherArrayType k

instance P.Ord ArrayType where
    compare a b = P.compare (P.fromEnum a) (P.fromEnum b)