module TD.Query.GetRecentStickers
  (GetRecentStickers(..)
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I

-- | Returns a list of recently used stickers. Returns 'TD.Data.Stickers.Stickers'
data GetRecentStickers
  = GetRecentStickers
    { GetRecentStickers -> Maybe Bool
is_attached :: Maybe Bool -- ^ Pass true to return stickers and masks that were recently attached to photos or video files; pass false to return recently sent stickers
    }
  deriving (GetRecentStickers -> GetRecentStickers -> Bool
(GetRecentStickers -> GetRecentStickers -> Bool)
-> (GetRecentStickers -> GetRecentStickers -> Bool)
-> Eq GetRecentStickers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetRecentStickers -> GetRecentStickers -> Bool
== :: GetRecentStickers -> GetRecentStickers -> Bool
$c/= :: GetRecentStickers -> GetRecentStickers -> Bool
/= :: GetRecentStickers -> GetRecentStickers -> Bool
Eq, Int -> GetRecentStickers -> ShowS
[GetRecentStickers] -> ShowS
GetRecentStickers -> String
(Int -> GetRecentStickers -> ShowS)
-> (GetRecentStickers -> String)
-> ([GetRecentStickers] -> ShowS)
-> Show GetRecentStickers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetRecentStickers -> ShowS
showsPrec :: Int -> GetRecentStickers -> ShowS
$cshow :: GetRecentStickers -> String
show :: GetRecentStickers -> String
$cshowList :: [GetRecentStickers] -> ShowS
showList :: [GetRecentStickers] -> ShowS
Show)

instance I.ShortShow GetRecentStickers where
  shortShow :: GetRecentStickers -> String
shortShow
    GetRecentStickers
      { is_attached :: GetRecentStickers -> Maybe Bool
is_attached = Maybe Bool
is_attached_
      }
        = String
"GetRecentStickers"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"is_attached" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_attached_
          ]

instance AT.ToJSON GetRecentStickers where
  toJSON :: GetRecentStickers -> Value
toJSON
    GetRecentStickers
      { is_attached :: GetRecentStickers -> Maybe Bool
is_attached = Maybe Bool
is_attached_
      }
        = [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
"getRecentStickers"
          , Key
"is_attached" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_attached_
          ]