module TD.Data.InputPassportElement
(InputPassportElement(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.PersonalDetails as PersonalDetails
import qualified TD.Data.InputIdentityDocument as InputIdentityDocument
import qualified TD.Data.Address as Address
import qualified TD.Data.InputPersonalDocument as InputPersonalDocument
import qualified Data.Text as T
data InputPassportElement
= InputPassportElementPersonalDetails
{ InputPassportElement -> Maybe PersonalDetails
personal_details :: Maybe PersonalDetails.PersonalDetails
}
| InputPassportElementPassport
{ InputPassportElement -> Maybe InputIdentityDocument
passport :: Maybe InputIdentityDocument.InputIdentityDocument
}
| InputPassportElementDriverLicense
{ InputPassportElement -> Maybe InputIdentityDocument
driver_license :: Maybe InputIdentityDocument.InputIdentityDocument
}
| InputPassportElementIdentityCard
{ InputPassportElement -> Maybe InputIdentityDocument
identity_card :: Maybe InputIdentityDocument.InputIdentityDocument
}
| InputPassportElementInternalPassport
{ InputPassportElement -> Maybe InputIdentityDocument
internal_passport :: Maybe InputIdentityDocument.InputIdentityDocument
}
| InputPassportElementAddress
{ InputPassportElement -> Maybe Address
address :: Maybe Address.Address
}
| InputPassportElementUtilityBill
{ InputPassportElement -> Maybe InputPersonalDocument
utility_bill :: Maybe InputPersonalDocument.InputPersonalDocument
}
| InputPassportElementBankStatement
{ InputPassportElement -> Maybe InputPersonalDocument
bank_statement :: Maybe InputPersonalDocument.InputPersonalDocument
}
| InputPassportElementRentalAgreement
{ InputPassportElement -> Maybe InputPersonalDocument
rental_agreement :: Maybe InputPersonalDocument.InputPersonalDocument
}
| InputPassportElementPassportRegistration
{ InputPassportElement -> Maybe InputPersonalDocument
passport_registration :: Maybe InputPersonalDocument.InputPersonalDocument
}
| InputPassportElementTemporaryRegistration
{ InputPassportElement -> Maybe InputPersonalDocument
temporary_registration :: Maybe InputPersonalDocument.InputPersonalDocument
}
| InputPassportElementPhoneNumber
{ InputPassportElement -> Maybe Text
phone_number :: Maybe T.Text
}
| InputPassportElementEmailAddress
{ InputPassportElement -> Maybe Text
email_address :: Maybe T.Text
}
deriving (InputPassportElement -> InputPassportElement -> Bool
(InputPassportElement -> InputPassportElement -> Bool)
-> (InputPassportElement -> InputPassportElement -> Bool)
-> Eq InputPassportElement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InputPassportElement -> InputPassportElement -> Bool
== :: InputPassportElement -> InputPassportElement -> Bool
$c/= :: InputPassportElement -> InputPassportElement -> Bool
/= :: InputPassportElement -> InputPassportElement -> Bool
Eq, Int -> InputPassportElement -> ShowS
[InputPassportElement] -> ShowS
InputPassportElement -> String
(Int -> InputPassportElement -> ShowS)
-> (InputPassportElement -> String)
-> ([InputPassportElement] -> ShowS)
-> Show InputPassportElement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InputPassportElement -> ShowS
showsPrec :: Int -> InputPassportElement -> ShowS
$cshow :: InputPassportElement -> String
show :: InputPassportElement -> String
$cshowList :: [InputPassportElement] -> ShowS
showList :: [InputPassportElement] -> ShowS
Show)
instance I.ShortShow InputPassportElement where
shortShow :: InputPassportElement -> String
shortShow InputPassportElementPersonalDetails
{ personal_details :: InputPassportElement -> Maybe PersonalDetails
personal_details = Maybe PersonalDetails
personal_details_
}
= String
"InputPassportElementPersonalDetails"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"personal_details" String -> Maybe PersonalDetails -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PersonalDetails
personal_details_
]
shortShow InputPassportElementPassport
{ passport :: InputPassportElement -> Maybe InputIdentityDocument
passport = Maybe InputIdentityDocument
passport_
}
= String
"InputPassportElementPassport"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"passport" String -> Maybe InputIdentityDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputIdentityDocument
passport_
]
shortShow InputPassportElementDriverLicense
{ driver_license :: InputPassportElement -> Maybe InputIdentityDocument
driver_license = Maybe InputIdentityDocument
driver_license_
}
= String
"InputPassportElementDriverLicense"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"driver_license" String -> Maybe InputIdentityDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputIdentityDocument
driver_license_
]
shortShow InputPassportElementIdentityCard
{ identity_card :: InputPassportElement -> Maybe InputIdentityDocument
identity_card = Maybe InputIdentityDocument
identity_card_
}
= String
"InputPassportElementIdentityCard"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"identity_card" String -> Maybe InputIdentityDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputIdentityDocument
identity_card_
]
shortShow InputPassportElementInternalPassport
{ internal_passport :: InputPassportElement -> Maybe InputIdentityDocument
internal_passport = Maybe InputIdentityDocument
internal_passport_
}
= String
"InputPassportElementInternalPassport"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"internal_passport" String -> Maybe InputIdentityDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputIdentityDocument
internal_passport_
]
shortShow InputPassportElementAddress
{ address :: InputPassportElement -> Maybe Address
address = Maybe Address
address_
}
= String
"InputPassportElementAddress"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"address" String -> Maybe Address -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Address
address_
]
shortShow InputPassportElementUtilityBill
{ utility_bill :: InputPassportElement -> Maybe InputPersonalDocument
utility_bill = Maybe InputPersonalDocument
utility_bill_
}
= String
"InputPassportElementUtilityBill"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"utility_bill" String -> Maybe InputPersonalDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputPersonalDocument
utility_bill_
]
shortShow InputPassportElementBankStatement
{ bank_statement :: InputPassportElement -> Maybe InputPersonalDocument
bank_statement = Maybe InputPersonalDocument
bank_statement_
}
= String
"InputPassportElementBankStatement"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"bank_statement" String -> Maybe InputPersonalDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputPersonalDocument
bank_statement_
]
shortShow InputPassportElementRentalAgreement
{ rental_agreement :: InputPassportElement -> Maybe InputPersonalDocument
rental_agreement = Maybe InputPersonalDocument
rental_agreement_
}
= String
"InputPassportElementRentalAgreement"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"rental_agreement" String -> Maybe InputPersonalDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputPersonalDocument
rental_agreement_
]
shortShow InputPassportElementPassportRegistration
{ passport_registration :: InputPassportElement -> Maybe InputPersonalDocument
passport_registration = Maybe InputPersonalDocument
passport_registration_
}
= String
"InputPassportElementPassportRegistration"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"passport_registration" String -> Maybe InputPersonalDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputPersonalDocument
passport_registration_
]
shortShow InputPassportElementTemporaryRegistration
{ temporary_registration :: InputPassportElement -> Maybe InputPersonalDocument
temporary_registration = Maybe InputPersonalDocument
temporary_registration_
}
= String
"InputPassportElementTemporaryRegistration"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"temporary_registration" String -> Maybe InputPersonalDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputPersonalDocument
temporary_registration_
]
shortShow InputPassportElementPhoneNumber
{ phone_number :: InputPassportElement -> Maybe Text
phone_number = Maybe Text
phone_number_
}
= String
"InputPassportElementPhoneNumber"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"phone_number" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
phone_number_
]
shortShow InputPassportElementEmailAddress
{ email_address :: InputPassportElement -> Maybe Text
email_address = Maybe Text
email_address_
}
= String
"InputPassportElementEmailAddress"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"email_address" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
email_address_
]
instance AT.FromJSON InputPassportElement where
parseJSON :: Value -> Parser InputPassportElement
parseJSON v :: Value
v@(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
"inputPassportElementPersonalDetails" -> Value -> Parser InputPassportElement
parseInputPassportElementPersonalDetails Value
v
String
"inputPassportElementPassport" -> Value -> Parser InputPassportElement
parseInputPassportElementPassport Value
v
String
"inputPassportElementDriverLicense" -> Value -> Parser InputPassportElement
parseInputPassportElementDriverLicense Value
v
String
"inputPassportElementIdentityCard" -> Value -> Parser InputPassportElement
parseInputPassportElementIdentityCard Value
v
String
"inputPassportElementInternalPassport" -> Value -> Parser InputPassportElement
parseInputPassportElementInternalPassport Value
v
String
"inputPassportElementAddress" -> Value -> Parser InputPassportElement
parseInputPassportElementAddress Value
v
String
"inputPassportElementUtilityBill" -> Value -> Parser InputPassportElement
parseInputPassportElementUtilityBill Value
v
String
"inputPassportElementBankStatement" -> Value -> Parser InputPassportElement
parseInputPassportElementBankStatement Value
v
String
"inputPassportElementRentalAgreement" -> Value -> Parser InputPassportElement
parseInputPassportElementRentalAgreement Value
v
String
"inputPassportElementPassportRegistration" -> Value -> Parser InputPassportElement
parseInputPassportElementPassportRegistration Value
v
String
"inputPassportElementTemporaryRegistration" -> Value -> Parser InputPassportElement
parseInputPassportElementTemporaryRegistration Value
v
String
"inputPassportElementPhoneNumber" -> Value -> Parser InputPassportElement
parseInputPassportElementPhoneNumber Value
v
String
"inputPassportElementEmailAddress" -> Value -> Parser InputPassportElement
parseInputPassportElementEmailAddress Value
v
String
_ -> Parser InputPassportElement
forall a. Monoid a => a
mempty
where
parseInputPassportElementPersonalDetails :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementPersonalDetails :: Value -> Parser InputPassportElement
parseInputPassportElementPersonalDetails = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementPersonalDetails" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe PersonalDetails
personal_details_ <- Object
o Object -> Key -> Parser (Maybe PersonalDetails)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"personal_details"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementPersonalDetails
{ personal_details :: Maybe PersonalDetails
personal_details = Maybe PersonalDetails
personal_details_
}
parseInputPassportElementPassport :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementPassport :: Value -> Parser InputPassportElement
parseInputPassportElementPassport = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementPassport" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe InputIdentityDocument
passport_ <- Object
o Object -> Key -> Parser (Maybe InputIdentityDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"passport"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementPassport
{ passport :: Maybe InputIdentityDocument
passport = Maybe InputIdentityDocument
passport_
}
parseInputPassportElementDriverLicense :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementDriverLicense :: Value -> Parser InputPassportElement
parseInputPassportElementDriverLicense = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementDriverLicense" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe InputIdentityDocument
driver_license_ <- Object
o Object -> Key -> Parser (Maybe InputIdentityDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"driver_license"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementDriverLicense
{ driver_license :: Maybe InputIdentityDocument
driver_license = Maybe InputIdentityDocument
driver_license_
}
parseInputPassportElementIdentityCard :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementIdentityCard :: Value -> Parser InputPassportElement
parseInputPassportElementIdentityCard = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementIdentityCard" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe InputIdentityDocument
identity_card_ <- Object
o Object -> Key -> Parser (Maybe InputIdentityDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"identity_card"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementIdentityCard
{ identity_card :: Maybe InputIdentityDocument
identity_card = Maybe InputIdentityDocument
identity_card_
}
parseInputPassportElementInternalPassport :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementInternalPassport :: Value -> Parser InputPassportElement
parseInputPassportElementInternalPassport = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementInternalPassport" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe InputIdentityDocument
internal_passport_ <- Object
o Object -> Key -> Parser (Maybe InputIdentityDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"internal_passport"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementInternalPassport
{ internal_passport :: Maybe InputIdentityDocument
internal_passport = Maybe InputIdentityDocument
internal_passport_
}
parseInputPassportElementAddress :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementAddress :: Value -> Parser InputPassportElement
parseInputPassportElementAddress = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementAddress" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Address
address_ <- Object
o Object -> Key -> Parser (Maybe Address)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"address"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementAddress
{ address :: Maybe Address
address = Maybe Address
address_
}
parseInputPassportElementUtilityBill :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementUtilityBill :: Value -> Parser InputPassportElement
parseInputPassportElementUtilityBill = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementUtilityBill" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe InputPersonalDocument
utility_bill_ <- Object
o Object -> Key -> Parser (Maybe InputPersonalDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"utility_bill"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementUtilityBill
{ utility_bill :: Maybe InputPersonalDocument
utility_bill = Maybe InputPersonalDocument
utility_bill_
}
parseInputPassportElementBankStatement :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementBankStatement :: Value -> Parser InputPassportElement
parseInputPassportElementBankStatement = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementBankStatement" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe InputPersonalDocument
bank_statement_ <- Object
o Object -> Key -> Parser (Maybe InputPersonalDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"bank_statement"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementBankStatement
{ bank_statement :: Maybe InputPersonalDocument
bank_statement = Maybe InputPersonalDocument
bank_statement_
}
parseInputPassportElementRentalAgreement :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementRentalAgreement :: Value -> Parser InputPassportElement
parseInputPassportElementRentalAgreement = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementRentalAgreement" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe InputPersonalDocument
rental_agreement_ <- Object
o Object -> Key -> Parser (Maybe InputPersonalDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"rental_agreement"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementRentalAgreement
{ rental_agreement :: Maybe InputPersonalDocument
rental_agreement = Maybe InputPersonalDocument
rental_agreement_
}
parseInputPassportElementPassportRegistration :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementPassportRegistration :: Value -> Parser InputPassportElement
parseInputPassportElementPassportRegistration = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementPassportRegistration" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe InputPersonalDocument
passport_registration_ <- Object
o Object -> Key -> Parser (Maybe InputPersonalDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"passport_registration"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementPassportRegistration
{ passport_registration :: Maybe InputPersonalDocument
passport_registration = Maybe InputPersonalDocument
passport_registration_
}
parseInputPassportElementTemporaryRegistration :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementTemporaryRegistration :: Value -> Parser InputPassportElement
parseInputPassportElementTemporaryRegistration = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementTemporaryRegistration" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe InputPersonalDocument
temporary_registration_ <- Object
o Object -> Key -> Parser (Maybe InputPersonalDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"temporary_registration"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementTemporaryRegistration
{ temporary_registration :: Maybe InputPersonalDocument
temporary_registration = Maybe InputPersonalDocument
temporary_registration_
}
parseInputPassportElementPhoneNumber :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementPhoneNumber :: Value -> Parser InputPassportElement
parseInputPassportElementPhoneNumber = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementPhoneNumber" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
phone_number_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"phone_number"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementPhoneNumber
{ phone_number :: Maybe Text
phone_number = Maybe Text
phone_number_
}
parseInputPassportElementEmailAddress :: A.Value -> AT.Parser InputPassportElement
parseInputPassportElementEmailAddress :: Value -> Parser InputPassportElement
parseInputPassportElementEmailAddress = String
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputPassportElementEmailAddress" ((Object -> Parser InputPassportElement)
-> Value -> Parser InputPassportElement)
-> (Object -> Parser InputPassportElement)
-> Value
-> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
email_address_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"email_address"
InputPassportElement -> Parser InputPassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputPassportElement -> Parser InputPassportElement)
-> InputPassportElement -> Parser InputPassportElement
forall a b. (a -> b) -> a -> b
$ InputPassportElementEmailAddress
{ email_address :: Maybe Text
email_address = Maybe Text
email_address_
}
parseJSON Value
_ = Parser InputPassportElement
forall a. Monoid a => a
mempty
instance AT.ToJSON InputPassportElement where
toJSON :: InputPassportElement -> Value
toJSON InputPassportElementPersonalDetails
{ personal_details :: InputPassportElement -> Maybe PersonalDetails
personal_details = Maybe PersonalDetails
personal_details_
}
= [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
"inputPassportElementPersonalDetails"
, Key
"personal_details" Key -> Maybe PersonalDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe PersonalDetails
personal_details_
]
toJSON InputPassportElementPassport
{ passport :: InputPassportElement -> Maybe InputIdentityDocument
passport = Maybe InputIdentityDocument
passport_
}
= [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
"inputPassportElementPassport"
, Key
"passport" Key -> Maybe InputIdentityDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputIdentityDocument
passport_
]
toJSON InputPassportElementDriverLicense
{ driver_license :: InputPassportElement -> Maybe InputIdentityDocument
driver_license = Maybe InputIdentityDocument
driver_license_
}
= [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
"inputPassportElementDriverLicense"
, Key
"driver_license" Key -> Maybe InputIdentityDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputIdentityDocument
driver_license_
]
toJSON InputPassportElementIdentityCard
{ identity_card :: InputPassportElement -> Maybe InputIdentityDocument
identity_card = Maybe InputIdentityDocument
identity_card_
}
= [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
"inputPassportElementIdentityCard"
, Key
"identity_card" Key -> Maybe InputIdentityDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputIdentityDocument
identity_card_
]
toJSON InputPassportElementInternalPassport
{ internal_passport :: InputPassportElement -> Maybe InputIdentityDocument
internal_passport = Maybe InputIdentityDocument
internal_passport_
}
= [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
"inputPassportElementInternalPassport"
, Key
"internal_passport" Key -> Maybe InputIdentityDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputIdentityDocument
internal_passport_
]
toJSON InputPassportElementAddress
{ address :: InputPassportElement -> Maybe Address
address = Maybe Address
address_
}
= [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
"inputPassportElementAddress"
, Key
"address" Key -> Maybe Address -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Address
address_
]
toJSON InputPassportElementUtilityBill
{ utility_bill :: InputPassportElement -> Maybe InputPersonalDocument
utility_bill = Maybe InputPersonalDocument
utility_bill_
}
= [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
"inputPassportElementUtilityBill"
, Key
"utility_bill" Key -> Maybe InputPersonalDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputPersonalDocument
utility_bill_
]
toJSON InputPassportElementBankStatement
{ bank_statement :: InputPassportElement -> Maybe InputPersonalDocument
bank_statement = Maybe InputPersonalDocument
bank_statement_
}
= [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
"inputPassportElementBankStatement"
, Key
"bank_statement" Key -> Maybe InputPersonalDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputPersonalDocument
bank_statement_
]
toJSON InputPassportElementRentalAgreement
{ rental_agreement :: InputPassportElement -> Maybe InputPersonalDocument
rental_agreement = Maybe InputPersonalDocument
rental_agreement_
}
= [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
"inputPassportElementRentalAgreement"
, Key
"rental_agreement" Key -> Maybe InputPersonalDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputPersonalDocument
rental_agreement_
]
toJSON InputPassportElementPassportRegistration
{ passport_registration :: InputPassportElement -> Maybe InputPersonalDocument
passport_registration = Maybe InputPersonalDocument
passport_registration_
}
= [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
"inputPassportElementPassportRegistration"
, Key
"passport_registration" Key -> Maybe InputPersonalDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputPersonalDocument
passport_registration_
]
toJSON InputPassportElementTemporaryRegistration
{ temporary_registration :: InputPassportElement -> Maybe InputPersonalDocument
temporary_registration = Maybe InputPersonalDocument
temporary_registration_
}
= [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
"inputPassportElementTemporaryRegistration"
, Key
"temporary_registration" Key -> Maybe InputPersonalDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputPersonalDocument
temporary_registration_
]
toJSON InputPassportElementPhoneNumber
{ phone_number :: InputPassportElement -> Maybe Text
phone_number = Maybe Text
phone_number_
}
= [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
"inputPassportElementPhoneNumber"
, Key
"phone_number" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
phone_number_
]
toJSON InputPassportElementEmailAddress
{ email_address :: InputPassportElement -> Maybe Text
email_address = Maybe Text
email_address_
}
= [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
"inputPassportElementEmailAddress"
, Key
"email_address" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
email_address_
]