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

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

import Telegram.Bot.API.Internal.Utils

-- ** 'ChatType'

-- | Type of the chat, can be either “private”, “group”, “supergroup” or “channel”.

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