{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.ChatShared 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

-- ** 'ChatShared'

-- | This object contains information about the chat whose identifier was shared with the bot using a 'KeyboardButtonRequestChat' button.
data ChatShared = ChatShared
  { ChatShared -> RequestId
chatSharedRequestId :: RequestId -- ^ Identifier of the request.
  , ChatShared -> ChatId
chatSharedChatId :: ChatId -- ^ Identifier of the shared chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means.
  , ChatShared -> Maybe Text
chatSharedTitle :: Maybe Text -- ^ Title of the chat, if the title was requested by the bot.
  , ChatShared -> Maybe Text
chatSharedUsername :: Maybe Text -- ^ Username of the chat, if the username was requested by the bot and available.
  , ChatShared -> Maybe [PhotoSize]
chatSharedPhoto :: Maybe [PhotoSize] -- ^ Available sizes of the chat photo, if the photo was requested by the bot.
  }
  deriving ((forall x. ChatShared -> Rep ChatShared x)
-> (forall x. Rep ChatShared x -> ChatShared) -> Generic ChatShared
forall x. Rep ChatShared x -> ChatShared
forall x. ChatShared -> Rep ChatShared x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ChatShared -> Rep ChatShared x
from :: forall x. ChatShared -> Rep ChatShared x
$cto :: forall x. Rep ChatShared x -> ChatShared
to :: forall x. Rep ChatShared x -> ChatShared
Generic, Int -> ChatShared -> ShowS
[ChatShared] -> ShowS
ChatShared -> String
(Int -> ChatShared -> ShowS)
-> (ChatShared -> String)
-> ([ChatShared] -> ShowS)
-> Show ChatShared
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChatShared -> ShowS
showsPrec :: Int -> ChatShared -> ShowS
$cshow :: ChatShared -> String
show :: ChatShared -> String
$cshowList :: [ChatShared] -> ShowS
showList :: [ChatShared] -> ShowS
Show)

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