module LaunchDarkly.Server.Client.Status
( Status (..)
, transitionStatus
)
where
data Status
=
Uninitialized
|
Unauthorized
|
Initialized
|
ShuttingDown
deriving (Int -> Status -> ShowS
[Status] -> ShowS
Status -> String
(Int -> Status -> ShowS)
-> (Status -> String) -> ([Status] -> ShowS) -> Show Status
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Status] -> ShowS
$cshowList :: [Status] -> ShowS
show :: Status -> String
$cshow :: Status -> String
showsPrec :: Int -> Status -> ShowS
$cshowsPrec :: Int -> Status -> ShowS
Show, Status -> Status -> Bool
(Status -> Status -> Bool)
-> (Status -> Status -> Bool) -> Eq Status
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Status -> Status -> Bool
$c/= :: Status -> Status -> Bool
== :: Status -> Status -> Bool
$c== :: Status -> Status -> Bool
Eq)
transitionStatus :: Status -> Status -> Status
transitionStatus :: Status -> Status -> Status
transitionStatus requestedStatus :: Status
requestedStatus oldStatus :: Status
oldStatus =
case Status
requestedStatus of
Initialized -> if Status
oldStatus Status -> Status -> Bool
forall a. Eq a => a -> a -> Bool
== Status
Uninitialized then Status
Initialized else Status
oldStatus
_ -> if Status
oldStatus Status -> Status -> Bool
forall a. Eq a => a -> a -> Bool
== Status
ShuttingDown then Status
ShuttingDown else Status
requestedStatus