module TD.Query.GetArchivedStickerSets
  (GetArchivedStickerSets(..)
  , defaultGetArchivedStickerSets
  ) 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.StickerType as StickerType

-- | Returns a list of archived sticker sets. Returns 'TD.Data.StickerSets.StickerSets'
data GetArchivedStickerSets
  = GetArchivedStickerSets
    { GetArchivedStickerSets -> Maybe StickerType
sticker_type          :: Maybe StickerType.StickerType -- ^ Type of the sticker sets to return
    , GetArchivedStickerSets -> Maybe Int
offset_sticker_set_id :: Maybe Int                     -- ^ Identifier of the sticker set from which to return the result; use 0 to get results from the beginning
    , GetArchivedStickerSets -> Maybe Int
limit                 :: Maybe Int                     -- ^ The maximum number of sticker sets to return; up to 100
    }
  deriving (GetArchivedStickerSets -> GetArchivedStickerSets -> Bool
(GetArchivedStickerSets -> GetArchivedStickerSets -> Bool)
-> (GetArchivedStickerSets -> GetArchivedStickerSets -> Bool)
-> Eq GetArchivedStickerSets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetArchivedStickerSets -> GetArchivedStickerSets -> Bool
== :: GetArchivedStickerSets -> GetArchivedStickerSets -> Bool
$c/= :: GetArchivedStickerSets -> GetArchivedStickerSets -> Bool
/= :: GetArchivedStickerSets -> GetArchivedStickerSets -> Bool
Eq, Int -> GetArchivedStickerSets -> ShowS
[GetArchivedStickerSets] -> ShowS
GetArchivedStickerSets -> String
(Int -> GetArchivedStickerSets -> ShowS)
-> (GetArchivedStickerSets -> String)
-> ([GetArchivedStickerSets] -> ShowS)
-> Show GetArchivedStickerSets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetArchivedStickerSets -> ShowS
showsPrec :: Int -> GetArchivedStickerSets -> ShowS
$cshow :: GetArchivedStickerSets -> String
show :: GetArchivedStickerSets -> String
$cshowList :: [GetArchivedStickerSets] -> ShowS
showList :: [GetArchivedStickerSets] -> ShowS
Show)

instance I.ShortShow GetArchivedStickerSets where
  shortShow :: GetArchivedStickerSets -> String
shortShow
    GetArchivedStickerSets
      { sticker_type :: GetArchivedStickerSets -> Maybe StickerType
sticker_type          = Maybe StickerType
sticker_type_
      , offset_sticker_set_id :: GetArchivedStickerSets -> Maybe Int
offset_sticker_set_id = Maybe Int
offset_sticker_set_id_
      , limit :: GetArchivedStickerSets -> Maybe Int
limit                 = Maybe Int
limit_
      }
        = String
"GetArchivedStickerSets"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"sticker_type"          String -> Maybe StickerType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe StickerType
sticker_type_
          , String
"offset_sticker_set_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
offset_sticker_set_id_
          , String
"limit"                 String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
          ]

instance AT.ToJSON GetArchivedStickerSets where
  toJSON :: GetArchivedStickerSets -> Value
toJSON
    GetArchivedStickerSets
      { sticker_type :: GetArchivedStickerSets -> Maybe StickerType
sticker_type          = Maybe StickerType
sticker_type_
      , offset_sticker_set_id :: GetArchivedStickerSets -> Maybe Int
offset_sticker_set_id = Maybe Int
offset_sticker_set_id_
      , limit :: GetArchivedStickerSets -> Maybe Int
limit                 = Maybe Int
limit_
      }
        = [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
"getArchivedStickerSets"
          , Key
"sticker_type"          Key -> Maybe StickerType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe StickerType
sticker_type_
          , Key
"offset_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
offset_sticker_set_id_
          , Key
"limit"                 Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
limit_
          ]

defaultGetArchivedStickerSets :: GetArchivedStickerSets
defaultGetArchivedStickerSets :: GetArchivedStickerSets
defaultGetArchivedStickerSets =
  GetArchivedStickerSets
    { sticker_type :: Maybe StickerType
sticker_type          = Maybe StickerType
forall a. Maybe a
Nothing
    , offset_sticker_set_id :: Maybe Int
offset_sticker_set_id = Maybe Int
forall a. Maybe a
Nothing
    , limit :: Maybe Int
limit                 = Maybe Int
forall a. Maybe a
Nothing
    }