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

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

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

-- ** 'Animation'

-- | This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
data Animation = Animation
  { Animation -> FileId
animationFileId       :: FileId          -- ^ Identifier for this file, which can be used to download or reuse the file.
  , Animation -> FileId
animationFileUniqueId :: 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.
  , Animation -> Int
animationWidth        :: Int           -- ^ Video width as defined by sender.
  , Animation -> Int
animationHeight       :: Int           -- ^ Video height as defined by sender.
  , Animation -> Seconds
animationDuration     :: Seconds         -- ^ Duration of the video in seconds as defined by sender.
  , Animation -> Maybe PhotoSize
animationThumbnail    :: Maybe PhotoSize -- ^ Animation thumbnail as defined by sender.
  , Animation -> Maybe Text
animationFileName     :: Maybe Text      -- ^ Original animation filename as defined by sender.
  , Animation -> Maybe Text
animationMimeType     :: Maybe Text      -- ^ MIME type of the file as defined by sender.
  , Animation -> Maybe Integer
animationFileSize     :: Maybe Integer   -- ^ File size in bytes.
  }
  deriving ((forall x. Animation -> Rep Animation x)
-> (forall x. Rep Animation x -> Animation) -> Generic Animation
forall x. Rep Animation x -> Animation
forall x. Animation -> Rep Animation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Animation -> Rep Animation x
from :: forall x. Animation -> Rep Animation x
$cto :: forall x. Rep Animation x -> Animation
to :: forall x. Rep Animation x -> Animation
Generic, Int -> Animation -> ShowS
[Animation] -> ShowS
Animation -> String
(Int -> Animation -> ShowS)
-> (Animation -> String)
-> ([Animation] -> ShowS)
-> Show Animation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Animation -> ShowS
showsPrec :: Int -> Animation -> ShowS
$cshow :: Animation -> String
show :: Animation -> String
$cshowList :: [Animation] -> ShowS
showList :: [Animation] -> ShowS
Show)

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