{-# LANGUAGE DeriveGeneric #-}
module LDAPv3.ResultCode (ResultCode(..)) where
import Common
import Data.ASN1 (Enumerated (..))
import qualified Data.Map.Strict as Map
import Data.Tuple (swap)
fromEnumeratedMap :: Map.Map ResultCode Int64
= [(ResultCode, Int64)] -> Map ResultCode Int64
forall k a. Eq k => [(k, a)] -> Map k a
Map.fromAscList [(ResultCode, Int64)]
mapping
toEnumeratedMap :: Map.Map Int64 ResultCode
toEnumeratedMap :: Map Int64 ResultCode
toEnumeratedMap = [(Int64, ResultCode)] -> Map Int64 ResultCode
forall k a. Eq k => [(k, a)] -> Map k a
Map.fromAscList ((ResultCode, Int64) -> (Int64, ResultCode)
forall a b. (a, b) -> (b, a)
swap ((ResultCode, Int64) -> (Int64, ResultCode))
-> [(ResultCode, Int64)] -> [(Int64, ResultCode)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(ResultCode, Int64)]
mapping)
mapping :: [(ResultCode,Int64)]
mapping :: [(ResultCode, Int64)]
mapping = [ (ResultCode
ResultCode'success , 0)
, (ResultCode
ResultCode'operationsError , 1)
, (ResultCode
ResultCode'protocolError , 2)
, (ResultCode
ResultCode'timeLimitExceeded , 3)
, (ResultCode
ResultCode'sizeLimitExceeded , 4)
, (ResultCode
ResultCode'compareFalse , 5)
, (ResultCode
ResultCode'compareTrue , 6)
, (ResultCode
ResultCode'authMethodNotSupported , 7)
, (ResultCode
ResultCode'strongerAuthRequired , 8)
, (ResultCode
ResultCode'referral ,10)
, (ResultCode
ResultCode'adminLimitExceeded ,11)
, (ResultCode
ResultCode'unavailableCriticalExtension ,12)
, (ResultCode
ResultCode'confidentialityRequired ,13)
, (ResultCode
ResultCode'saslBindInProgress ,14)
, (ResultCode
ResultCode'noSuchAttribute ,16)
, (ResultCode
ResultCode'undefinedAttributeType ,17)
, (ResultCode
ResultCode'inappropriateMatching ,18)
, (ResultCode
ResultCode'constraintViolation ,19)
, (ResultCode
ResultCode'attributeOrValueExists ,20)
, (ResultCode
ResultCode'invalidAttributeSyntax ,21)
, (ResultCode
ResultCode'noSuchObject ,32)
, (ResultCode
ResultCode'aliasProblem ,33)
, (ResultCode
ResultCode'invalidDNSyntax ,34)
, (ResultCode
ResultCode'aliasDereferencingProblem ,36)
, (ResultCode
ResultCode'inappropriateAuthentication ,48)
, (ResultCode
ResultCode'invalidCredentials ,49)
, (ResultCode
ResultCode'insufficientAccessRights ,50)
, (ResultCode
ResultCode'busy ,51)
, (ResultCode
ResultCode'unavailable ,52)
, (ResultCode
ResultCode'unwillingToPerform ,53)
, (ResultCode
ResultCode'loopDetect ,54)
, (ResultCode
ResultCode'namingViolation ,64)
, (ResultCode
ResultCode'objectClassViolation ,65)
, (ResultCode
ResultCode'notAllowedOnNonLeaf ,66)
, (ResultCode
ResultCode'notAllowedOnRDN ,67)
, (ResultCode
ResultCode'entryAlreadyExists ,68)
, (ResultCode
ResultCode'objectClassModsProhibited ,69)
, (ResultCode
ResultCode'affectsMultipleDSAs ,71)
, (ResultCode
ResultCode'other ,80)
]
data ResultCode
= ResultCode'success
| ResultCode'operationsError
| ResultCode'protocolError
| ResultCode'timeLimitExceeded
| ResultCode'sizeLimitExceeded
| ResultCode'compareFalse
| ResultCode'compareTrue
| ResultCode'authMethodNotSupported
| ResultCode'strongerAuthRequired
| ResultCode'referral
| ResultCode'adminLimitExceeded
| ResultCode'unavailableCriticalExtension
| ResultCode'confidentialityRequired
| ResultCode'saslBindInProgress
| ResultCode'noSuchAttribute
| ResultCode'undefinedAttributeType
| ResultCode'inappropriateMatching
| ResultCode'constraintViolation
| ResultCode'attributeOrValueExists
| ResultCode'invalidAttributeSyntax
| ResultCode'noSuchObject
| ResultCode'aliasProblem
| ResultCode'invalidDNSyntax
| ResultCode'aliasDereferencingProblem
| ResultCode'inappropriateAuthentication
| ResultCode'invalidCredentials
| ResultCode'insufficientAccessRights
| ResultCode'busy
| ResultCode'unavailable
| ResultCode'unwillingToPerform
| ResultCode'loopDetect
| ResultCode'namingViolation
| ResultCode'objectClassViolation
| ResultCode'notAllowedOnNonLeaf
| ResultCode'notAllowedOnRDN
| ResultCode'entryAlreadyExists
| ResultCode'objectClassModsProhibited
| ResultCode'affectsMultipleDSAs
| ResultCode'other
deriving ((forall x. ResultCode -> Rep ResultCode x)
-> (forall x. Rep ResultCode x -> ResultCode) -> Generic ResultCode
forall x. Rep ResultCode x -> ResultCode
forall x. ResultCode -> Rep ResultCode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResultCode x -> ResultCode
$cfrom :: forall x. ResultCode -> Rep ResultCode x
Generic,Int -> ResultCode -> ShowS
[ResultCode] -> ShowS
ResultCode -> String
(Int -> ResultCode -> ShowS)
-> (ResultCode -> String)
-> ([ResultCode] -> ShowS)
-> Show ResultCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResultCode] -> ShowS
$cshowList :: [ResultCode] -> ShowS
show :: ResultCode -> String
$cshow :: ResultCode -> String
showsPrec :: Int -> ResultCode -> ShowS
$cshowsPrec :: Int -> ResultCode -> ShowS
Show,ResultCode -> ResultCode -> Bool
(ResultCode -> ResultCode -> Bool)
-> (ResultCode -> ResultCode -> Bool) -> Eq ResultCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResultCode -> ResultCode -> Bool
$c/= :: ResultCode -> ResultCode -> Bool
== :: ResultCode -> ResultCode -> Bool
$c== :: ResultCode -> ResultCode -> Bool
Eq,Eq ResultCode
Eq ResultCode =>
(ResultCode -> ResultCode -> Ordering)
-> (ResultCode -> ResultCode -> Bool)
-> (ResultCode -> ResultCode -> Bool)
-> (ResultCode -> ResultCode -> Bool)
-> (ResultCode -> ResultCode -> Bool)
-> (ResultCode -> ResultCode -> ResultCode)
-> (ResultCode -> ResultCode -> ResultCode)
-> Ord ResultCode
ResultCode -> ResultCode -> Bool
ResultCode -> ResultCode -> Ordering
ResultCode -> ResultCode -> ResultCode
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ResultCode -> ResultCode -> ResultCode
$cmin :: ResultCode -> ResultCode -> ResultCode
max :: ResultCode -> ResultCode -> ResultCode
$cmax :: ResultCode -> ResultCode -> ResultCode
>= :: ResultCode -> ResultCode -> Bool
$c>= :: ResultCode -> ResultCode -> Bool
> :: ResultCode -> ResultCode -> Bool
$c> :: ResultCode -> ResultCode -> Bool
<= :: ResultCode -> ResultCode -> Bool
$c<= :: ResultCode -> ResultCode -> Bool
< :: ResultCode -> ResultCode -> Bool
$c< :: ResultCode -> ResultCode -> Bool
compare :: ResultCode -> ResultCode -> Ordering
$ccompare :: ResultCode -> ResultCode -> Ordering
$cp1Ord :: Eq ResultCode
Ord,ResultCode
ResultCode -> ResultCode -> Bounded ResultCode
forall a. a -> a -> Bounded a
maxBound :: ResultCode
$cmaxBound :: ResultCode
minBound :: ResultCode
$cminBound :: ResultCode
Bounded,Int -> ResultCode
ResultCode -> Int
ResultCode -> [ResultCode]
ResultCode -> ResultCode
ResultCode -> ResultCode -> [ResultCode]
ResultCode -> ResultCode -> ResultCode -> [ResultCode]
(ResultCode -> ResultCode)
-> (ResultCode -> ResultCode)
-> (Int -> ResultCode)
-> (ResultCode -> Int)
-> (ResultCode -> [ResultCode])
-> (ResultCode -> ResultCode -> [ResultCode])
-> (ResultCode -> ResultCode -> [ResultCode])
-> (ResultCode -> ResultCode -> ResultCode -> [ResultCode])
-> Enum ResultCode
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: ResultCode -> ResultCode -> ResultCode -> [ResultCode]
$cenumFromThenTo :: ResultCode -> ResultCode -> ResultCode -> [ResultCode]
enumFromTo :: ResultCode -> ResultCode -> [ResultCode]
$cenumFromTo :: ResultCode -> ResultCode -> [ResultCode]
enumFromThen :: ResultCode -> ResultCode -> [ResultCode]
$cenumFromThen :: ResultCode -> ResultCode -> [ResultCode]
enumFrom :: ResultCode -> [ResultCode]
$cenumFrom :: ResultCode -> [ResultCode]
fromEnum :: ResultCode -> Int
$cfromEnum :: ResultCode -> Int
toEnum :: Int -> ResultCode
$ctoEnum :: Int -> ResultCode
pred :: ResultCode -> ResultCode
$cpred :: ResultCode -> ResultCode
succ :: ResultCode -> ResultCode
$csucc :: ResultCode -> ResultCode
Enum)
instance NFData ResultCode where
rnf :: ResultCode -> ()
rnf = ResultCode -> ()
forall a. a -> ()
rwhnf
instance Enumerated ResultCode where
toEnumerated :: Int64 -> Maybe ResultCode
toEnumerated = Int64 -> Map Int64 ResultCode -> Maybe ResultCode
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup (Int64 -> Map Int64 ResultCode -> Maybe ResultCode)
-> Map Int64 ResultCode -> Int64 -> Maybe ResultCode
forall a b c. (a -> b -> c) -> b -> a -> c
`flip` Map Int64 ResultCode
toEnumeratedMap
fromEnumerated :: ResultCode -> Int64
fromEnumerated = Int64 -> ResultCode -> Map ResultCode Int64 -> Int64
forall k a. Ord k => a -> k -> Map k a -> a
Map.findWithDefault Int64
forall a. a
impossible (ResultCode -> Map ResultCode Int64 -> Int64)
-> Map ResultCode Int64 -> ResultCode -> Int64
forall a b c. (a -> b -> c) -> b -> a -> c
`flip` Map ResultCode Int64
fromEnumeratedMap