module TD.Query.GetTrendingStickerSets
  (GetTrendingStickerSets(..)
  , defaultGetTrendingStickerSets
  ) 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 trending sticker sets. For optimal performance, the number of returned sticker sets is chosen by TDLib. Returns 'TD.Data.TrendingStickerSets.TrendingStickerSets'
data GetTrendingStickerSets
  = GetTrendingStickerSets
    { GetTrendingStickerSets -> Maybe StickerType
sticker_type :: Maybe StickerType.StickerType -- ^ Type of the sticker sets to return
    , GetTrendingStickerSets -> Maybe Int
offset       :: Maybe Int                     -- ^ The offset from which to return the sticker sets; must be non-negative
    , GetTrendingStickerSets -> Maybe Int
limit        :: Maybe Int                     -- ^ The maximum number of sticker sets to be returned; up to 100. For optimal performance, the number of returned sticker sets is chosen by TDLib and can be smaller than the specified limit, even if the end of the list has not been reached
    }
  deriving (GetTrendingStickerSets -> GetTrendingStickerSets -> Bool
(GetTrendingStickerSets -> GetTrendingStickerSets -> Bool)
-> (GetTrendingStickerSets -> GetTrendingStickerSets -> Bool)
-> Eq GetTrendingStickerSets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetTrendingStickerSets -> GetTrendingStickerSets -> Bool
== :: GetTrendingStickerSets -> GetTrendingStickerSets -> Bool
$c/= :: GetTrendingStickerSets -> GetTrendingStickerSets -> Bool
/= :: GetTrendingStickerSets -> GetTrendingStickerSets -> Bool
Eq, Int -> GetTrendingStickerSets -> ShowS
[GetTrendingStickerSets] -> ShowS
GetTrendingStickerSets -> String
(Int -> GetTrendingStickerSets -> ShowS)
-> (GetTrendingStickerSets -> String)
-> ([GetTrendingStickerSets] -> ShowS)
-> Show GetTrendingStickerSets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetTrendingStickerSets -> ShowS
showsPrec :: Int -> GetTrendingStickerSets -> ShowS
$cshow :: GetTrendingStickerSets -> String
show :: GetTrendingStickerSets -> String
$cshowList :: [GetTrendingStickerSets] -> ShowS
showList :: [GetTrendingStickerSets] -> ShowS
Show)

instance I.ShortShow GetTrendingStickerSets where
  shortShow :: GetTrendingStickerSets -> String
shortShow
    GetTrendingStickerSets
      { sticker_type :: GetTrendingStickerSets -> Maybe StickerType
sticker_type = Maybe StickerType
sticker_type_
      , offset :: GetTrendingStickerSets -> Maybe Int
offset       = Maybe Int
offset_
      , limit :: GetTrendingStickerSets -> Maybe Int
limit        = Maybe Int
limit_
      }
        = String
"GetTrendingStickerSets"
          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"       String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
offset_
          , String
"limit"        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
          ]

instance AT.ToJSON GetTrendingStickerSets where
  toJSON :: GetTrendingStickerSets -> Value
toJSON
    GetTrendingStickerSets
      { sticker_type :: GetTrendingStickerSets -> Maybe StickerType
sticker_type = Maybe StickerType
sticker_type_
      , offset :: GetTrendingStickerSets -> Maybe Int
offset       = Maybe Int
offset_
      , limit :: GetTrendingStickerSets -> 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
"getTrendingStickerSets"
          , 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"       Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
offset_
          , 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_
          ]

defaultGetTrendingStickerSets :: GetTrendingStickerSets
defaultGetTrendingStickerSets :: GetTrendingStickerSets
defaultGetTrendingStickerSets =
  GetTrendingStickerSets
    { sticker_type :: Maybe StickerType
sticker_type = Maybe StickerType
forall a. Maybe a
Nothing
    , offset :: Maybe Int
offset       = Maybe Int
forall a. Maybe a
Nothing
    , limit :: Maybe Int
limit        = Maybe Int
forall a. Maybe a
Nothing
    }