module TD.Data.SessionType
(SessionType(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data SessionType
= SessionTypeAndroid
| SessionTypeApple
| SessionTypeBrave
| SessionTypeChrome
| SessionTypeEdge
| SessionTypeFirefox
| SessionTypeIpad
| SessionTypeIphone
| SessionTypeLinux
| SessionTypeMac
| SessionTypeOpera
| SessionTypeSafari
| SessionTypeUbuntu
| SessionTypeUnknown
| SessionTypeVivaldi
| SessionTypeWindows
| SessionTypeXbox
deriving (SessionType -> SessionType -> Bool
(SessionType -> SessionType -> Bool)
-> (SessionType -> SessionType -> Bool) -> Eq SessionType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SessionType -> SessionType -> Bool
== :: SessionType -> SessionType -> Bool
$c/= :: SessionType -> SessionType -> Bool
/= :: SessionType -> SessionType -> Bool
Eq, Int -> SessionType -> ShowS
[SessionType] -> ShowS
SessionType -> String
(Int -> SessionType -> ShowS)
-> (SessionType -> String)
-> ([SessionType] -> ShowS)
-> Show SessionType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SessionType -> ShowS
showsPrec :: Int -> SessionType -> ShowS
$cshow :: SessionType -> String
show :: SessionType -> String
$cshowList :: [SessionType] -> ShowS
showList :: [SessionType] -> ShowS
Show)
instance I.ShortShow SessionType where
shortShow :: SessionType -> String
shortShow SessionType
SessionTypeAndroid
= String
"SessionTypeAndroid"
shortShow SessionType
SessionTypeApple
= String
"SessionTypeApple"
shortShow SessionType
SessionTypeBrave
= String
"SessionTypeBrave"
shortShow SessionType
SessionTypeChrome
= String
"SessionTypeChrome"
shortShow SessionType
SessionTypeEdge
= String
"SessionTypeEdge"
shortShow SessionType
SessionTypeFirefox
= String
"SessionTypeFirefox"
shortShow SessionType
SessionTypeIpad
= String
"SessionTypeIpad"
shortShow SessionType
SessionTypeIphone
= String
"SessionTypeIphone"
shortShow SessionType
SessionTypeLinux
= String
"SessionTypeLinux"
shortShow SessionType
SessionTypeMac
= String
"SessionTypeMac"
shortShow SessionType
SessionTypeOpera
= String
"SessionTypeOpera"
shortShow SessionType
SessionTypeSafari
= String
"SessionTypeSafari"
shortShow SessionType
SessionTypeUbuntu
= String
"SessionTypeUbuntu"
shortShow SessionType
SessionTypeUnknown
= String
"SessionTypeUnknown"
shortShow SessionType
SessionTypeVivaldi
= String
"SessionTypeVivaldi"
shortShow SessionType
SessionTypeWindows
= String
"SessionTypeWindows"
shortShow SessionType
SessionTypeXbox
= String
"SessionTypeXbox"
instance AT.FromJSON SessionType where
parseJSON :: Value -> Parser SessionType
parseJSON (AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"sessionTypeAndroid" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeAndroid
String
"sessionTypeApple" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeApple
String
"sessionTypeBrave" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeBrave
String
"sessionTypeChrome" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeChrome
String
"sessionTypeEdge" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeEdge
String
"sessionTypeFirefox" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeFirefox
String
"sessionTypeIpad" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeIpad
String
"sessionTypeIphone" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeIphone
String
"sessionTypeLinux" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeLinux
String
"sessionTypeMac" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeMac
String
"sessionTypeOpera" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeOpera
String
"sessionTypeSafari" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeSafari
String
"sessionTypeUbuntu" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeUbuntu
String
"sessionTypeUnknown" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeUnknown
String
"sessionTypeVivaldi" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeVivaldi
String
"sessionTypeWindows" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeWindows
String
"sessionTypeXbox" -> SessionType -> Parser SessionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SessionType
SessionTypeXbox
String
_ -> Parser SessionType
forall a. Monoid a => a
mempty
parseJSON Value
_ = Parser SessionType
forall a. Monoid a => a
mempty