module TD.Query.ReorderStoryAlbumStories
  (ReorderStoryAlbumStories(..)
  , defaultReorderStoryAlbumStories
  ) where

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

-- | Changes order of stories in an album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album. Returns 'TD.Data.StoryAlbum.StoryAlbum'
data ReorderStoryAlbumStories
  = ReorderStoryAlbumStories
    { ReorderStoryAlbumStories -> Maybe Int
chat_id        :: Maybe Int   -- ^ Identifier of the chat that owns the stories
    , ReorderStoryAlbumStories -> Maybe Int
story_album_id :: Maybe Int   -- ^ Identifier of the story album
    , ReorderStoryAlbumStories -> Maybe [Int]
story_ids      :: Maybe [Int] -- ^ Identifier of the stories to move to the beginning of the album. All other stories are placed in the current order after the specified stories
    }
  deriving (ReorderStoryAlbumStories -> ReorderStoryAlbumStories -> Bool
(ReorderStoryAlbumStories -> ReorderStoryAlbumStories -> Bool)
-> (ReorderStoryAlbumStories -> ReorderStoryAlbumStories -> Bool)
-> Eq ReorderStoryAlbumStories
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReorderStoryAlbumStories -> ReorderStoryAlbumStories -> Bool
== :: ReorderStoryAlbumStories -> ReorderStoryAlbumStories -> Bool
$c/= :: ReorderStoryAlbumStories -> ReorderStoryAlbumStories -> Bool
/= :: ReorderStoryAlbumStories -> ReorderStoryAlbumStories -> Bool
Eq, Int -> ReorderStoryAlbumStories -> ShowS
[ReorderStoryAlbumStories] -> ShowS
ReorderStoryAlbumStories -> String
(Int -> ReorderStoryAlbumStories -> ShowS)
-> (ReorderStoryAlbumStories -> String)
-> ([ReorderStoryAlbumStories] -> ShowS)
-> Show ReorderStoryAlbumStories
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReorderStoryAlbumStories -> ShowS
showsPrec :: Int -> ReorderStoryAlbumStories -> ShowS
$cshow :: ReorderStoryAlbumStories -> String
show :: ReorderStoryAlbumStories -> String
$cshowList :: [ReorderStoryAlbumStories] -> ShowS
showList :: [ReorderStoryAlbumStories] -> ShowS
Show)

instance I.ShortShow ReorderStoryAlbumStories where
  shortShow :: ReorderStoryAlbumStories -> String
shortShow
    ReorderStoryAlbumStories
      { chat_id :: ReorderStoryAlbumStories -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , story_album_id :: ReorderStoryAlbumStories -> Maybe Int
story_album_id = Maybe Int
story_album_id_
      , story_ids :: ReorderStoryAlbumStories -> Maybe [Int]
story_ids      = Maybe [Int]
story_ids_
      }
        = String
"ReorderStoryAlbumStories"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_id"        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          , String
"story_album_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
story_album_id_
          , String
"story_ids"      String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
story_ids_
          ]

instance AT.ToJSON ReorderStoryAlbumStories where
  toJSON :: ReorderStoryAlbumStories -> Value
toJSON
    ReorderStoryAlbumStories
      { chat_id :: ReorderStoryAlbumStories -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , story_album_id :: ReorderStoryAlbumStories -> Maybe Int
story_album_id = Maybe Int
story_album_id_
      , story_ids :: ReorderStoryAlbumStories -> Maybe [Int]
story_ids      = Maybe [Int]
story_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
"reorderStoryAlbumStories"
          , Key
"chat_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
chat_id_
          , Key
"story_album_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
story_album_id_
          , Key
"story_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]
story_ids_
          ]

defaultReorderStoryAlbumStories :: ReorderStoryAlbumStories
defaultReorderStoryAlbumStories :: ReorderStoryAlbumStories
defaultReorderStoryAlbumStories =
  ReorderStoryAlbumStories
    { chat_id :: Maybe Int
chat_id        = Maybe Int
forall a. Maybe a
Nothing
    , story_album_id :: Maybe Int
story_album_id = Maybe Int
forall a. Maybe a
Nothing
    , story_ids :: Maybe [Int]
story_ids      = Maybe [Int]
forall a. Maybe a
Nothing
    }