module TD.Query.SetStickerSetThumbnail
  (SetStickerSetThumbnail(..)
  , defaultSetStickerSetThumbnail
  ) 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
import qualified TD.Data.InputFile as InputFile
import qualified TD.Data.StickerFormat as StickerFormat

-- | Sets a sticker set thumbnail. Returns 'TD.Data.Ok.Ok'
data SetStickerSetThumbnail
  = SetStickerSetThumbnail
    { SetStickerSetThumbnail -> Maybe Int
user_id   :: Maybe Int                         -- ^ Sticker set owner; ignored for regular users
    , SetStickerSetThumbnail -> Maybe Text
name      :: Maybe T.Text                      -- ^ Sticker set name. The sticker set must be owned by the current user
    , SetStickerSetThumbnail -> Maybe InputFile
thumbnail :: Maybe InputFile.InputFile         -- ^ Thumbnail to set; pass null to remove the sticker set thumbnail
    , SetStickerSetThumbnail -> Maybe StickerFormat
format    :: Maybe StickerFormat.StickerFormat -- ^ Format of the thumbnail; pass null if thumbnail is removed
    }
  deriving (SetStickerSetThumbnail -> SetStickerSetThumbnail -> Bool
(SetStickerSetThumbnail -> SetStickerSetThumbnail -> Bool)
-> (SetStickerSetThumbnail -> SetStickerSetThumbnail -> Bool)
-> Eq SetStickerSetThumbnail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetStickerSetThumbnail -> SetStickerSetThumbnail -> Bool
== :: SetStickerSetThumbnail -> SetStickerSetThumbnail -> Bool
$c/= :: SetStickerSetThumbnail -> SetStickerSetThumbnail -> Bool
/= :: SetStickerSetThumbnail -> SetStickerSetThumbnail -> Bool
Eq, Int -> SetStickerSetThumbnail -> ShowS
[SetStickerSetThumbnail] -> ShowS
SetStickerSetThumbnail -> String
(Int -> SetStickerSetThumbnail -> ShowS)
-> (SetStickerSetThumbnail -> String)
-> ([SetStickerSetThumbnail] -> ShowS)
-> Show SetStickerSetThumbnail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetStickerSetThumbnail -> ShowS
showsPrec :: Int -> SetStickerSetThumbnail -> ShowS
$cshow :: SetStickerSetThumbnail -> String
show :: SetStickerSetThumbnail -> String
$cshowList :: [SetStickerSetThumbnail] -> ShowS
showList :: [SetStickerSetThumbnail] -> ShowS
Show)

instance I.ShortShow SetStickerSetThumbnail where
  shortShow :: SetStickerSetThumbnail -> String
shortShow
    SetStickerSetThumbnail
      { user_id :: SetStickerSetThumbnail -> Maybe Int
user_id   = Maybe Int
user_id_
      , name :: SetStickerSetThumbnail -> Maybe Text
name      = Maybe Text
name_
      , thumbnail :: SetStickerSetThumbnail -> Maybe InputFile
thumbnail = Maybe InputFile
thumbnail_
      , format :: SetStickerSetThumbnail -> Maybe StickerFormat
format    = Maybe StickerFormat
format_
      }
        = String
"SetStickerSetThumbnail"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"user_id"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
          , String
"name"      String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
name_
          , String
"thumbnail" String -> Maybe InputFile -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputFile
thumbnail_
          , String
"format"    String -> Maybe StickerFormat -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe StickerFormat
format_
          ]

instance AT.ToJSON SetStickerSetThumbnail where
  toJSON :: SetStickerSetThumbnail -> Value
toJSON
    SetStickerSetThumbnail
      { user_id :: SetStickerSetThumbnail -> Maybe Int
user_id   = Maybe Int
user_id_
      , name :: SetStickerSetThumbnail -> Maybe Text
name      = Maybe Text
name_
      , thumbnail :: SetStickerSetThumbnail -> Maybe InputFile
thumbnail = Maybe InputFile
thumbnail_
      , format :: SetStickerSetThumbnail -> Maybe StickerFormat
format    = Maybe StickerFormat
format_
      }
        = [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
"setStickerSetThumbnail"
          , Key
"user_id"   Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
user_id_
          , 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
"thumbnail" Key -> Maybe InputFile -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputFile
thumbnail_
          , Key
"format"    Key -> Maybe StickerFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe StickerFormat
format_
          ]

defaultSetStickerSetThumbnail :: SetStickerSetThumbnail
defaultSetStickerSetThumbnail :: SetStickerSetThumbnail
defaultSetStickerSetThumbnail =
  SetStickerSetThumbnail
    { user_id :: Maybe Int
user_id   = Maybe Int
forall a. Maybe a
Nothing
    , name :: Maybe Text
name      = Maybe Text
forall a. Maybe a
Nothing
    , thumbnail :: Maybe InputFile
thumbnail = Maybe InputFile
forall a. Maybe a
Nothing
    , format :: Maybe StickerFormat
format    = Maybe StickerFormat
forall a. Maybe a
Nothing
    }