module TD.Query.SetStickerPositionInSet
  (SetStickerPositionInSet(..)
  , defaultSetStickerPositionInSet
  ) 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

-- | Changes the position of a sticker in the set to which it belongs. The sticker set must be owned by the current user. Returns 'TD.Data.Ok.Ok'
data SetStickerPositionInSet
  = SetStickerPositionInSet
    { SetStickerPositionInSet -> Maybe InputFile
sticker  :: Maybe InputFile.InputFile -- ^ Sticker
    , SetStickerPositionInSet -> Maybe Int
position :: Maybe Int                 -- ^ New position of the sticker in the set, 0-based
    }
  deriving (SetStickerPositionInSet -> SetStickerPositionInSet -> Bool
(SetStickerPositionInSet -> SetStickerPositionInSet -> Bool)
-> (SetStickerPositionInSet -> SetStickerPositionInSet -> Bool)
-> Eq SetStickerPositionInSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetStickerPositionInSet -> SetStickerPositionInSet -> Bool
== :: SetStickerPositionInSet -> SetStickerPositionInSet -> Bool
$c/= :: SetStickerPositionInSet -> SetStickerPositionInSet -> Bool
/= :: SetStickerPositionInSet -> SetStickerPositionInSet -> Bool
Eq, Int -> SetStickerPositionInSet -> ShowS
[SetStickerPositionInSet] -> ShowS
SetStickerPositionInSet -> String
(Int -> SetStickerPositionInSet -> ShowS)
-> (SetStickerPositionInSet -> String)
-> ([SetStickerPositionInSet] -> ShowS)
-> Show SetStickerPositionInSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetStickerPositionInSet -> ShowS
showsPrec :: Int -> SetStickerPositionInSet -> ShowS
$cshow :: SetStickerPositionInSet -> String
show :: SetStickerPositionInSet -> String
$cshowList :: [SetStickerPositionInSet] -> ShowS
showList :: [SetStickerPositionInSet] -> ShowS
Show)

instance I.ShortShow SetStickerPositionInSet where
  shortShow :: SetStickerPositionInSet -> String
shortShow
    SetStickerPositionInSet
      { sticker :: SetStickerPositionInSet -> Maybe InputFile
sticker  = Maybe InputFile
sticker_
      , position :: SetStickerPositionInSet -> Maybe Int
position = Maybe Int
position_
      }
        = String
"SetStickerPositionInSet"
          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
"position" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
position_
          ]

instance AT.ToJSON SetStickerPositionInSet where
  toJSON :: SetStickerPositionInSet -> Value
toJSON
    SetStickerPositionInSet
      { sticker :: SetStickerPositionInSet -> Maybe InputFile
sticker  = Maybe InputFile
sticker_
      , position :: SetStickerPositionInSet -> Maybe Int
position = Maybe Int
position_
      }
        = [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
"setStickerPositionInSet"
          , 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
"position" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
position_
          ]

defaultSetStickerPositionInSet :: SetStickerPositionInSet
defaultSetStickerPositionInSet :: SetStickerPositionInSet
defaultSetStickerPositionInSet =
  SetStickerPositionInSet
    { sticker :: Maybe InputFile
sticker  = Maybe InputFile
forall a. Maybe a
Nothing
    , position :: Maybe Int
position = Maybe Int
forall a. Maybe a
Nothing
    }