{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.Chat where
import Data.Aeson (ToJSON(..), FromJSON(..))
import Data.Time.Clock.POSIX (POSIXTime)
import Data.Text (Text)
import GHC.Generics (Generic)
import Telegram.Bot.API.Types.ChatLocation
import Telegram.Bot.API.Types.ChatPhoto
import Telegram.Bot.API.Types.ChatPermissions
import Telegram.Bot.API.Types.Common
import Telegram.Bot.API.Types.Message
import Telegram.Bot.API.Types.ReactionType
import Telegram.Bot.API.Internal.Utils
data Chat = Chat
{ Chat -> ChatId
chatId :: ChatId
, Chat -> ChatType
chatType :: ChatType
, Chat -> Maybe Text
chatTitle :: Maybe Text
, Chat -> Maybe Text
chatUsername :: Maybe Text
, Chat -> Maybe Text
chatFirstName :: Maybe Text
, Chat -> Maybe Text
chatLastName :: Maybe Text
, Chat -> Maybe Bool
chatIsForum :: Maybe Bool
, Chat -> Maybe ChatPhoto
chatPhoto :: Maybe ChatPhoto
, Chat -> Maybe Text
chatActiveUsernames :: Maybe Text
, Chat -> Maybe [ReactionType]
chatAvailableReactions :: Maybe [ReactionType]
, Chat -> Maybe Int
chatAccentColorId :: Maybe Int
, Chat -> Maybe Text
chatBackgroundCustomEmojiId :: Maybe Text
, Chat -> Maybe Int
chatProfileAccentColorId :: Maybe Int
, Chat -> Maybe Text
chatProfileBackgroundCustomEmojiId :: Maybe Text
, Chat -> Maybe Text
chatEmojiStatusCustomEmojiId :: Maybe Text
, Chat -> Maybe POSIXTime
chatEmojiStatusExpirationDate :: Maybe POSIXTime
, Chat -> Maybe Text
chatBio :: Maybe Text
, Chat -> Maybe Bool
chatHasPrivateForwards :: Maybe Bool
, Chat -> Maybe Bool
chatHasRestrictedVoiceAndVideoMessages :: Maybe Bool
, Chat -> Maybe Bool
chatJoinToSendMessages :: Maybe Bool
, Chat -> Maybe Bool
chatJoinByRequest :: Maybe Bool
, Chat -> Maybe Text
chatDescription :: Maybe Text
, Chat -> Maybe Text
chatInviteLink :: Maybe Text
, Chat -> Maybe Message
chatPinnedMessage :: Maybe Message
, Chat -> Maybe ChatPermissions
chatPermissions :: Maybe ChatPermissions
, Chat -> Maybe Int
chatSlowModeDelay :: Maybe Int
, Chat -> Maybe POSIXTime
chatMessageAutoDeleteTime :: Maybe POSIXTime
, Chat -> Maybe Bool
chatHasAggressiveAntiSpamEnabled :: Maybe Bool
, Chat -> Maybe Bool
chatHasHiddenMembers :: Maybe Bool
, Chat -> Maybe Bool
chatHasProtectedContent :: Maybe Bool
, Chat -> Maybe Bool
chatHasVisibleHistory :: Maybe Bool
, Chat -> Maybe Text
chatStickerSetName :: Maybe Text
, Chat -> Maybe Bool
chatCanSetStickerSet :: Maybe Bool
, Chat -> Maybe ChatId
chatLinkedChatId :: Maybe ChatId
, Chat -> Maybe ChatLocation
chatLocation :: Maybe ChatLocation
}
deriving ((forall x. Chat -> Rep Chat x)
-> (forall x. Rep Chat x -> Chat) -> Generic Chat
forall x. Rep Chat x -> Chat
forall x. Chat -> Rep Chat x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Chat -> Rep Chat x
from :: forall x. Chat -> Rep Chat x
$cto :: forall x. Rep Chat x -> Chat
to :: forall x. Rep Chat x -> Chat
Generic, Int -> Chat -> ShowS
[Chat] -> ShowS
Chat -> String
(Int -> Chat -> ShowS)
-> (Chat -> String) -> ([Chat] -> ShowS) -> Show Chat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Chat -> ShowS
showsPrec :: Int -> Chat -> ShowS
$cshow :: Chat -> String
show :: Chat -> String
$cshowList :: [Chat] -> ShowS
showList :: [Chat] -> ShowS
Show)
instance ToJSON Chat where toJSON :: Chat -> Value
toJSON = Chat -> Value
forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON Chat where parseJSON :: Value -> Parser Chat
parseJSON = Value -> Parser Chat
forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON
data ChatType
= ChatTypePrivate
| ChatTypeGroup
| ChatTypeSupergroup
| ChatTypeChannel
| ChatTypeSender
deriving ((forall x. ChatType -> Rep ChatType x)
-> (forall x. Rep ChatType x -> ChatType) -> Generic ChatType
forall x. Rep ChatType x -> ChatType
forall x. ChatType -> Rep ChatType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ChatType -> Rep ChatType x
from :: forall x. ChatType -> Rep ChatType x
$cto :: forall x. Rep ChatType x -> ChatType
to :: forall x. Rep ChatType x -> ChatType
Generic, Int -> ChatType -> ShowS
[ChatType] -> ShowS
ChatType -> String
(Int -> ChatType -> ShowS)
-> (ChatType -> String) -> ([ChatType] -> ShowS) -> Show ChatType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChatType -> ShowS
showsPrec :: Int -> ChatType -> ShowS
$cshow :: ChatType -> String
show :: ChatType -> String
$cshowList :: [ChatType] -> ShowS
showList :: [ChatType] -> ShowS
Show)
instance ToJSON ChatType where
toJSON :: ChatType -> Value
toJSON = ChatType -> Value
forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON ChatType where
parseJSON :: Value -> Parser ChatType
parseJSON = Value -> Parser ChatType
forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON