module TD.Query.SetSupergroupCustomEmojiStickerSet
  (SetSupergroupCustomEmojiStickerSet(..)
  , defaultSetSupergroupCustomEmojiStickerSet
  ) where

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

-- | Changes the custom emoji sticker set of a supergroup; requires can_change_info administrator right. The chat must have at least chatBoostFeatures.min_custom_emoji_sticker_set_boost_level boost level to pass the corresponding color. Returns 'TD.Data.Ok.Ok'
data SetSupergroupCustomEmojiStickerSet
  = SetSupergroupCustomEmojiStickerSet
    { SetSupergroupCustomEmojiStickerSet -> Maybe Int
supergroup_id               :: Maybe Int -- ^ Identifier of the supergroup
    , SetSupergroupCustomEmojiStickerSet -> Maybe Int
custom_emoji_sticker_set_id :: Maybe Int -- ^ New value of the custom emoji sticker set identifier for the supergroup. Use 0 to remove the custom emoji sticker set in the supergroup
    }
  deriving (SetSupergroupCustomEmojiStickerSet
-> SetSupergroupCustomEmojiStickerSet -> Bool
(SetSupergroupCustomEmojiStickerSet
 -> SetSupergroupCustomEmojiStickerSet -> Bool)
-> (SetSupergroupCustomEmojiStickerSet
    -> SetSupergroupCustomEmojiStickerSet -> Bool)
-> Eq SetSupergroupCustomEmojiStickerSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetSupergroupCustomEmojiStickerSet
-> SetSupergroupCustomEmojiStickerSet -> Bool
== :: SetSupergroupCustomEmojiStickerSet
-> SetSupergroupCustomEmojiStickerSet -> Bool
$c/= :: SetSupergroupCustomEmojiStickerSet
-> SetSupergroupCustomEmojiStickerSet -> Bool
/= :: SetSupergroupCustomEmojiStickerSet
-> SetSupergroupCustomEmojiStickerSet -> Bool
Eq, Int -> SetSupergroupCustomEmojiStickerSet -> ShowS
[SetSupergroupCustomEmojiStickerSet] -> ShowS
SetSupergroupCustomEmojiStickerSet -> String
(Int -> SetSupergroupCustomEmojiStickerSet -> ShowS)
-> (SetSupergroupCustomEmojiStickerSet -> String)
-> ([SetSupergroupCustomEmojiStickerSet] -> ShowS)
-> Show SetSupergroupCustomEmojiStickerSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetSupergroupCustomEmojiStickerSet -> ShowS
showsPrec :: Int -> SetSupergroupCustomEmojiStickerSet -> ShowS
$cshow :: SetSupergroupCustomEmojiStickerSet -> String
show :: SetSupergroupCustomEmojiStickerSet -> String
$cshowList :: [SetSupergroupCustomEmojiStickerSet] -> ShowS
showList :: [SetSupergroupCustomEmojiStickerSet] -> ShowS
Show)

instance I.ShortShow SetSupergroupCustomEmojiStickerSet where
  shortShow :: SetSupergroupCustomEmojiStickerSet -> String
shortShow
    SetSupergroupCustomEmojiStickerSet
      { supergroup_id :: SetSupergroupCustomEmojiStickerSet -> Maybe Int
supergroup_id               = Maybe Int
supergroup_id_
      , custom_emoji_sticker_set_id :: SetSupergroupCustomEmojiStickerSet -> Maybe Int
custom_emoji_sticker_set_id = Maybe Int
custom_emoji_sticker_set_id_
      }
        = String
"SetSupergroupCustomEmojiStickerSet"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"supergroup_id"               String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
supergroup_id_
          , String
"custom_emoji_sticker_set_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
custom_emoji_sticker_set_id_
          ]

instance AT.ToJSON SetSupergroupCustomEmojiStickerSet where
  toJSON :: SetSupergroupCustomEmojiStickerSet -> Value
toJSON
    SetSupergroupCustomEmojiStickerSet
      { supergroup_id :: SetSupergroupCustomEmojiStickerSet -> Maybe Int
supergroup_id               = Maybe Int
supergroup_id_
      , custom_emoji_sticker_set_id :: SetSupergroupCustomEmojiStickerSet -> Maybe Int
custom_emoji_sticker_set_id = Maybe Int
custom_emoji_sticker_set_id_
      }
        = [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
"setSupergroupCustomEmojiStickerSet"
          , Key
"supergroup_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
supergroup_id_
          , Key
"custom_emoji_sticker_set_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64  Maybe Int
custom_emoji_sticker_set_id_
          ]

defaultSetSupergroupCustomEmojiStickerSet :: SetSupergroupCustomEmojiStickerSet
defaultSetSupergroupCustomEmojiStickerSet :: SetSupergroupCustomEmojiStickerSet
defaultSetSupergroupCustomEmojiStickerSet =
  SetSupergroupCustomEmojiStickerSet
    { supergroup_id :: Maybe Int
supergroup_id               = Maybe Int
forall a. Maybe a
Nothing
    , custom_emoji_sticker_set_id :: Maybe Int
custom_emoji_sticker_set_id = Maybe Int
forall a. Maybe a
Nothing
    }