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

import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Time.Clock.POSIX (POSIXTime)
import GHC.Generics (Generic)

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

-- ** 'PassportFile'

-- | This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
data PassportFile = PassportFile
  { PassportFile -> FileId
passportFileFileId       :: FileId    -- ^ Identifier for this file, which can be used to download or reuse the file.
  , PassportFile -> FileId
passportFileFileUniqueId :: FileId    -- ^ Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
  , PassportFile -> Int
passportFileFileSize     :: Int     -- ^ File size in bytes.
  , PassportFile -> POSIXTime
passportFileFileDate     :: POSIXTime -- ^ Unix time when the file was uploaded.
  }
  deriving (forall x. Rep PassportFile x -> PassportFile
forall x. PassportFile -> Rep PassportFile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PassportFile x -> PassportFile
$cfrom :: forall x. PassportFile -> Rep PassportFile x
Generic, Int -> PassportFile -> ShowS
[PassportFile] -> ShowS
PassportFile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PassportFile] -> ShowS
$cshowList :: [PassportFile] -> ShowS
show :: PassportFile -> String
$cshow :: PassportFile -> String
showsPrec :: Int -> PassportFile -> ShowS
$cshowsPrec :: Int -> PassportFile -> ShowS
Show)

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