-- | 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.Soup.Flags
    ( 

 -- * Flags


-- ** Cacheability #flag:Cacheability#

    Cacheability(..)                        ,


-- ** Expectation #flag:Expectation#

    Expectation(..)                         ,


-- ** MessageFlags #flag:MessageFlags#

    MessageFlags(..)                        ,


-- ** ServerListenOptions #flag:ServerListenOptions#

    ServerListenOptions(..)                 ,




    ) 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


-- Flags ServerListenOptions
-- | Options to pass to [method/@server@/.listen], etc.
-- 
-- 'GI.Soup.Flags.ServerListenOptionsIpv4Only' and 'GI.Soup.Flags.ServerListenOptionsIpv6Only'
-- only make sense with [method/@server@/.listen_all] and
-- [method/@server@/.listen_local], not plain [method/@server@/.listen] (which
-- simply listens on whatever kind of socket you give it). And you
-- cannot specify both of them in a single call.
data ServerListenOptions = 
      ServerListenOptionsHttps
    -- ^ Listen for https connections rather
    --   than plain http.
    | ServerListenOptionsIpv4Only
    -- ^ Only listen on IPv4 interfaces.
    | ServerListenOptionsIpv6Only
    -- ^ Only listen on IPv6 interfaces.
    | AnotherServerListenOptions Int
    -- ^ Catch-all for unknown values
    deriving (Int -> ServerListenOptions -> ShowS
[ServerListenOptions] -> ShowS
ServerListenOptions -> String
(Int -> ServerListenOptions -> ShowS)
-> (ServerListenOptions -> String)
-> ([ServerListenOptions] -> ShowS)
-> Show ServerListenOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ServerListenOptions -> ShowS
showsPrec :: Int -> ServerListenOptions -> ShowS
$cshow :: ServerListenOptions -> String
show :: ServerListenOptions -> String
$cshowList :: [ServerListenOptions] -> ShowS
showList :: [ServerListenOptions] -> ShowS
Show, ServerListenOptions -> ServerListenOptions -> Bool
(ServerListenOptions -> ServerListenOptions -> Bool)
-> (ServerListenOptions -> ServerListenOptions -> Bool)
-> Eq ServerListenOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ServerListenOptions -> ServerListenOptions -> Bool
== :: ServerListenOptions -> ServerListenOptions -> Bool
$c/= :: ServerListenOptions -> ServerListenOptions -> Bool
/= :: ServerListenOptions -> ServerListenOptions -> Bool
Eq)

instance P.Enum ServerListenOptions where
    fromEnum :: ServerListenOptions -> Int
fromEnum ServerListenOptions
ServerListenOptionsHttps = Int
1
    fromEnum ServerListenOptions
ServerListenOptionsIpv4Only = Int
2
    fromEnum ServerListenOptions
ServerListenOptionsIpv6Only = Int
4
    fromEnum (AnotherServerListenOptions Int
k) = Int
k

    toEnum :: Int -> ServerListenOptions
toEnum Int
1 = ServerListenOptions
ServerListenOptionsHttps
    toEnum Int
2 = ServerListenOptions
ServerListenOptionsIpv4Only
    toEnum Int
4 = ServerListenOptions
ServerListenOptionsIpv6Only
    toEnum Int
k = Int -> ServerListenOptions
AnotherServerListenOptions Int
k

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

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

foreign import ccall "soup_server_listen_options_get_type" c_soup_server_listen_options_get_type :: 
    IO GType

instance B.Types.TypedObject ServerListenOptions where
    glibType :: IO GType
glibType = IO GType
c_soup_server_listen_options_get_type

instance B.Types.BoxedFlags ServerListenOptions

instance IsGFlag ServerListenOptions

