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

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

import Telegram.Bot.API.Types.EncryptedCredentials
import Telegram.Bot.API.Types.EncryptedPassportElement
import Telegram.Bot.API.Internal.Utils

-- ** 'PassportData'

-- | Contains information about Telegram Passport data shared with the bot by the user.
data PassportData = PassportData
  { PassportData -> [EncryptedPassportElement]
passportDataData        :: [EncryptedPassportElement] -- ^ Array with information about documents and other Telegram Passport elements that was shared with the bot.
  , PassportData -> EncryptedCredentials
passportDataCredentials :: EncryptedCredentials       -- ^ Encrypted credentials required to decrypt the data.
  }
  deriving (forall x. Rep PassportData x -> PassportData
forall x. PassportData -> Rep PassportData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PassportData x -> PassportData
$cfrom :: forall x. PassportData -> Rep PassportData x
Generic, Int -> PassportData -> ShowS
[PassportData] -> ShowS
PassportData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PassportData] -> ShowS
$cshowList :: [PassportData] -> ShowS
show :: PassportData -> String
$cshow :: PassportData -> String
showsPrec :: Int -> PassportData -> ShowS
$cshowsPrec :: Int -> PassportData -> ShowS
Show)

instance ToJSON   PassportData where toJSON :: PassportData -> 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 PassportData where parseJSON :: Value -> Parser PassportData
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON