module TD.Query.AddFavoriteSticker
  (AddFavoriteSticker(..)
  ) 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

-- | Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set or in WEBP or WEBM format can be added to this list. Emoji stickers can't be added to favorite stickers. Returns 'TD.Data.Ok.Ok'
data AddFavoriteSticker
  = AddFavoriteSticker
    { AddFavoriteSticker -> Maybe InputFile
sticker :: Maybe InputFile.InputFile -- ^ Sticker file to add
    }
  deriving (AddFavoriteSticker -> AddFavoriteSticker -> Bool
(AddFavoriteSticker -> AddFavoriteSticker -> Bool)
-> (AddFavoriteSticker -> AddFavoriteSticker -> Bool)
-> Eq AddFavoriteSticker
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AddFavoriteSticker -> AddFavoriteSticker -> Bool
== :: AddFavoriteSticker -> AddFavoriteSticker -> Bool
$c/= :: AddFavoriteSticker -> AddFavoriteSticker -> Bool
/= :: AddFavoriteSticker -> AddFavoriteSticker -> Bool
Eq, Int -> AddFavoriteSticker -> ShowS
[AddFavoriteSticker] -> ShowS
AddFavoriteSticker -> String
(Int -> AddFavoriteSticker -> ShowS)
-> (AddFavoriteSticker -> String)
-> ([AddFavoriteSticker] -> ShowS)
-> Show AddFavoriteSticker
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AddFavoriteSticker -> ShowS
showsPrec :: Int -> AddFavoriteSticker -> ShowS
$cshow :: AddFavoriteSticker -> String
show :: AddFavoriteSticker -> String
$cshowList :: [AddFavoriteSticker] -> ShowS
showList :: [AddFavoriteSticker] -> ShowS
Show)

instance I.ShortShow AddFavoriteSticker where
  shortShow :: AddFavoriteSticker -> String
shortShow
    AddFavoriteSticker
      { sticker :: AddFavoriteSticker -> Maybe InputFile
sticker = Maybe InputFile
sticker_
      }
        = String
"AddFavoriteSticker"
          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_
          ]

instance AT.ToJSON AddFavoriteSticker where
  toJSON :: AddFavoriteSticker -> Value
toJSON
    AddFavoriteSticker
      { sticker :: AddFavoriteSticker -> Maybe InputFile
sticker = Maybe InputFile
sticker_
      }
        = [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
"addFavoriteSticker"
          , 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_
          ]