module TD.Query.SetChatEmojiStatus
  (SetChatEmojiStatus(..)
  , defaultSetChatEmojiStatus
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.EmojiStatus as EmojiStatus

-- | Changes the emoji status of a chat. Use chatBoostLevelFeatures.can_set_emoji_status to check whether an emoji status can be set. Requires can_change_info administrator right. Returns 'TD.Data.Ok.Ok'
data SetChatEmojiStatus
  = SetChatEmojiStatus
    { SetChatEmojiStatus -> Maybe Int
chat_id      :: Maybe Int                     -- ^ Chat identifier
    , SetChatEmojiStatus -> Maybe EmojiStatus
emoji_status :: Maybe EmojiStatus.EmojiStatus -- ^ New emoji status; pass null to remove emoji status
    }
  deriving (SetChatEmojiStatus -> SetChatEmojiStatus -> Bool
(SetChatEmojiStatus -> SetChatEmojiStatus -> Bool)
-> (SetChatEmojiStatus -> SetChatEmojiStatus -> Bool)
-> Eq SetChatEmojiStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetChatEmojiStatus -> SetChatEmojiStatus -> Bool
== :: SetChatEmojiStatus -> SetChatEmojiStatus -> Bool
$c/= :: SetChatEmojiStatus -> SetChatEmojiStatus -> Bool
/= :: SetChatEmojiStatus -> SetChatEmojiStatus -> Bool
Eq, Int -> SetChatEmojiStatus -> ShowS
[SetChatEmojiStatus] -> ShowS
SetChatEmojiStatus -> String
(Int -> SetChatEmojiStatus -> ShowS)
-> (SetChatEmojiStatus -> String)
-> ([SetChatEmojiStatus] -> ShowS)
-> Show SetChatEmojiStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetChatEmojiStatus -> ShowS
showsPrec :: Int -> SetChatEmojiStatus -> ShowS
$cshow :: SetChatEmojiStatus -> String
show :: SetChatEmojiStatus -> String
$cshowList :: [SetChatEmojiStatus] -> ShowS
showList :: [SetChatEmojiStatus] -> ShowS
Show)

instance I.ShortShow SetChatEmojiStatus where
  shortShow :: SetChatEmojiStatus -> String
shortShow
    SetChatEmojiStatus
      { chat_id :: SetChatEmojiStatus -> Maybe Int
chat_id      = Maybe Int
chat_id_
      , emoji_status :: SetChatEmojiStatus -> Maybe EmojiStatus
emoji_status = Maybe EmojiStatus
emoji_status_
      }
        = String
"SetChatEmojiStatus"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_id"      String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          , String
"emoji_status" String -> Maybe EmojiStatus -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe EmojiStatus
emoji_status_
          ]

instance AT.ToJSON SetChatEmojiStatus where
  toJSON :: SetChatEmojiStatus -> Value
toJSON
    SetChatEmojiStatus
      { chat_id :: SetChatEmojiStatus -> Maybe Int
chat_id      = Maybe Int
chat_id_
      , emoji_status :: SetChatEmojiStatus -> Maybe EmojiStatus
emoji_status = Maybe EmojiStatus
emoji_status_
      }
        = [Pair] -> Value
A.object
          [ Key
"@type"        Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"setChatEmojiStatus"
          , Key
"chat_id"      Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
chat_id_
          , Key
"emoji_status" Key -> Maybe EmojiStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe EmojiStatus
emoji_status_
          ]

defaultSetChatEmojiStatus :: SetChatEmojiStatus
defaultSetChatEmojiStatus :: SetChatEmojiStatus
defaultSetChatEmojiStatus =
  SetChatEmojiStatus
    { chat_id :: Maybe Int
chat_id      = Maybe Int
forall a. Maybe a
Nothing
    , emoji_status :: Maybe EmojiStatus
emoji_status = Maybe EmojiStatus
forall a. Maybe a
Nothing
    }