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

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

import Telegram.Bot.API.Types.Common
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.
  }
  deriving (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
$cto :: forall x. Rep ChatShared x -> ChatShared
$cfrom :: forall x. ChatShared -> Rep ChatShared x
Generic, Int -> ChatShared -> ShowS
[ChatShared] -> ShowS
ChatShared -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChatShared] -> ShowS
$cshowList :: [ChatShared] -> ShowS
show :: ChatShared -> String
$cshow :: ChatShared -> String
showsPrec :: Int -> ChatShared -> ShowS
$cshowsPrec :: Int -> ChatShared -> ShowS
Show)

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