module TD.Data.PassportElement
(PassportElement(..)) 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.IdentityDocument as IdentityDocument
import qualified TD.Data.Address as Address
import qualified TD.Data.PersonalDocument as PersonalDocument
import qualified Data.Text as T
data PassportElement
= PassportElementPersonalDetails
{ PassportElement -> Maybe PersonalDetails
personal_details :: Maybe PersonalDetails.PersonalDetails
}
| PassportElementPassport
{ PassportElement -> Maybe IdentityDocument
passport :: Maybe IdentityDocument.IdentityDocument
}
| PassportElementDriverLicense
{ PassportElement -> Maybe IdentityDocument
driver_license :: Maybe IdentityDocument.IdentityDocument
}
| PassportElementIdentityCard
{ PassportElement -> Maybe IdentityDocument
identity_card :: Maybe IdentityDocument.IdentityDocument
}
| PassportElementInternalPassport
{ PassportElement -> Maybe IdentityDocument
internal_passport :: Maybe IdentityDocument.IdentityDocument
}
| PassportElementAddress
{ PassportElement -> Maybe Address
address :: Maybe Address.Address
}
| PassportElementUtilityBill
{ PassportElement -> Maybe PersonalDocument
utility_bill :: Maybe PersonalDocument.PersonalDocument
}
| PassportElementBankStatement
{ PassportElement -> Maybe PersonalDocument
bank_statement :: Maybe PersonalDocument.PersonalDocument
}
| PassportElementRentalAgreement
{ PassportElement -> Maybe PersonalDocument
rental_agreement :: Maybe PersonalDocument.PersonalDocument
}
| PassportElementPassportRegistration
{ PassportElement -> Maybe PersonalDocument
passport_registration :: Maybe PersonalDocument.PersonalDocument
}
| PassportElementTemporaryRegistration
{ PassportElement -> Maybe PersonalDocument
temporary_registration :: Maybe PersonalDocument.PersonalDocument
}
| PassportElementPhoneNumber
{ PassportElement -> Maybe Text
phone_number :: Maybe T.Text
}
| PassportElementEmailAddress
{ PassportElement -> Maybe Text
email_address :: Maybe T.Text
}
deriving (PassportElement -> PassportElement -> Bool
(PassportElement -> PassportElement -> Bool)
-> (PassportElement -> PassportElement -> Bool)
-> Eq PassportElement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PassportElement -> PassportElement -> Bool
== :: PassportElement -> PassportElement -> Bool
$c/= :: PassportElement -> PassportElement -> Bool
/= :: PassportElement -> PassportElement -> Bool
Eq, Int -> PassportElement -> ShowS
[PassportElement] -> ShowS
PassportElement -> String
(Int -> PassportElement -> ShowS)
-> (PassportElement -> String)
-> ([PassportElement] -> ShowS)
-> Show PassportElement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PassportElement -> ShowS
showsPrec :: Int -> PassportElement -> ShowS
$cshow :: PassportElement -> String
show :: PassportElement -> String
$cshowList :: [PassportElement] -> ShowS
showList :: [PassportElement] -> ShowS
Show)
instance I.ShortShow PassportElement where
shortShow :: PassportElement -> String
shortShow PassportElementPersonalDetails
{ personal_details :: PassportElement -> Maybe PersonalDetails
personal_details = Maybe PersonalDetails
personal_details_
}
= String
"PassportElementPersonalDetails"
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 PassportElementPassport
{ passport :: PassportElement -> Maybe IdentityDocument
passport = Maybe IdentityDocument
passport_
}
= String
"PassportElementPassport"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"passport" String -> Maybe IdentityDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe IdentityDocument
passport_
]
shortShow PassportElementDriverLicense
{ driver_license :: PassportElement -> Maybe IdentityDocument
driver_license = Maybe IdentityDocument
driver_license_
}
= String
"PassportElementDriverLicense"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"driver_license" String -> Maybe IdentityDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe IdentityDocument
driver_license_
]
shortShow PassportElementIdentityCard
{ identity_card :: PassportElement -> Maybe IdentityDocument
identity_card = Maybe IdentityDocument
identity_card_
}
= String
"PassportElementIdentityCard"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"identity_card" String -> Maybe IdentityDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe IdentityDocument
identity_card_
]
shortShow PassportElementInternalPassport
{ internal_passport :: PassportElement -> Maybe IdentityDocument
internal_passport = Maybe IdentityDocument
internal_passport_
}
= String
"PassportElementInternalPassport"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"internal_passport" String -> Maybe IdentityDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe IdentityDocument
internal_passport_
]
shortShow PassportElementAddress
{ address :: PassportElement -> Maybe Address
address = Maybe Address
address_
}
= String
"PassportElementAddress"
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 PassportElementUtilityBill
{ utility_bill :: PassportElement -> Maybe PersonalDocument
utility_bill = Maybe PersonalDocument
utility_bill_
}
= String
"PassportElementUtilityBill"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"utility_bill" String -> Maybe PersonalDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PersonalDocument
utility_bill_
]
shortShow PassportElementBankStatement
{ bank_statement :: PassportElement -> Maybe PersonalDocument
bank_statement = Maybe PersonalDocument
bank_statement_
}
= String
"PassportElementBankStatement"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"bank_statement" String -> Maybe PersonalDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PersonalDocument
bank_statement_
]
shortShow PassportElementRentalAgreement
{ rental_agreement :: PassportElement -> Maybe PersonalDocument
rental_agreement = Maybe PersonalDocument
rental_agreement_
}
= String
"PassportElementRentalAgreement"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"rental_agreement" String -> Maybe PersonalDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PersonalDocument
rental_agreement_
]
shortShow PassportElementPassportRegistration
{ passport_registration :: PassportElement -> Maybe PersonalDocument
passport_registration = Maybe PersonalDocument
passport_registration_
}
= String
"PassportElementPassportRegistration"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"passport_registration" String -> Maybe PersonalDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PersonalDocument
passport_registration_
]
shortShow PassportElementTemporaryRegistration
{ temporary_registration :: PassportElement -> Maybe PersonalDocument
temporary_registration = Maybe PersonalDocument
temporary_registration_
}
= String
"PassportElementTemporaryRegistration"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"temporary_registration" String -> Maybe PersonalDocument -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PersonalDocument
temporary_registration_
]
shortShow PassportElementPhoneNumber
{ phone_number :: PassportElement -> Maybe Text
phone_number = Maybe Text
phone_number_
}
= String
"PassportElementPhoneNumber"
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 PassportElementEmailAddress
{ email_address :: PassportElement -> Maybe Text
email_address = Maybe Text
email_address_
}
= String
"PassportElementEmailAddress"
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 PassportElement where
parseJSON :: Value -> Parser PassportElement
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
"passportElementPersonalDetails" -> Value -> Parser PassportElement
parsePassportElementPersonalDetails Value
v
String
"passportElementPassport" -> Value -> Parser PassportElement
parsePassportElementPassport Value
v
String
"passportElementDriverLicense" -> Value -> Parser PassportElement
parsePassportElementDriverLicense Value
v
String
"passportElementIdentityCard" -> Value -> Parser PassportElement
parsePassportElementIdentityCard Value
v
String
"passportElementInternalPassport" -> Value -> Parser PassportElement
parsePassportElementInternalPassport Value
v
String
"passportElementAddress" -> Value -> Parser PassportElement
parsePassportElementAddress Value
v
String
"passportElementUtilityBill" -> Value -> Parser PassportElement
parsePassportElementUtilityBill Value
v
String
"passportElementBankStatement" -> Value -> Parser PassportElement
parsePassportElementBankStatement Value
v
String
"passportElementRentalAgreement" -> Value -> Parser PassportElement
parsePassportElementRentalAgreement Value
v
String
"passportElementPassportRegistration" -> Value -> Parser PassportElement
parsePassportElementPassportRegistration Value
v
String
"passportElementTemporaryRegistration" -> Value -> Parser PassportElement
parsePassportElementTemporaryRegistration Value
v
String
"passportElementPhoneNumber" -> Value -> Parser PassportElement
parsePassportElementPhoneNumber Value
v
String
"passportElementEmailAddress" -> Value -> Parser PassportElement
parsePassportElementEmailAddress Value
v
String
_ -> Parser PassportElement
forall a. Monoid a => a
mempty
where
parsePassportElementPersonalDetails :: A.Value -> AT.Parser PassportElement
parsePassportElementPersonalDetails :: Value -> Parser PassportElement
parsePassportElementPersonalDetails = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementPersonalDetails" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
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"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementPersonalDetails
{ personal_details :: Maybe PersonalDetails
personal_details = Maybe PersonalDetails
personal_details_
}
parsePassportElementPassport :: A.Value -> AT.Parser PassportElement
parsePassportElementPassport :: Value -> Parser PassportElement
parsePassportElementPassport = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementPassport" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe IdentityDocument
passport_ <- Object
o Object -> Key -> Parser (Maybe IdentityDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"passport"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementPassport
{ passport :: Maybe IdentityDocument
passport = Maybe IdentityDocument
passport_
}
parsePassportElementDriverLicense :: A.Value -> AT.Parser PassportElement
parsePassportElementDriverLicense :: Value -> Parser PassportElement
parsePassportElementDriverLicense = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementDriverLicense" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe IdentityDocument
driver_license_ <- Object
o Object -> Key -> Parser (Maybe IdentityDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"driver_license"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementDriverLicense
{ driver_license :: Maybe IdentityDocument
driver_license = Maybe IdentityDocument
driver_license_
}
parsePassportElementIdentityCard :: A.Value -> AT.Parser PassportElement
parsePassportElementIdentityCard :: Value -> Parser PassportElement
parsePassportElementIdentityCard = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementIdentityCard" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe IdentityDocument
identity_card_ <- Object
o Object -> Key -> Parser (Maybe IdentityDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"identity_card"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementIdentityCard
{ identity_card :: Maybe IdentityDocument
identity_card = Maybe IdentityDocument
identity_card_
}
parsePassportElementInternalPassport :: A.Value -> AT.Parser PassportElement
parsePassportElementInternalPassport :: Value -> Parser PassportElement
parsePassportElementInternalPassport = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementInternalPassport" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe IdentityDocument
internal_passport_ <- Object
o Object -> Key -> Parser (Maybe IdentityDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"internal_passport"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementInternalPassport
{ internal_passport :: Maybe IdentityDocument
internal_passport = Maybe IdentityDocument
internal_passport_
}
parsePassportElementAddress :: A.Value -> AT.Parser PassportElement
parsePassportElementAddress :: Value -> Parser PassportElement
parsePassportElementAddress = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementAddress" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
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"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementAddress
{ address :: Maybe Address
address = Maybe Address
address_
}
parsePassportElementUtilityBill :: A.Value -> AT.Parser PassportElement
parsePassportElementUtilityBill :: Value -> Parser PassportElement
parsePassportElementUtilityBill = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementUtilityBill" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe PersonalDocument
utility_bill_ <- Object
o Object -> Key -> Parser (Maybe PersonalDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"utility_bill"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementUtilityBill
{ utility_bill :: Maybe PersonalDocument
utility_bill = Maybe PersonalDocument
utility_bill_
}
parsePassportElementBankStatement :: A.Value -> AT.Parser PassportElement
parsePassportElementBankStatement :: Value -> Parser PassportElement
parsePassportElementBankStatement = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementBankStatement" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe PersonalDocument
bank_statement_ <- Object
o Object -> Key -> Parser (Maybe PersonalDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"bank_statement"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementBankStatement
{ bank_statement :: Maybe PersonalDocument
bank_statement = Maybe PersonalDocument
bank_statement_
}
parsePassportElementRentalAgreement :: A.Value -> AT.Parser PassportElement
parsePassportElementRentalAgreement :: Value -> Parser PassportElement
parsePassportElementRentalAgreement = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementRentalAgreement" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe PersonalDocument
rental_agreement_ <- Object
o Object -> Key -> Parser (Maybe PersonalDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"rental_agreement"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementRentalAgreement
{ rental_agreement :: Maybe PersonalDocument
rental_agreement = Maybe PersonalDocument
rental_agreement_
}
parsePassportElementPassportRegistration :: A.Value -> AT.Parser PassportElement
parsePassportElementPassportRegistration :: Value -> Parser PassportElement
parsePassportElementPassportRegistration = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementPassportRegistration" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe PersonalDocument
passport_registration_ <- Object
o Object -> Key -> Parser (Maybe PersonalDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"passport_registration"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementPassportRegistration
{ passport_registration :: Maybe PersonalDocument
passport_registration = Maybe PersonalDocument
passport_registration_
}
parsePassportElementTemporaryRegistration :: A.Value -> AT.Parser PassportElement
parsePassportElementTemporaryRegistration :: Value -> Parser PassportElement
parsePassportElementTemporaryRegistration = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementTemporaryRegistration" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe PersonalDocument
temporary_registration_ <- Object
o Object -> Key -> Parser (Maybe PersonalDocument)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"temporary_registration"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementTemporaryRegistration
{ temporary_registration :: Maybe PersonalDocument
temporary_registration = Maybe PersonalDocument
temporary_registration_
}
parsePassportElementPhoneNumber :: A.Value -> AT.Parser PassportElement
parsePassportElementPhoneNumber :: Value -> Parser PassportElement
parsePassportElementPhoneNumber = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementPhoneNumber" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
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"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementPhoneNumber
{ phone_number :: Maybe Text
phone_number = Maybe Text
phone_number_
}
parsePassportElementEmailAddress :: A.Value -> AT.Parser PassportElement
parsePassportElementEmailAddress :: Value -> Parser PassportElement
parsePassportElementEmailAddress = String
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PassportElementEmailAddress" ((Object -> Parser PassportElement)
-> Value -> Parser PassportElement)
-> (Object -> Parser PassportElement)
-> Value
-> Parser PassportElement
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"
PassportElement -> Parser PassportElement
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PassportElement -> Parser PassportElement)
-> PassportElement -> Parser PassportElement
forall a b. (a -> b) -> a -> b
$ PassportElementEmailAddress
{ email_address :: Maybe Text
email_address = Maybe Text
email_address_
}
parseJSON Value
_ = Parser PassportElement
forall a. Monoid a => a
mempty