{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.EncryptedPassportElement where

import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Text (Text)
import GHC.Generics (Generic)

import Telegram.Bot.API.Types.PassportFile
import Telegram.Bot.API.Internal.Utils

-- ** 'EncryptedPassportElement'

-- | Contains information about documents or other Telegram Passport elements shared with the bot by the user.
data EncryptedPassportElement = EncryptedPassportElement
  { EncryptedPassportElement -> PassportElementType
encryptedPassportElementType        :: PassportElementType  -- ^ One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.
  , EncryptedPassportElement -> Maybe Text
encryptedPassportElementData        :: Maybe Text           -- ^ Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying 'EncryptedCredentials'.
  , EncryptedPassportElement -> Maybe Text
encryptedPassportElementPhoneNumber :: Maybe Text           -- ^ User's verified phone number, available only for “phone_number” type.
  , EncryptedPassportElement -> Maybe Text
encryptedPassportElementEmail       :: Maybe Text           -- ^ User's verified email address, available only for “email” type.
  , EncryptedPassportElement -> Maybe [PassportFile]
encryptedPassportElementFiles       :: Maybe [PassportFile] -- ^ Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
  , EncryptedPassportElement -> Maybe PassportFile
encryptedPassportElementFrontSide   :: Maybe PassportFile   -- ^ Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
  , EncryptedPassportElement -> Maybe PassportFile
encryptedPassportElementReverseSide :: Maybe PassportFile   -- ^ Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
  , EncryptedPassportElement -> Maybe PassportFile
encryptedPassportElementSelfie      :: Maybe PassportFile   -- ^ Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
  , EncryptedPassportElement -> Maybe [PassportFile]
encryptedPassportElementTranslation :: Maybe [PassportFile] -- ^ Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
  , EncryptedPassportElement -> Text
encryptedPassportElementHash        :: Text                 -- ^ Base64-encoded element hash for using in 'PassportElementErrorUnspecified'.
  } deriving (forall x.
Rep EncryptedPassportElement x -> EncryptedPassportElement
forall x.
EncryptedPassportElement -> Rep EncryptedPassportElement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EncryptedPassportElement x -> EncryptedPassportElement
$cfrom :: forall x.
EncryptedPassportElement -> Rep EncryptedPassportElement x
Generic, Int -> EncryptedPassportElement -> ShowS
[EncryptedPassportElement] -> ShowS
EncryptedPassportElement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EncryptedPassportElement] -> ShowS
$cshowList :: [EncryptedPassportElement] -> ShowS
show :: EncryptedPassportElement -> String
$cshow :: EncryptedPassportElement -> String
showsPrec :: Int -> EncryptedPassportElement -> ShowS
$cshowsPrec :: Int -> EncryptedPassportElement -> ShowS
Show)

instance ToJSON   EncryptedPassportElement where toJSON :: EncryptedPassportElement -> Value
toJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON EncryptedPassportElement where parseJSON :: Value -> Parser EncryptedPassportElement
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON

-- | One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.
data PassportElementType
  = PassportElementTypePersonalDetails
  | PassportElementTypePassport
  | PassportElementTypeDriverLicense
  | PassportElementTypeIdentityCard
  | PassportElementTypeInternalPassport
  | PassportElementTypeAddress
  | PassportElementTypeUtilityBill
  | PassportElementTypeBankStatement
  | PassportElementTypeRentalAgreement
  | PassportElementTypePassportRegistration
  | PassportElementTypeTemporaryRegistration
  | PassportElementTypePhoneNumber
  | PassportElementTypeEmail
  deriving (forall x. Rep PassportElementType x -> PassportElementType
forall x. PassportElementType -> Rep PassportElementType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PassportElementType x -> PassportElementType
$cfrom :: forall x. PassportElementType -> Rep PassportElementType x
Generic, Int -> PassportElementType -> ShowS
[PassportElementType] -> ShowS
PassportElementType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PassportElementType] -> ShowS
$cshowList :: [PassportElementType] -> ShowS
show :: PassportElementType -> String
$cshow :: PassportElementType -> String
showsPrec :: Int -> PassportElementType -> ShowS
$cshowsPrec :: Int -> PassportElementType -> ShowS
Show)

instance ToJSON   PassportElementType where toJSON :: PassportElementType -> Value
toJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON PassportElementType where parseJSON :: Value -> Parser PassportElementType
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON