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

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

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

-- ** 'ChatBoost'

-- | This object contains information about a chat boost.
data ChatBoost = ChatBoost
  { ChatBoost -> BoostId
chatBoostBoostId :: BoostId -- ^ Unique identifier of the boost.
  , ChatBoost -> POSIXTime
chatBoostAddTime :: POSIXTime -- ^ Point in time (Unix timestamp) when the chat was boosted.
  , ChatBoost -> POSIXTime
chatBoostExpirateionDate :: POSIXTime -- ^ Point in time (Unix timestamp) when the boost will automatically expire, unless the booster's Telegram Premium subscription is prolonged.
  , ChatBoost -> ChatBoostSource
chatBoostSource :: ChatBoostSource -- ^ Source of the added boost.
  }
  deriving ((forall x. ChatBoost -> Rep ChatBoost x)
-> (forall x. Rep ChatBoost x -> ChatBoost) -> Generic ChatBoost
forall x. Rep ChatBoost x -> ChatBoost
forall x. ChatBoost -> Rep ChatBoost x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ChatBoost -> Rep ChatBoost x
from :: forall x. ChatBoost -> Rep ChatBoost x
$cto :: forall x. Rep ChatBoost x -> ChatBoost
to :: forall x. Rep ChatBoost x -> ChatBoost
Generic, Int -> ChatBoost -> ShowS
[ChatBoost] -> ShowS
ChatBoost -> String
(Int -> ChatBoost -> ShowS)
-> (ChatBoost -> String)
-> ([ChatBoost] -> ShowS)
-> Show ChatBoost
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChatBoost -> ShowS
showsPrec :: Int -> ChatBoost -> ShowS
$cshow :: ChatBoost -> String
show :: ChatBoost -> String
$cshowList :: [ChatBoost] -> ShowS
showList :: [ChatBoost] -> ShowS
Show)

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