module TD.Query.SearchStickerSets
  (SearchStickerSets(..)
  , defaultSearchStickerSets
  ) 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 sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results. Returns 'TD.Data.StickerSets.StickerSets'
data SearchStickerSets
  = SearchStickerSets
    { SearchStickerSets -> Maybe StickerType
sticker_type :: Maybe StickerType.StickerType -- ^ Type of the sticker sets to return
    , SearchStickerSets -> Maybe Text
query        :: Maybe T.Text                  -- ^ Query to search for
    }
  deriving (SearchStickerSets -> SearchStickerSets -> Bool
(SearchStickerSets -> SearchStickerSets -> Bool)
-> (SearchStickerSets -> SearchStickerSets -> Bool)
-> Eq SearchStickerSets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SearchStickerSets -> SearchStickerSets -> Bool
== :: SearchStickerSets -> SearchStickerSets -> Bool
$c/= :: SearchStickerSets -> SearchStickerSets -> Bool
/= :: SearchStickerSets -> SearchStickerSets -> Bool
Eq, Int -> SearchStickerSets -> ShowS
[SearchStickerSets] -> ShowS
SearchStickerSets -> String
(Int -> SearchStickerSets -> ShowS)
-> (SearchStickerSets -> String)
-> ([SearchStickerSets] -> ShowS)
-> Show SearchStickerSets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SearchStickerSets -> ShowS
showsPrec :: Int -> SearchStickerSets -> ShowS
$cshow :: SearchStickerSets -> String
show :: SearchStickerSets -> String
$cshowList :: [SearchStickerSets] -> ShowS
showList :: [SearchStickerSets] -> ShowS
Show)

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

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

defaultSearchStickerSets :: SearchStickerSets
defaultSearchStickerSets :: SearchStickerSets
defaultSearchStickerSets =
  SearchStickerSets
    { sticker_type :: Maybe StickerType
sticker_type = Maybe StickerType
forall a. Maybe a
Nothing
    , query :: Maybe Text
query        = Maybe Text
forall a. Maybe a
Nothing
    }