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

-- | Changes the list of keywords of a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user. Returns 'TD.Data.Ok.Ok'
data SetStickerKeywords
  = SetStickerKeywords
    { SetStickerKeywords -> Maybe InputFile
sticker  :: Maybe InputFile.InputFile -- ^ Sticker
    , SetStickerKeywords -> Maybe [Text]
keywords :: Maybe [T.Text]            -- ^ List of up to 20 keywords with total length up to 64 characters, which can be used to find the sticker
    }
  deriving (SetStickerKeywords -> SetStickerKeywords -> Bool
(SetStickerKeywords -> SetStickerKeywords -> Bool)
-> (SetStickerKeywords -> SetStickerKeywords -> Bool)
-> Eq SetStickerKeywords
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetStickerKeywords -> SetStickerKeywords -> Bool
== :: SetStickerKeywords -> SetStickerKeywords -> Bool
$c/= :: SetStickerKeywords -> SetStickerKeywords -> Bool
/= :: SetStickerKeywords -> SetStickerKeywords -> Bool
Eq, Int -> SetStickerKeywords -> ShowS
[SetStickerKeywords] -> ShowS
SetStickerKeywords -> String
(Int -> SetStickerKeywords -> ShowS)
-> (SetStickerKeywords -> String)
-> ([SetStickerKeywords] -> ShowS)
-> Show SetStickerKeywords
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetStickerKeywords -> ShowS
showsPrec :: Int -> SetStickerKeywords -> ShowS
$cshow :: SetStickerKeywords -> String
show :: SetStickerKeywords -> String
$cshowList :: [SetStickerKeywords] -> ShowS
showList :: [SetStickerKeywords] -> ShowS
Show)

instance I.ShortShow SetStickerKeywords where
  shortShow :: SetStickerKeywords -> String
shortShow
    SetStickerKeywords
      { sticker :: SetStickerKeywords -> Maybe InputFile
sticker  = Maybe InputFile
sticker_
      , keywords :: SetStickerKeywords -> Maybe [Text]
keywords = Maybe [Text]
keywords_
      }
        = String
"SetStickerKeywords"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"sticker"  String -> Maybe InputFile -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputFile
sticker_
          , String
"keywords" String -> Maybe [Text] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Text]
keywords_
          ]

instance AT.ToJSON SetStickerKeywords where
  toJSON :: SetStickerKeywords -> Value
toJSON
    SetStickerKeywords
      { sticker :: SetStickerKeywords -> Maybe InputFile
sticker  = Maybe InputFile
sticker_
      , keywords :: SetStickerKeywords -> Maybe [Text]
keywords = Maybe [Text]
keywords_
      }
        = [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
"setStickerKeywords"
          , Key
"sticker"  Key -> Maybe InputFile -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputFile
sticker_
          , Key
"keywords" Key -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [Text]
keywords_
          ]

defaultSetStickerKeywords :: SetStickerKeywords
defaultSetStickerKeywords :: SetStickerKeywords
defaultSetStickerKeywords =
  SetStickerKeywords
    { sticker :: Maybe InputFile
sticker  = Maybe InputFile
forall a. Maybe a
Nothing
    , keywords :: Maybe [Text]
keywords = Maybe [Text]
forall a. Maybe a
Nothing
    }