module TD.Query.ReorderInstalledStickerSets
  (ReorderInstalledStickerSets(..)
  , defaultReorderInstalledStickerSets
  ) 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.StickerType as StickerType

-- | Changes the order of installed sticker sets. Returns 'TD.Data.Ok.Ok'
data ReorderInstalledStickerSets
  = ReorderInstalledStickerSets
    { ReorderInstalledStickerSets -> Maybe StickerType
sticker_type    :: Maybe StickerType.StickerType -- ^ Type of the sticker sets to reorder
    , ReorderInstalledStickerSets -> Maybe [Int]
sticker_set_ids :: Maybe [Int]                   -- ^ Identifiers of installed sticker sets in the new correct order
    }
  deriving (ReorderInstalledStickerSets -> ReorderInstalledStickerSets -> Bool
(ReorderInstalledStickerSets
 -> ReorderInstalledStickerSets -> Bool)
-> (ReorderInstalledStickerSets
    -> ReorderInstalledStickerSets -> Bool)
-> Eq ReorderInstalledStickerSets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReorderInstalledStickerSets -> ReorderInstalledStickerSets -> Bool
== :: ReorderInstalledStickerSets -> ReorderInstalledStickerSets -> Bool
$c/= :: ReorderInstalledStickerSets -> ReorderInstalledStickerSets -> Bool
/= :: ReorderInstalledStickerSets -> ReorderInstalledStickerSets -> Bool
Eq, Int -> ReorderInstalledStickerSets -> ShowS
[ReorderInstalledStickerSets] -> ShowS
ReorderInstalledStickerSets -> String
(Int -> ReorderInstalledStickerSets -> ShowS)
-> (ReorderInstalledStickerSets -> String)
-> ([ReorderInstalledStickerSets] -> ShowS)
-> Show ReorderInstalledStickerSets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReorderInstalledStickerSets -> ShowS
showsPrec :: Int -> ReorderInstalledStickerSets -> ShowS
$cshow :: ReorderInstalledStickerSets -> String
show :: ReorderInstalledStickerSets -> String
$cshowList :: [ReorderInstalledStickerSets] -> ShowS
showList :: [ReorderInstalledStickerSets] -> ShowS
Show)

instance I.ShortShow ReorderInstalledStickerSets where
  shortShow :: ReorderInstalledStickerSets -> String
shortShow
    ReorderInstalledStickerSets
      { sticker_type :: ReorderInstalledStickerSets -> Maybe StickerType
sticker_type    = Maybe StickerType
sticker_type_
      , sticker_set_ids :: ReorderInstalledStickerSets -> Maybe [Int]
sticker_set_ids = Maybe [Int]
sticker_set_ids_
      }
        = String
"ReorderInstalledStickerSets"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"sticker_type"    String -> Maybe StickerType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe StickerType
sticker_type_
          , String
"sticker_set_ids" String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
sticker_set_ids_
          ]

instance AT.ToJSON ReorderInstalledStickerSets where
  toJSON :: ReorderInstalledStickerSets -> Value
toJSON
    ReorderInstalledStickerSets
      { sticker_type :: ReorderInstalledStickerSets -> Maybe StickerType
sticker_type    = Maybe StickerType
sticker_type_
      , sticker_set_ids :: ReorderInstalledStickerSets -> Maybe [Int]
sticker_set_ids = Maybe [Int]
sticker_set_ids_
      }
        = [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
"reorderInstalledStickerSets"
          , Key
"sticker_type"    Key -> Maybe StickerType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe StickerType
sticker_type_
          , Key
"sticker_set_ids" 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) -> [Int] -> [Value]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64 ) Maybe [Int]
sticker_set_ids_
          ]

defaultReorderInstalledStickerSets :: ReorderInstalledStickerSets
defaultReorderInstalledStickerSets :: ReorderInstalledStickerSets
defaultReorderInstalledStickerSets =
  ReorderInstalledStickerSets
    { sticker_type :: Maybe StickerType
sticker_type    = Maybe StickerType
forall a. Maybe a
Nothing
    , sticker_set_ids :: Maybe [Int]
sticker_set_ids = Maybe [Int]
forall a. Maybe a
Nothing
    }