module TD.Data.PassportElementType
(PassportElementType(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data PassportElementType
= PassportElementTypePersonalDetails
| PassportElementTypePassport
| PassportElementTypeDriverLicense
| PassportElementTypeIdentityCard
| PassportElementTypeInternalPassport
| PassportElementTypeAddress
| PassportElementTypeUtilityBill
| PassportElementTypeBankStatement
| PassportElementTypeRentalAgreement
| PassportElementTypePassportRegistration
| PassportElementTypeTemporaryRegistration
| PassportElementTypePhoneNumber
| PassportElementTypeEmailAddress
deriving (PassportElementType -> PassportElementType -> Bool
(PassportElementType -> PassportElementType -> Bool)
-> (PassportElementType -> PassportElementType -> Bool)
-> Eq PassportElementType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PassportElementType -> PassportElementType -> Bool
== :: PassportElementType -> PassportElementType -> Bool
$c/= :: PassportElementType -> PassportElementType -> Bool
/= :: PassportElementType -> PassportElementType -> Bool
Eq, Int -> PassportElementType -> ShowS
[PassportElementType] -> ShowS
PassportElementType -> String
(Int -> PassportElementType -> ShowS)
-> (PassportElementType -> String)
-> ([PassportElementType] -> ShowS)
-> Show PassportElementType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PassportElementType -> ShowS
showsPrec :: Int -> PassportElementType -> ShowS
$cshow :: PassportElementType -> String
show :: PassportElementType -> String
$cshowList :: [PassportElementType] -> ShowS
showList :: [PassportElementType] -> ShowS
Show)
instance I.ShortShow PassportElementType where
shortShow :: PassportElementType -> String
shortShow PassportElementType
PassportElementTypePersonalDetails
= String
"PassportElementTypePersonalDetails"
shortShow PassportElementType
PassportElementTypePassport
= String
"PassportElementTypePassport"
shortShow PassportElementType
PassportElementTypeDriverLicense
= String
"PassportElementTypeDriverLicense"
shortShow PassportElementType
PassportElementTypeIdentityCard
= String
"PassportElementTypeIdentityCard"
shortShow PassportElementType
PassportElementTypeInternalPassport
= String
"PassportElementTypeInternalPassport"
shortShow PassportElementType
PassportElementTypeAddress
= String
"PassportElementTypeAddress"
shortShow PassportElementType
PassportElementTypeUtilityBill
= String
"PassportElementTypeUtilityBill"
shortShow PassportElementType
PassportElementTypeBankStatement
= String
"PassportElementTypeBankStatement"
shortShow PassportElementType
PassportElementTypeRentalAgreement
= String
"PassportElementTypeRentalAgreement"
shortShow PassportElementType
PassportElementTypePassportRegistration
= String
"PassportElementTypePassportRegistration"
shortShow PassportElementType
PassportElementTypeTemporaryRegistration
= String
"PassportElementTypeTemporaryRegistration"
shortShow PassportElementType
PassportElementTypePhoneNumber
= String
"PassportElementTypePhoneNumber"
shortShow PassportElementType
PassportElementTypeEmailAddress
= String
"PassportElementTypeEmailAddress"
instance AT.FromJSON PassportElementType where
parseJSON :: Value -> Parser PassportElementType
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
"passportElementTypePersonalDetails" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypePersonalDetails
String
"passportElementTypePassport" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypePassport
String
"passportElementTypeDriverLicense" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypeDriverLicense
String
"passportElementTypeIdentityCard" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypeIdentityCard
String
"passportElementTypeInternalPassport" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypeInternalPassport
String
"passportElementTypeAddress" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypeAddress
String
"passportElementTypeUtilityBill" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypeUtilityBill
String
"passportElementTypeBankStatement" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypeBankStatement
String
"passportElementTypeRentalAgreement" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypeRentalAgreement
String
"passportElementTypePassportRegistration" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypePassportRegistration
String
"passportElementTypeTemporaryRegistration" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypeTemporaryRegistration
String
"passportElementTypePhoneNumber" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypePhoneNumber
String
"passportElementTypeEmailAddress" -> PassportElementType -> Parser PassportElementType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PassportElementType
PassportElementTypeEmailAddress
String
_ -> Parser PassportElementType
forall a. Monoid a => a
mempty
parseJSON Value
_ = Parser PassportElementType
forall a. Monoid a => a
mempty
instance AT.ToJSON PassportElementType where
toJSON :: PassportElementType -> Value
toJSON PassportElementType
PassportElementTypePersonalDetails
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypePersonalDetails"
]
toJSON PassportElementType
PassportElementTypePassport
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypePassport"
]
toJSON PassportElementType
PassportElementTypeDriverLicense
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypeDriverLicense"
]
toJSON PassportElementType
PassportElementTypeIdentityCard
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypeIdentityCard"
]
toJSON PassportElementType
PassportElementTypeInternalPassport
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypeInternalPassport"
]
toJSON PassportElementType
PassportElementTypeAddress
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypeAddress"
]
toJSON PassportElementType
PassportElementTypeUtilityBill
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypeUtilityBill"
]
toJSON PassportElementType
PassportElementTypeBankStatement
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypeBankStatement"
]
toJSON PassportElementType
PassportElementTypeRentalAgreement
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypeRentalAgreement"
]
toJSON PassportElementType
PassportElementTypePassportRegistration
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypePassportRegistration"
]
toJSON PassportElementType
PassportElementTypeTemporaryRegistration
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypeTemporaryRegistration"
]
toJSON PassportElementType
PassportElementTypePhoneNumber
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypePhoneNumber"
]
toJSON PassportElementType
PassportElementTypeEmailAddress
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"passportElementTypeEmailAddress"
]