module TD.Query.GetStickers
  (GetStickers(..)
  , defaultGetStickers
  ) 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
import qualified Data.Text as T

-- | Returns stickers from the installed sticker sets that correspond to any of the given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned. Returns 'TD.Data.Stickers.Stickers'
data GetStickers
  = GetStickers
    { GetStickers -> Maybe StickerType
sticker_type :: Maybe StickerType.StickerType -- ^ Type of the stickers to return
    , GetStickers -> Maybe Text
query        :: Maybe T.Text                  -- ^ Search query; a space-separated list of emojis or a keyword prefix. If empty, returns all known installed stickers
    , GetStickers -> Maybe Int
limit        :: Maybe Int                     -- ^ The maximum number of stickers to be returned
    , GetStickers -> Maybe Int
chat_id      :: Maybe Int                     -- ^ Chat identifier for which to return stickers. Available custom emoji stickers may be different for different chats
    }
  deriving (GetStickers -> GetStickers -> Bool
(GetStickers -> GetStickers -> Bool)
-> (GetStickers -> GetStickers -> Bool) -> Eq GetStickers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetStickers -> GetStickers -> Bool
== :: GetStickers -> GetStickers -> Bool
$c/= :: GetStickers -> GetStickers -> Bool
/= :: GetStickers -> GetStickers -> Bool
Eq, Int -> GetStickers -> ShowS
[GetStickers] -> ShowS
GetStickers -> String
(Int -> GetStickers -> ShowS)
-> (GetStickers -> String)
-> ([GetStickers] -> ShowS)
-> Show GetStickers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetStickers -> ShowS
showsPrec :: Int -> GetStickers -> ShowS
$cshow :: GetStickers -> String
show :: GetStickers -> String
$cshowList :: [GetStickers] -> ShowS
showList :: [GetStickers] -> ShowS
Show)

instance I.ShortShow GetStickers where
  shortShow :: GetStickers -> String
shortShow
    GetStickers
      { sticker_type :: GetStickers -> Maybe StickerType
sticker_type = Maybe StickerType
sticker_type_
      , query :: GetStickers -> Maybe Text
query        = Maybe Text
query_
      , limit :: GetStickers -> Maybe Int
limit        = Maybe Int
limit_
      , chat_id :: GetStickers -> Maybe Int
chat_id      = Maybe Int
chat_id_
      }
        = String
"GetStickers"
          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
"query"        String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
query_
          , String
"limit"        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
          , String
"chat_id"      String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          ]

instance AT.ToJSON GetStickers where
  toJSON :: GetStickers -> Value
toJSON
    GetStickers
      { sticker_type :: GetStickers -> Maybe StickerType
sticker_type = Maybe StickerType
sticker_type_
      , query :: GetStickers -> Maybe Text
query        = Maybe Text
query_
      , limit :: GetStickers -> Maybe Int
limit        = Maybe Int
limit_
      , chat_id :: GetStickers -> Maybe Int
chat_id      = Maybe Int
chat_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
"getStickers"
          , 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
"query"        Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
query_
          , 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_
          , Key
"chat_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
chat_id_
          ]

defaultGetStickers :: GetStickers
defaultGetStickers :: GetStickers
defaultGetStickers =
  GetStickers
    { sticker_type :: Maybe StickerType
sticker_type = Maybe StickerType
forall a. Maybe a
Nothing
    , query :: Maybe Text
query        = Maybe Text
forall a. Maybe a
Nothing
    , limit :: Maybe Int
limit        = Maybe Int
forall a. Maybe a
Nothing
    , chat_id :: Maybe Int
chat_id      = Maybe Int
forall a. Maybe a
Nothing
    }