module TD.Query.SetCustomEmojiStickerSetThumbnail
  (SetCustomEmojiStickerSetThumbnail(..)
  , defaultSetCustomEmojiStickerSetThumbnail
  ) where

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

-- | Sets a custom emoji sticker set thumbnail. Returns 'TD.Data.Ok.Ok'
data SetCustomEmojiStickerSetThumbnail
  = SetCustomEmojiStickerSetThumbnail
    { SetCustomEmojiStickerSetThumbnail -> Maybe Text
name            :: Maybe T.Text -- ^ Sticker set name. The sticker set must be owned by the current user
    , SetCustomEmojiStickerSetThumbnail -> Maybe Int
custom_emoji_id :: Maybe Int    -- ^ Identifier of the custom emoji from the sticker set, which will be set as sticker set thumbnail; pass 0 to remove the sticker set thumbnail
    }
  deriving (SetCustomEmojiStickerSetThumbnail
-> SetCustomEmojiStickerSetThumbnail -> Bool
(SetCustomEmojiStickerSetThumbnail
 -> SetCustomEmojiStickerSetThumbnail -> Bool)
-> (SetCustomEmojiStickerSetThumbnail
    -> SetCustomEmojiStickerSetThumbnail -> Bool)
-> Eq SetCustomEmojiStickerSetThumbnail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetCustomEmojiStickerSetThumbnail
-> SetCustomEmojiStickerSetThumbnail -> Bool
== :: SetCustomEmojiStickerSetThumbnail
-> SetCustomEmojiStickerSetThumbnail -> Bool
$c/= :: SetCustomEmojiStickerSetThumbnail
-> SetCustomEmojiStickerSetThumbnail -> Bool
/= :: SetCustomEmojiStickerSetThumbnail
-> SetCustomEmojiStickerSetThumbnail -> Bool
Eq, Int -> SetCustomEmojiStickerSetThumbnail -> ShowS
[SetCustomEmojiStickerSetThumbnail] -> ShowS
SetCustomEmojiStickerSetThumbnail -> String
(Int -> SetCustomEmojiStickerSetThumbnail -> ShowS)
-> (SetCustomEmojiStickerSetThumbnail -> String)
-> ([SetCustomEmojiStickerSetThumbnail] -> ShowS)
-> Show SetCustomEmojiStickerSetThumbnail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetCustomEmojiStickerSetThumbnail -> ShowS
showsPrec :: Int -> SetCustomEmojiStickerSetThumbnail -> ShowS
$cshow :: SetCustomEmojiStickerSetThumbnail -> String
show :: SetCustomEmojiStickerSetThumbnail -> String
$cshowList :: [SetCustomEmojiStickerSetThumbnail] -> ShowS
showList :: [SetCustomEmojiStickerSetThumbnail] -> ShowS
Show)

instance I.ShortShow SetCustomEmojiStickerSetThumbnail where
  shortShow :: SetCustomEmojiStickerSetThumbnail -> String
shortShow
    SetCustomEmojiStickerSetThumbnail
      { name :: SetCustomEmojiStickerSetThumbnail -> Maybe Text
name            = Maybe Text
name_
      , custom_emoji_id :: SetCustomEmojiStickerSetThumbnail -> Maybe Int
custom_emoji_id = Maybe Int
custom_emoji_id_
      }
        = String
"SetCustomEmojiStickerSetThumbnail"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"name"            String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
name_
          , String
"custom_emoji_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
custom_emoji_id_
          ]

instance AT.ToJSON SetCustomEmojiStickerSetThumbnail where
  toJSON :: SetCustomEmojiStickerSetThumbnail -> Value
toJSON
    SetCustomEmojiStickerSetThumbnail
      { name :: SetCustomEmojiStickerSetThumbnail -> Maybe Text
name            = Maybe Text
name_
      , custom_emoji_id :: SetCustomEmojiStickerSetThumbnail -> Maybe Int
custom_emoji_id = Maybe Int
custom_emoji_id_
      }
        = [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
"setCustomEmojiStickerSetThumbnail"
          , Key
"name"            Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
name_
          , Key
"custom_emoji_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64  Maybe Int
custom_emoji_id_
          ]

defaultSetCustomEmojiStickerSetThumbnail :: SetCustomEmojiStickerSetThumbnail
defaultSetCustomEmojiStickerSetThumbnail :: SetCustomEmojiStickerSetThumbnail
defaultSetCustomEmojiStickerSetThumbnail =
  SetCustomEmojiStickerSetThumbnail
    { name :: Maybe Text
name            = Maybe Text
forall a. Maybe a
Nothing
    , custom_emoji_id :: Maybe Int
custom_emoji_id = Maybe Int
forall a. Maybe a
Nothing
    }