module TD.Query.GetStickerSetName
  (GetStickerSetName(..)
  ) where

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

-- | Returns name of a sticker set by its identifier. Returns 'TD.Data.Text.Text'
data GetStickerSetName
  = GetStickerSetName
    { GetStickerSetName -> Maybe Int
set_id :: Maybe Int -- ^ Identifier of the sticker set
    }
  deriving (GetStickerSetName -> GetStickerSetName -> Bool
(GetStickerSetName -> GetStickerSetName -> Bool)
-> (GetStickerSetName -> GetStickerSetName -> Bool)
-> Eq GetStickerSetName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetStickerSetName -> GetStickerSetName -> Bool
== :: GetStickerSetName -> GetStickerSetName -> Bool
$c/= :: GetStickerSetName -> GetStickerSetName -> Bool
/= :: GetStickerSetName -> GetStickerSetName -> Bool
Eq, Int -> GetStickerSetName -> ShowS
[GetStickerSetName] -> ShowS
GetStickerSetName -> String
(Int -> GetStickerSetName -> ShowS)
-> (GetStickerSetName -> String)
-> ([GetStickerSetName] -> ShowS)
-> Show GetStickerSetName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetStickerSetName -> ShowS
showsPrec :: Int -> GetStickerSetName -> ShowS
$cshow :: GetStickerSetName -> String
show :: GetStickerSetName -> String
$cshowList :: [GetStickerSetName] -> ShowS
showList :: [GetStickerSetName] -> ShowS
Show)

instance I.ShortShow GetStickerSetName where
  shortShow :: GetStickerSetName -> String
shortShow
    GetStickerSetName
      { set_id :: GetStickerSetName -> Maybe Int
set_id = Maybe Int
set_id_
      }
        = String
"GetStickerSetName"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"set_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
set_id_
          ]

instance AT.ToJSON GetStickerSetName where
  toJSON :: GetStickerSetName -> Value
toJSON
    GetStickerSetName
      { set_id :: GetStickerSetName -> Maybe Int
set_id = Maybe Int
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
"getStickerSetName"
          , Key
"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
set_id_
          ]