module TD.Query.ReorderQuickReplyShortcuts
  (ReorderQuickReplyShortcuts(..)
  ) where

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

-- | Changes the order of quick reply shortcuts. Returns 'TD.Data.Ok.Ok'
data ReorderQuickReplyShortcuts
  = ReorderQuickReplyShortcuts
    { ReorderQuickReplyShortcuts -> Maybe [Int]
shortcut_ids :: Maybe [Int] -- ^ The new order of quick reply shortcuts
    }
  deriving (ReorderQuickReplyShortcuts -> ReorderQuickReplyShortcuts -> Bool
(ReorderQuickReplyShortcuts -> ReorderQuickReplyShortcuts -> Bool)
-> (ReorderQuickReplyShortcuts
    -> ReorderQuickReplyShortcuts -> Bool)
-> Eq ReorderQuickReplyShortcuts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReorderQuickReplyShortcuts -> ReorderQuickReplyShortcuts -> Bool
== :: ReorderQuickReplyShortcuts -> ReorderQuickReplyShortcuts -> Bool
$c/= :: ReorderQuickReplyShortcuts -> ReorderQuickReplyShortcuts -> Bool
/= :: ReorderQuickReplyShortcuts -> ReorderQuickReplyShortcuts -> Bool
Eq, Int -> ReorderQuickReplyShortcuts -> ShowS
[ReorderQuickReplyShortcuts] -> ShowS
ReorderQuickReplyShortcuts -> String
(Int -> ReorderQuickReplyShortcuts -> ShowS)
-> (ReorderQuickReplyShortcuts -> String)
-> ([ReorderQuickReplyShortcuts] -> ShowS)
-> Show ReorderQuickReplyShortcuts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReorderQuickReplyShortcuts -> ShowS
showsPrec :: Int -> ReorderQuickReplyShortcuts -> ShowS
$cshow :: ReorderQuickReplyShortcuts -> String
show :: ReorderQuickReplyShortcuts -> String
$cshowList :: [ReorderQuickReplyShortcuts] -> ShowS
showList :: [ReorderQuickReplyShortcuts] -> ShowS
Show)

instance I.ShortShow ReorderQuickReplyShortcuts where
  shortShow :: ReorderQuickReplyShortcuts -> String
shortShow
    ReorderQuickReplyShortcuts
      { shortcut_ids :: ReorderQuickReplyShortcuts -> Maybe [Int]
shortcut_ids = Maybe [Int]
shortcut_ids_
      }
        = String
"ReorderQuickReplyShortcuts"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"shortcut_ids" String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
shortcut_ids_
          ]

instance AT.ToJSON ReorderQuickReplyShortcuts where
  toJSON :: ReorderQuickReplyShortcuts -> Value
toJSON
    ReorderQuickReplyShortcuts
      { shortcut_ids :: ReorderQuickReplyShortcuts -> Maybe [Int]
shortcut_ids = Maybe [Int]
shortcut_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
"reorderQuickReplyShortcuts"
          , Key
"shortcut_ids" Key -> Maybe [Int] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [Int]
shortcut_ids_
          ]