-- Flags MessageFlags
-- | Various flags that can be set on a t'GI.Soup.Objects.Message.Message' to alter its
-- behavior.
data MessageFlags = 
      MessageFlagsNoRedirect
    -- ^ The session should not follow redirect
    --   (3xx) responses received by this message.
    | MessageFlagsNewConnection
    -- ^ Requests that the message should be
    --   sent on a newly-created connection, not reusing an existing
    --   persistent connection. Note that messages with non-idempotent
    --   [property/@message@/:method]s behave this way by default, unless
    --   @/SOUP_MESSAGE_IDEMPOTENT/@ is set.
    | MessageFlagsIdempotent
    -- ^ The message is considered idempotent,
    --   regardless its [property/@message@/:method], and allows reuse of existing
    --   idle connections, instead of always requiring a new one, unless
    --   @/SOUP_MESSAGE_NEW_CONNECTION/@ is set.
    | MessageFlagsDoNotUseAuthCache
    -- ^ The [class/@authManager@/] should not use
    --   the credentials cache for this message, neither to use cached credentials
    --   to automatically authenticate this message nor to cache the credentials
    --   after the message is successfully authenticated. This applies to both server
    --   and proxy authentication. Note that [signal/@message@/[authenticate](#g:signal:authenticate)] signal will
    --   be emitted, if you want to disable authentication for a message use
    --   [method/@message@/.disable_feature] passing @/SOUP_TYPE_AUTH_MANAGER/@ instead.
    | MessageFlagsCollectMetrics
    -- ^ Metrics will be collected for this message.
    | AnotherMessageFlags Int
    -- ^ Catch-all for unknown values
    deriving (Int -> MessageFlags -> ShowS
[MessageFlags] -> ShowS
MessageFlags -> String
(Int -> MessageFlags -> ShowS)
-> (MessageFlags -> String)
-> ([MessageFlags] -> ShowS)
-> Show MessageFlags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MessageFlags -> ShowS
showsPrec :: Int -> MessageFlags -> ShowS
$cshow :: MessageFlags -> String
show :: MessageFlags -> String
$cshowList :: [MessageFlags] -> ShowS
showList :: [MessageFlags] -> ShowS
Show, MessageFlags -> MessageFlags -> Bool
(MessageFlags -> MessageFlags -> Bool)
-> (MessageFlags -> MessageFlags -> Bool) -> Eq MessageFlags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MessageFlags -> MessageFlags -> Bool
== :: MessageFlags -> MessageFlags -> Bool
$c/= :: MessageFlags -> MessageFlags -> Bool
/= :: MessageFlags -> MessageFlags -> Bool
Eq)

instance P.Enum MessageFlags where
    fromEnum :: MessageFlags -> Int
fromEnum MessageFlags
MessageFlagsNoRedirect = Int
2
    fromEnum MessageFlags
MessageFlagsNewConnection = Int
4
    fromEnum MessageFlags
MessageFlagsIdempotent = Int
8
    fromEnum MessageFlags
MessageFlagsDoNotUseAuthCache = Int
16
    fromEnum MessageFlags
MessageFlagsCollectMetrics = Int
32
    fromEnum (AnotherMessageFlags Int
k) = Int
k

    toEnum :: Int -> MessageFlags
toEnum Int
2 = MessageFlags
MessageFlagsNoRedirect
    toEnum Int
4 = MessageFlags
MessageFlagsNewConnection
    toEnum Int
8 = MessageFlags
MessageFlagsIdempotent
    toEnum Int
16 = MessageFlags
MessageFlagsDoNotUseAuthCache
    toEnum Int
32 = MessageFlags
MessageFlagsCollectMetrics
    toEnum Int
k = Int -> MessageFlags
AnotherMessageFlags Int
k

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

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

foreign import ccall "soup_message_flags_get_type" c_soup_message_flags_get_type :: 
    IO GType

instance B.Types.TypedObject MessageFlags where
    glibType :: IO GType
glibType = IO GType
c_soup_message_flags_get_type

instance B.Types.BoxedFlags MessageFlags

instance IsGFlag MessageFlags

-- Flags Expectation
-- | Represents the parsed value of the \"Expect\" header.
data Expectation = 
      ExpectationUnrecognized
    -- ^ any unrecognized expectation
    | ExpectationContinue
    -- ^ \"100-continue\"
    | AnotherExpectation Int
    -- ^ Catch-all for unknown values
    deriving (Int -> Expectation -> ShowS
[Expectation] -> ShowS
Expectation -> String
(Int -> Expectation -> ShowS)
-> (Expectation -> String)
-> ([Expectation] -> ShowS)
-> Show Expectation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Expectation -> ShowS
showsPrec :: Int -> Expectation -> ShowS
$cshow :: Expectation -> String
show :: Expectation -> String
$cshowList :: [Expectation] -> ShowS
showList :: [Expectation] -> ShowS
Show, Expectation -> Expectation -> Bool
(Expectation -> Expectation -> Bool)
-> (Expectation -> Expectation -> Bool) -> Eq Expectation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Expectation -> Expectation -> Bool
== :: Expectation -> Expectation -> Bool
$c/= :: Expectation -> Expectation -> Bool
/= :: Expectation -> Expectation -> Bool
Eq)

instance P.Enum Expectation where
    fromEnum :: Expectation -> Int
fromEnum Expectation
ExpectationUnrecognized = Int
1
    fromEnum Expectation
ExpectationContinue = Int
2
    fromEnum (AnotherExpectation Int
k) = Int
k

    toEnum :: Int -> Expectation
toEnum Int
1 = Expectation
ExpectationUnrecognized
    toEnum Int
2 = Expectation
ExpectationContinue
    toEnum Int
k = Int -> Expectation
AnotherExpectation Int
k

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

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

foreign import ccall "soup_expectation_get_type" c_soup_expectation_get_type :: 
    IO GType

instance B.Types.TypedObject Expectation where
    glibType :: IO GType
glibType = IO GType
c_soup_expectation_get_type

instance B.Types.BoxedFlags Expectation

instance IsGFlag Expectation

-- Flags Cacheability
-- | Indicates if a message should or shouldn\'t be cached.
data Cacheability = 
      CacheabilityCacheable
    -- ^ The message should be cached
    | CacheabilityUncacheable
    -- ^ The message shouldn\'t be cached
    | CacheabilityInvalidates
    -- ^ The messages cache should be invalidated
    | CacheabilityValidates
    -- ^ The messages cache should be updated
    | AnotherCacheability Int
    -- ^ Catch-all for unknown values
    deriving (Int -> Cacheability -> ShowS
[Cacheability] -> ShowS
Cacheability -> String
(Int -> Cacheability -> ShowS)
-> (Cacheability -> String)
-> ([Cacheability] -> ShowS)
-> Show Cacheability
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Cacheability -> ShowS
showsPrec :: Int -> Cacheability -> ShowS
$cshow :: Cacheability -> String
show :: Cacheability -> String
$cshowList :: [Cacheability] -> ShowS
showList :: [Cacheability] -> ShowS
Show, Cacheability -> Cacheability -> Bool
(Cacheability -> Cacheability -> Bool)
-> (Cacheability -> Cacheability -> Bool) -> Eq Cacheability
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Cacheability -> Cacheability -> Bool
== :: Cacheability -> Cacheability -> Bool
$c/= :: Cacheability -> Cacheability -> Bool
/= :: Cacheability -> Cacheability -> Bool
Eq)

instance P.Enum Cacheability where
    fromEnum :: Cacheability -> Int
fromEnum Cacheability
CacheabilityCacheable = Int
1
    fromEnum Cacheability
CacheabilityUncacheable = Int
2
    fromEnum Cacheability
CacheabilityInvalidates = Int
4
    fromEnum Cacheability
CacheabilityValidates = Int
8
    fromEnum (AnotherCacheability Int
k) = Int
k

    toEnum :: Int -> Cacheability
toEnum Int
1 = Cacheability
CacheabilityCacheable
    toEnum Int
2 = Cacheability
CacheabilityUncacheable
    toEnum Int
4 = Cacheability
CacheabilityInvalidates
    toEnum Int
8 = Cacheability
CacheabilityValidates
    toEnum Int
k = Int -> Cacheability
AnotherCacheability Int
k

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

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

foreign import ccall "soup_cacheability_get_type" c_soup_cacheability_get_type :: 
    IO GType

instance B.Types.TypedObject Cacheability where
    glibType :: IO GType
glibType = IO GType
c_soup_cacheability_get_type

instance B.Types.BoxedFlags Cacheability

instance IsGFlag Cacheability