module TD.Query.ReorderBotMediaPreviews
  (ReorderBotMediaPreviews(..)
  , defaultReorderBotMediaPreviews
  ) 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

-- | Changes order of media previews in the list of media previews of a bot. Returns 'TD.Data.Ok.Ok'
data ReorderBotMediaPreviews
  = ReorderBotMediaPreviews
    { ReorderBotMediaPreviews -> Maybe Int
bot_user_id   :: Maybe Int    -- ^ Identifier of the target bot. The bot must be owned and must have the main Web App
    , ReorderBotMediaPreviews -> Maybe Text
language_code :: Maybe T.Text -- ^ Language code of the media previews to reorder
    , ReorderBotMediaPreviews -> Maybe [Int]
file_ids      :: Maybe [Int]  -- ^ File identifiers of the media in the new order
    }
  deriving (ReorderBotMediaPreviews -> ReorderBotMediaPreviews -> Bool
(ReorderBotMediaPreviews -> ReorderBotMediaPreviews -> Bool)
-> (ReorderBotMediaPreviews -> ReorderBotMediaPreviews -> Bool)
-> Eq ReorderBotMediaPreviews
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReorderBotMediaPreviews -> ReorderBotMediaPreviews -> Bool
== :: ReorderBotMediaPreviews -> ReorderBotMediaPreviews -> Bool
$c/= :: ReorderBotMediaPreviews -> ReorderBotMediaPreviews -> Bool
/= :: ReorderBotMediaPreviews -> ReorderBotMediaPreviews -> Bool
Eq, Int -> ReorderBotMediaPreviews -> ShowS
[ReorderBotMediaPreviews] -> ShowS
ReorderBotMediaPreviews -> String
(Int -> ReorderBotMediaPreviews -> ShowS)
-> (ReorderBotMediaPreviews -> String)
-> ([ReorderBotMediaPreviews] -> ShowS)
-> Show ReorderBotMediaPreviews
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReorderBotMediaPreviews -> ShowS
showsPrec :: Int -> ReorderBotMediaPreviews -> ShowS
$cshow :: ReorderBotMediaPreviews -> String
show :: ReorderBotMediaPreviews -> String
$cshowList :: [ReorderBotMediaPreviews] -> ShowS
showList :: [ReorderBotMediaPreviews] -> ShowS
Show)

instance I.ShortShow ReorderBotMediaPreviews where
  shortShow :: ReorderBotMediaPreviews -> String
shortShow
    ReorderBotMediaPreviews
      { bot_user_id :: ReorderBotMediaPreviews -> Maybe Int
bot_user_id   = Maybe Int
bot_user_id_
      , language_code :: ReorderBotMediaPreviews -> Maybe Text
language_code = Maybe Text
language_code_
      , file_ids :: ReorderBotMediaPreviews -> Maybe [Int]
file_ids      = Maybe [Int]
file_ids_
      }
        = String
"ReorderBotMediaPreviews"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"bot_user_id"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
bot_user_id_
          , String
"language_code" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
language_code_
          , String
"file_ids"      String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
file_ids_
          ]

instance AT.ToJSON ReorderBotMediaPreviews where
  toJSON :: ReorderBotMediaPreviews -> Value
toJSON
    ReorderBotMediaPreviews
      { bot_user_id :: ReorderBotMediaPreviews -> Maybe Int
bot_user_id   = Maybe Int
bot_user_id_
      , language_code :: ReorderBotMediaPreviews -> Maybe Text
language_code = Maybe Text
language_code_
      , file_ids :: ReorderBotMediaPreviews -> Maybe [Int]
file_ids      = Maybe [Int]
file_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
"reorderBotMediaPreviews"
          , Key
"bot_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
bot_user_id_
          , Key
"language_code" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
language_code_
          , Key
"file_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]
file_ids_
          ]

defaultReorderBotMediaPreviews :: ReorderBotMediaPreviews
defaultReorderBotMediaPreviews :: ReorderBotMediaPreviews
defaultReorderBotMediaPreviews =
  ReorderBotMediaPreviews
    { bot_user_id :: Maybe Int
bot_user_id   = Maybe Int
forall a. Maybe a
Nothing
    , language_code :: Maybe Text
language_code = Maybe Text
forall a. Maybe a
Nothing
    , file_ids :: Maybe [Int]
file_ids      = Maybe [Int]
forall a. Maybe a
Nothing
    }