module TD.Query.SearchInstalledStickerSets
  (SearchInstalledStickerSets(..)
  , defaultSearchInstalledStickerSets
  ) 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

-- | Searches for installed sticker sets by looking for specified query in their title and name. Returns 'TD.Data.StickerSets.StickerSets'
data SearchInstalledStickerSets
  = SearchInstalledStickerSets
    { SearchInstalledStickerSets -> Maybe StickerType
sticker_type :: Maybe StickerType.StickerType -- ^ Type of the sticker sets to search for
    , SearchInstalledStickerSets -> Maybe Text
query        :: Maybe T.Text                  -- ^ Query to search for
    , SearchInstalledStickerSets -> Maybe Int
limit        :: Maybe Int                     -- ^ The maximum number of sticker sets to return
    }
  deriving (SearchInstalledStickerSets -> SearchInstalledStickerSets -> Bool
(SearchInstalledStickerSets -> SearchInstalledStickerSets -> Bool)
-> (SearchInstalledStickerSets
    -> SearchInstalledStickerSets -> Bool)
-> Eq SearchInstalledStickerSets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SearchInstalledStickerSets -> SearchInstalledStickerSets -> Bool
== :: SearchInstalledStickerSets -> SearchInstalledStickerSets -> Bool
$c/= :: SearchInstalledStickerSets -> SearchInstalledStickerSets -> Bool
/= :: SearchInstalledStickerSets -> SearchInstalledStickerSets -> Bool
Eq, Int -> SearchInstalledStickerSets -> ShowS
[SearchInstalledStickerSets] -> ShowS
SearchInstalledStickerSets -> String
(Int -> SearchInstalledStickerSets -> ShowS)
-> (SearchInstalledStickerSets -> String)
-> ([SearchInstalledStickerSets] -> ShowS)
-> Show SearchInstalledStickerSets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SearchInstalledStickerSets -> ShowS
showsPrec :: Int -> SearchInstalledStickerSets -> ShowS
$cshow :: SearchInstalledStickerSets -> String
show :: SearchInstalledStickerSets -> String
$cshowList :: [SearchInstalledStickerSets] -> ShowS
showList :: [SearchInstalledStickerSets] -> ShowS
Show)

instance I.ShortShow SearchInstalledStickerSets where
  shortShow :: SearchInstalledStickerSets -> String
shortShow
    SearchInstalledStickerSets
      { sticker_type :: SearchInstalledStickerSets -> Maybe StickerType
sticker_type = Maybe StickerType
sticker_type_
      , query :: SearchInstalledStickerSets -> Maybe Text
query        = Maybe Text
query_
      , limit :: SearchInstalledStickerSets -> Maybe Int
limit        = Maybe Int
limit_
      }
        = String
"SearchInstalledStickerSets"
          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_
          ]

instance AT.ToJSON SearchInstalledStickerSets where
  toJSON :: SearchInstalledStickerSets -> Value
toJSON
    SearchInstalledStickerSets
      { sticker_type :: SearchInstalledStickerSets -> Maybe StickerType
sticker_type = Maybe StickerType
sticker_type_
      , query :: SearchInstalledStickerSets -> Maybe Text
query        = Maybe Text
query_
      , limit :: SearchInstalledStickerSets -> 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
"searchInstalledStickerSets"
          , 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_
          ]

defaultSearchInstalledStickerSets :: SearchInstalledStickerSets
defaultSearchInstalledStickerSets :: SearchInstalledStickerSets
defaultSearchInstalledStickerSets =
  SearchInstalledStickerSets
    { 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
    }