{-# 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
chatAdministratorRightsCanPostStories      :: Maybe Bool -- ^ 'True', if the administrator can post stories in the channel; channels only.
  , ChatAdministratorRights -> Maybe Bool
chatAdministratorRightsCanEditStories      :: Maybe Bool -- ^ 'True', if the administrator can edit stories posted by other users; channels only.
  , ChatAdministratorRights -> Maybe Bool
chatAdministratorRightsCanDeleteStories    :: Maybe Bool -- ^ 'True', if the administrator can delete stories posted by other users; channels 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.
 ChatAdministratorRights -> Rep ChatAdministratorRights x)
-> (forall x.
    Rep ChatAdministratorRights x -> ChatAdministratorRights)
-> Generic ChatAdministratorRights
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
$cfrom :: forall x. ChatAdministratorRights -> Rep ChatAdministratorRights x
from :: forall x. ChatAdministratorRights -> Rep ChatAdministratorRights x
$cto :: forall x. Rep ChatAdministratorRights x -> ChatAdministratorRights
to :: forall x. Rep ChatAdministratorRights x -> ChatAdministratorRights
Generic, Int -> ChatAdministratorRights -> ShowS
[ChatAdministratorRights] -> ShowS
ChatAdministratorRights -> String
(Int -> ChatAdministratorRights -> ShowS)
-> (ChatAdministratorRights -> String)
-> ([ChatAdministratorRights] -> ShowS)
-> Show ChatAdministratorRights
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChatAdministratorRights -> ShowS
showsPrec :: Int -> ChatAdministratorRights -> ShowS
$cshow :: ChatAdministratorRights -> String
show :: ChatAdministratorRights -> String
$cshowList :: [ChatAdministratorRights] -> ShowS
showList :: [ChatAdministratorRights] -> ShowS
Show)

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