-- | 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.Secret.Enums
    ( 

 -- * Enumerations


-- ** BackendFlags #enum:BackendFlags#

    BackendFlags(..)                        ,


-- ** Error #enum:Error#

    Error(..)                               ,


-- ** SchemaAttributeType #enum:SchemaAttributeType#

    SchemaAttributeType(..)                 ,


-- ** SchemaType #enum:SchemaType#

    SchemaType(..)                          ,




    ) 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


-- Enum SchemaType
-- | Different types of schemas for storing secrets, intended for use with
-- [func/@getSchema@/].
-- 
-- == /@sECRETSCHEMANOTE@/
-- 
-- A predefined schema for personal passwords stored by the user in the
-- password manager. This schema has no attributes, and the items are not
-- meant to be used automatically by applications.
-- 
-- When used to search for items using this schema, it will only match
-- items that have the same schema. Items stored via libgnome-keyring with the
-- @GNOME_KEYRING_ITEM_NOTE@ item type will match.
-- 
-- == /@sECRETSCHEMACOMPATNETWORK@/
-- 
-- A predefined schema that is compatible with items stored via the
-- libgnome-keyring \'network password\' functions. This is meant to be used by
-- applications migrating from libgnome-keyring which stored their secrets as
-- \'network passwords\'. It is not recommended that new code use this schema.
-- 
-- When used to search for items using this schema, it will only match
-- items that have the same schema. Items stored via libgnome-keyring with the
-- @GNOME_KEYRING_ITEM_NETWORK_PASSWORD@ item type will match.
-- 
-- The following attributes exist in the schema:
-- 
-- === Attributes:
-- 
-- \<table>
--     \<tr>
--         \<td>\<tt>user\<\/tt>:\<\/td>
--         \<td>The user name (string).\<\/td>
--     \<\/tr>
--     \<tr>
--         \<td>\<tt>domain\<\/tt>:\<\/td>
--         \<td>The login domain or realm (string).\<\/td>\<\/tr>
--     \<tr>
--         \<td>\<tt>object\<\/tt>:\<\/td>
--         \<td>The object or path (string).\<\/td>
--     \<\/tr>
--     \<tr>
--         \<td>\<tt>protocol\<\/tt>:\<\/td>
--         \<td>The protocol (a string like \'http\').\<\/td>
--     \<\/tr>
--     \<tr>
--         \<td>\<tt>port\<\/tt>:\<\/td>
--         \<td>The network port (integer).\<\/td>
--     \<\/tr>
--     \<tr>
--         \<td>\<tt>server\<\/tt>:\<\/td>
--         \<td>The hostname or server (string).\<\/td>
--     \<\/tr>
--     \<tr>
--         \<td>\<tt>authtype\<\/tt>:\<\/td>
--         \<td>The authentication type (string).\<\/td>
--     \<\/tr>
-- \<\/table>
-- 
-- /Since: 0.18.6/
data SchemaType = 
      SchemaTypeNote
    -- ^ Personal passwords
    | SchemaTypeCompatNetwork
    -- ^ Network passwords from older
    --    libgnome-keyring storage
    | AnotherSchemaType Int
    -- ^ Catch-all for unknown values
    deriving (Int -> SchemaType -> ShowS
[SchemaType] -> ShowS
SchemaType -> String
(Int -> SchemaType -> ShowS)
-> (SchemaType -> String)
-> ([SchemaType] -> ShowS)
-> Show SchemaType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SchemaType -> ShowS
showsPrec :: Int -> SchemaType -> ShowS
$cshow :: SchemaType -> String
show :: SchemaType -> String
$cshowList :: [SchemaType] -> ShowS
showList :: [SchemaType] -> ShowS
Show, SchemaType -> SchemaType -> Bool
(SchemaType -> SchemaType -> Bool)
-> (SchemaType -> SchemaType -> Bool) -> Eq SchemaType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SchemaType -> SchemaType -> Bool
== :: SchemaType -> SchemaType -> Bool
$c/= :: SchemaType -> SchemaType -> Bool
/= :: SchemaType -> SchemaType -> Bool
Eq)

instance P.Enum SchemaType where
    fromEnum :: SchemaType -> Int
fromEnum SchemaType
SchemaTypeNote = Int
0
    fromEnum SchemaType
SchemaTypeCompatNetwork = Int
1
    fromEnum (AnotherSchemaType Int
k) = Int
k

    toEnum :: Int -> SchemaType
toEnum Int
0 = SchemaType
SchemaTypeNote
    toEnum Int
1 = SchemaType
SchemaTypeCompatNetwork
    toEnum Int
k = Int -> SchemaType
AnotherSchemaType Int
k

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

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

foreign import ccall "secret_schema_type_get_type" c_secret_schema_type_get_type :: 
    IO GType

instance B.Types.TypedObject SchemaType where
    glibType :: IO GType
glibType = IO GType
c_secret_schema_type_get_type

instance B.Types.BoxedEnum SchemaType

-- Enum SchemaAttributeType
-- | The type of an attribute in a [struct/@secretSchema@/].
-- 
-- Attributes are stored as strings in the Secret Service, and the attribute
-- types simply define standard ways to store integer and boolean values as
-- strings.
data SchemaAttributeType = 
      SchemaAttributeTypeString
    -- ^ a utf-8 string attribute
    | SchemaAttributeTypeInteger
    -- ^ an integer attribute, stored as a decimal
    | SchemaAttributeTypeBoolean
    -- ^ a boolean attribute, stored as \'true\' or \'false\'
    | AnotherSchemaAttributeType Int
    -- ^ Catch-all for unknown values
    deriving (Int -> SchemaAttributeType -> ShowS
[SchemaAttributeType] -> ShowS
SchemaAttributeType -> String
(Int -> SchemaAttributeType -> ShowS)
-> (SchemaAttributeType -> String)
-> ([SchemaAttributeType] -> ShowS)
-> Show SchemaAttributeType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SchemaAttributeType -> ShowS
showsPrec :: Int -> SchemaAttributeType -> ShowS
$cshow :: SchemaAttributeType -> String
show :: SchemaAttributeType -> String
$cshowList :: [SchemaAttributeType] -> ShowS
showList :: [SchemaAttributeType] -> ShowS
Show, SchemaAttributeType -> SchemaAttributeType -> Bool
(SchemaAttributeType -> SchemaAttributeType -> Bool)
-> (SchemaAttributeType -> SchemaAttributeType -> Bool)
-> Eq SchemaAttributeType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SchemaAttributeType -> SchemaAttributeType -> Bool
== :: SchemaAttributeType -> SchemaAttributeType -> Bool
$c/= :: SchemaAttributeType -> SchemaAttributeType -> Bool
/= :: SchemaAttributeType -> SchemaAttributeType -> Bool
Eq)

instance P.Enum SchemaAttributeType where
    fromEnum :: SchemaAttributeType -> Int
fromEnum SchemaAttributeType
SchemaAttributeTypeString = Int
0
    fromEnum SchemaAttributeType
SchemaAttributeTypeInteger = Int
1
    fromEnum SchemaAttributeType
SchemaAttributeTypeBoolean = Int
2
    fromEnum (AnotherSchemaAttributeType Int
k) = Int
k

    toEnum :: Int -> SchemaAttributeType
toEnum Int
0 = SchemaAttributeType
SchemaAttributeTypeString
    toEnum Int
1 = SchemaAttributeType
SchemaAttributeTypeInteger
    toEnum Int
2 = SchemaAttributeType
SchemaAttributeTypeBoolean
    toEnum Int
k = Int -> SchemaAttributeType
AnotherSchemaAttributeType Int
k

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

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

foreign import ccall "secret_schema_attribute_type_get_type" c_secret_schema_attribute_type_get_type :: 
    IO GType

instance B.Types.TypedObject SchemaAttributeType where
    glibType :: IO GType
glibType = IO GType
c_secret_schema_attribute_type_get_type

instance B.Types.BoxedEnum SchemaAttributeType

-- Enum Error
-- | Errors returned by the Secret Service.
-- 
-- None of the errors are appropriate for display to the user. It is up to the
-- application to handle them appropriately.
data Error = 
      ErrorProtocol
    -- ^ received an invalid data or message from the Secret
    --   Service
    | ErrorIsLocked
    -- ^ the item or collection is locked and the operation
    --   cannot be performed
    | ErrorNoSuchObject
    -- ^ no such item or collection found in the Secret
    --   Service
    | ErrorAlreadyExists
    -- ^ a relevant item or collection already exists
    | ErrorInvalidFileFormat
    -- ^ the file format is not valid
    | AnotherError Int
    -- ^ Catch-all for unknown values
    deriving (Int -> Error -> ShowS
[Error] -> ShowS
Error -> String
(Int -> Error -> ShowS)
-> (Error -> String) -> ([Error] -> ShowS) -> Show Error
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Error -> ShowS
showsPrec :: Int -> Error -> ShowS
$cshow :: Error -> String
show :: Error -> String
$cshowList :: [Error] -> ShowS
showList :: [Error] -> ShowS
Show, Error -> Error -> Bool
(Error -> Error -> Bool) -> (Error -> Error -> Bool) -> Eq Error
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Error -> Error -> Bool
== :: Error -> Error -> Bool
$c/= :: Error -> Error -> Bool
/= :: Error -> Error -> Bool
Eq)

instance P.Enum Error where
    fromEnum :: Error -> Int
fromEnum Error
ErrorProtocol = Int
1
    fromEnum Error
ErrorIsLocked = Int
2
    fromEnum Error
ErrorNoSuchObject = Int
3
    fromEnum Error
ErrorAlreadyExists = Int
4
    fromEnum Error
ErrorInvalidFileFormat = Int
5
    fromEnum (AnotherError Int
k) = Int
k

    toEnum :: Int -> Error
toEnum Int
1 = Error
ErrorProtocol
    toEnum Int
2 = Error
ErrorIsLocked
    toEnum Int
3 = Error
ErrorNoSuchObject
    toEnum Int
4 = Error
ErrorAlreadyExists
    toEnum Int
5 = Error
ErrorInvalidFileFormat
    toEnum Int
k = Int -> Error
AnotherError Int
k

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

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

foreign import ccall "secret_error_get_type" c_secret_error_get_type :: 
    IO GType

instance B.Types.TypedObject Error where
    glibType :: IO GType
glibType = IO GType
c_secret_error_get_type

instance B.Types.BoxedEnum Error

-- Enum BackendFlags
-- | Flags which determine which parts of the t'GI.Secret.Interfaces.Backend.Backend' are initialized.
-- 
-- /Since: 0.19.0/
data BackendFlags = 
      BackendFlagsNone
    -- ^ no flags for initializing the t'GI.Secret.Interfaces.Backend.Backend'
    | BackendFlagsOpenSession
    -- ^ establish a session for transfer of secrets
    --   while initializing the t'GI.Secret.Interfaces.Backend.Backend'
    | BackendFlagsLoadCollections
    -- ^ load collections while initializing the
    --   t'GI.Secret.Interfaces.Backend.Backend'
    | AnotherBackendFlags Int
    -- ^ Catch-all for unknown values
    deriving (Int -> BackendFlags -> ShowS
[BackendFlags] -> ShowS
BackendFlags -> String
(Int -> BackendFlags -> ShowS)
-> (BackendFlags -> String)
-> ([BackendFlags] -> ShowS)
-> Show BackendFlags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BackendFlags -> ShowS
showsPrec :: Int -> BackendFlags -> ShowS
$cshow :: BackendFlags -> String
show :: BackendFlags -> String
$cshowList :: [BackendFlags] -> ShowS
showList :: [BackendFlags] -> ShowS
Show, BackendFlags -> BackendFlags -> Bool
(BackendFlags -> BackendFlags -> Bool)
-> (BackendFlags -> BackendFlags -> Bool) -> Eq BackendFlags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BackendFlags -> BackendFlags -> Bool
== :: BackendFlags -> BackendFlags -> Bool
$c/= :: BackendFlags -> BackendFlags -> Bool
/= :: BackendFlags -> BackendFlags -> Bool
Eq)

instance P.Enum BackendFlags where
    fromEnum :: BackendFlags -> Int
fromEnum BackendFlags
BackendFlagsNone = Int
0
    fromEnum BackendFlags
BackendFlagsOpenSession = Int
2
    fromEnum BackendFlags
BackendFlagsLoadCollections = Int
4
    fromEnum (AnotherBackendFlags Int
k) = Int
k

    toEnum :: Int -> BackendFlags
toEnum Int
0 = BackendFlags
BackendFlagsNone
    toEnum Int
2 = BackendFlags
BackendFlagsOpenSession
    toEnum Int
4 = BackendFlags
BackendFlagsLoadCollections
    toEnum Int
k = Int -> BackendFlags
AnotherBackendFlags Int
k

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

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

foreign import ccall "secret_backend_flags_get_type" c_secret_backend_flags_get_type :: 
    IO GType

instance B.Types.TypedObject BackendFlags where
    glibType :: IO GType
glibType = IO GType
c_secret_backend_flags_get_type

instance B.Types.BoxedEnum BackendFlags