module TD.Query.SetChatAvailableReactions
  (SetChatAvailableReactions(..)
  , defaultSetChatAvailableReactions
  ) 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.ChatAvailableReactions as ChatAvailableReactions

-- | Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info member right. Returns 'TD.Data.Ok.Ok'
data SetChatAvailableReactions
  = SetChatAvailableReactions
    { SetChatAvailableReactions -> Maybe Int
chat_id             :: Maybe Int                                           -- ^ Identifier of the chat
    , SetChatAvailableReactions -> Maybe ChatAvailableReactions
available_reactions :: Maybe ChatAvailableReactions.ChatAvailableReactions -- ^ Reactions available in the chat. All explicitly specified emoji reactions must be active. In channel chats up to the chat's boost level custom emoji reactions can be explicitly specified
    }
  deriving (SetChatAvailableReactions -> SetChatAvailableReactions -> Bool
(SetChatAvailableReactions -> SetChatAvailableReactions -> Bool)
-> (SetChatAvailableReactions -> SetChatAvailableReactions -> Bool)
-> Eq SetChatAvailableReactions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetChatAvailableReactions -> SetChatAvailableReactions -> Bool
== :: SetChatAvailableReactions -> SetChatAvailableReactions -> Bool
$c/= :: SetChatAvailableReactions -> SetChatAvailableReactions -> Bool
/= :: SetChatAvailableReactions -> SetChatAvailableReactions -> Bool
Eq, Int -> SetChatAvailableReactions -> ShowS
[SetChatAvailableReactions] -> ShowS
SetChatAvailableReactions -> String
(Int -> SetChatAvailableReactions -> ShowS)
-> (SetChatAvailableReactions -> String)
-> ([SetChatAvailableReactions] -> ShowS)
-> Show SetChatAvailableReactions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetChatAvailableReactions -> ShowS
showsPrec :: Int -> SetChatAvailableReactions -> ShowS
$cshow :: SetChatAvailableReactions -> String
show :: SetChatAvailableReactions -> String
$cshowList :: [SetChatAvailableReactions] -> ShowS
showList :: [SetChatAvailableReactions] -> ShowS
Show)

instance I.ShortShow SetChatAvailableReactions where
  shortShow :: SetChatAvailableReactions -> String
shortShow
    SetChatAvailableReactions
      { chat_id :: SetChatAvailableReactions -> Maybe Int
chat_id             = Maybe Int
chat_id_
      , available_reactions :: SetChatAvailableReactions -> Maybe ChatAvailableReactions
available_reactions = Maybe ChatAvailableReactions
available_reactions_
      }
        = String
"SetChatAvailableReactions"
          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
"available_reactions" String -> Maybe ChatAvailableReactions -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatAvailableReactions
available_reactions_
          ]

instance AT.ToJSON SetChatAvailableReactions where
  toJSON :: SetChatAvailableReactions -> Value
toJSON
    SetChatAvailableReactions
      { chat_id :: SetChatAvailableReactions -> Maybe Int
chat_id             = Maybe Int
chat_id_
      , available_reactions :: SetChatAvailableReactions -> Maybe ChatAvailableReactions
available_reactions = Maybe ChatAvailableReactions
available_reactions_
      }
        = [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
"setChatAvailableReactions"
          , 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
"available_reactions" Key -> Maybe ChatAvailableReactions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ChatAvailableReactions
available_reactions_
          ]

defaultSetChatAvailableReactions :: SetChatAvailableReactions
defaultSetChatAvailableReactions :: SetChatAvailableReactions
defaultSetChatAvailableReactions =
  SetChatAvailableReactions
    { chat_id :: Maybe Int
chat_id             = Maybe Int
forall a. Maybe a
Nothing
    , available_reactions :: Maybe ChatAvailableReactions
available_reactions = Maybe ChatAvailableReactions
forall a. Maybe a
Nothing
    }