module TD.Query.SetSupergroupStickerSet
  (SetSupergroupStickerSet(..)
  , defaultSetSupergroupStickerSet
  ) where

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

-- | Changes the sticker set of a supergroup; requires can_change_info administrator right. Returns 'TD.Data.Ok.Ok'
data SetSupergroupStickerSet
  = SetSupergroupStickerSet
    { SetSupergroupStickerSet -> Maybe Int
supergroup_id  :: Maybe Int -- ^ Identifier of the supergroup
    , SetSupergroupStickerSet -> Maybe Int
sticker_set_id :: Maybe Int -- ^ New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set
    }
  deriving (SetSupergroupStickerSet -> SetSupergroupStickerSet -> Bool
(SetSupergroupStickerSet -> SetSupergroupStickerSet -> Bool)
-> (SetSupergroupStickerSet -> SetSupergroupStickerSet -> Bool)
-> Eq SetSupergroupStickerSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetSupergroupStickerSet -> SetSupergroupStickerSet -> Bool
== :: SetSupergroupStickerSet -> SetSupergroupStickerSet -> Bool
$c/= :: SetSupergroupStickerSet -> SetSupergroupStickerSet -> Bool
/= :: SetSupergroupStickerSet -> SetSupergroupStickerSet -> Bool
Eq, Int -> SetSupergroupStickerSet -> ShowS
[SetSupergroupStickerSet] -> ShowS
SetSupergroupStickerSet -> String
(Int -> SetSupergroupStickerSet -> ShowS)
-> (SetSupergroupStickerSet -> String)
-> ([SetSupergroupStickerSet] -> ShowS)
-> Show SetSupergroupStickerSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetSupergroupStickerSet -> ShowS
showsPrec :: Int -> SetSupergroupStickerSet -> ShowS
$cshow :: SetSupergroupStickerSet -> String
show :: SetSupergroupStickerSet -> String
$cshowList :: [SetSupergroupStickerSet] -> ShowS
showList :: [SetSupergroupStickerSet] -> ShowS
Show)

instance I.ShortShow SetSupergroupStickerSet where
  shortShow :: SetSupergroupStickerSet -> String
shortShow
    SetSupergroupStickerSet
      { supergroup_id :: SetSupergroupStickerSet -> Maybe Int
supergroup_id  = Maybe Int
supergroup_id_
      , sticker_set_id :: SetSupergroupStickerSet -> Maybe Int
sticker_set_id = Maybe Int
sticker_set_id_
      }
        = String
"SetSupergroupStickerSet"
          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
"sticker_set_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
sticker_set_id_
          ]

instance AT.ToJSON SetSupergroupStickerSet where
  toJSON :: SetSupergroupStickerSet -> Value
toJSON
    SetSupergroupStickerSet
      { supergroup_id :: SetSupergroupStickerSet -> Maybe Int
supergroup_id  = Maybe Int
supergroup_id_
      , sticker_set_id :: SetSupergroupStickerSet -> Maybe Int
sticker_set_id = Maybe Int
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
"setSupergroupStickerSet"
          , 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
"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
sticker_set_id_
          ]

defaultSetSupergroupStickerSet :: SetSupergroupStickerSet
defaultSetSupergroupStickerSet :: SetSupergroupStickerSet
defaultSetSupergroupStickerSet =
  SetSupergroupStickerSet
    { supergroup_id :: Maybe Int
supergroup_id  = Maybe Int
forall a. Maybe a
Nothing
    , sticker_set_id :: Maybe Int
sticker_set_id = Maybe Int
forall a. Maybe a
Nothing
    }