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

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

import Telegram.Bot.API.Internal.Utils

-- ** 'ChatAdministratorRights'

-- | Represents the rights of an administrator in a chat.
data ChatAdministratorRights = ChatAdministratorRights
  { ChatAdministratorRights -> Bool
chatAdministratorRightsIsAnonymous         :: Bool -- ^ 'True', if the user's presence in the chat is hidden.
  , ChatAdministratorRights -> Bool
chatAdministratorRightsCanManageChat       :: Bool -- ^ 'True', if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege.
  , ChatAdministratorRights -> Bool
chatAdministratorRightsCanDeleteMessages   :: Bool -- ^ 'True', if the administrator can delete messages of other users.
  , ChatAdministratorRights -> Bool
chatAdministratorRightsCanManageVideoChats :: Bool -- ^ 'True', if the administrator can manage video chats.
  , ChatAdministratorRights -> Bool
chatAdministratorRightsCanRestrictMembers  :: Bool -- ^ 'True', if the administrator can restrict, ban or unban chat members.
  , ChatAdministratorRights -> Bool
chatAdministratorRightsCanPromoteMembers   :: Bool -- ^ 'True', if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user).
  , ChatAdministratorRights -> Bool
chatAdministratorRightsCanChangeInfo       :: Bool -- ^ 'True', if the user is allowed to change the chat title, photo and other settings.
  , ChatAdministratorRights -> Bool
chatAdministratorRightsCanInviteUsers      :: Bool -- ^ 'True', if the user is allowed to invite new users to the chat.
  , ChatAdministratorRights -> Maybe Bool
chatAdministratorRightsCanPostMessages     :: Maybe Bool -- ^ 'True', if the administrator can post in the channel; channels only.
  , ChatAdministratorRights -> Maybe Bool
chatAdministratorRightsCanEditMessages     :: Maybe Bool -- ^ 'True', if the administrator can edit messages of other users and can pin messages; channels only.
  , ChatAdministratorRights -> Maybe Bool
chatAdministratorRightsCanPinMessages      :: Maybe Bool -- ^ 'True', if the user is allowed to pin messages; groups and supergroups only
  , ChatAdministratorRights -> Maybe Bool
chatAdministratorRightsCanManageTopics     :: Maybe Bool -- ^ 'True', if the user is allowed to create, rename, close, and reopen forum topics; supergroups only.
  }
  deriving (forall x. Rep ChatAdministratorRights x -> ChatAdministratorRights
forall x. ChatAdministratorRights -> Rep ChatAdministratorRights x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChatAdministratorRights x -> ChatAdministratorRights
$cfrom :: forall x. ChatAdministratorRights -> Rep ChatAdministratorRights x
Generic, Int -> ChatAdministratorRights -> ShowS
[ChatAdministratorRights] -> ShowS
ChatAdministratorRights -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChatAdministratorRights] -> ShowS
$cshowList :: [ChatAdministratorRights] -> ShowS
show :: ChatAdministratorRights -> String
$cshow :: ChatAdministratorRights -> String
showsPrec :: Int -> ChatAdministratorRights -> ShowS
$cshowsPrec :: Int -> ChatAdministratorRights -> ShowS
Show)

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