module TD.Query.AddStoryAlbumStories
  (AddStoryAlbumStories(..)
  , defaultAddStoryAlbumStories
  ) where

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

-- | Adds stories to the beginning of a previously created story 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 AddStoryAlbumStories
  = AddStoryAlbumStories
    { AddStoryAlbumStories -> Maybe Int
chat_id        :: Maybe Int   -- ^ Identifier of the chat that owns the stories
    , AddStoryAlbumStories -> Maybe Int
story_album_id :: Maybe Int   -- ^ Identifier of the story album
    , AddStoryAlbumStories -> Maybe [Int]
story_ids      :: Maybe [Int] -- ^ Identifier of the stories to add to the album; 1-getOption("story_album_story_count_max") identifiers. If after addition the album has more than getOption("story_album_story_count_max") stories, then the last one are removed from the album
    }
  deriving (AddStoryAlbumStories -> AddStoryAlbumStories -> Bool
(AddStoryAlbumStories -> AddStoryAlbumStories -> Bool)
-> (AddStoryAlbumStories -> AddStoryAlbumStories -> Bool)
-> Eq AddStoryAlbumStories
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AddStoryAlbumStories -> AddStoryAlbumStories -> Bool
== :: AddStoryAlbumStories -> AddStoryAlbumStories -> Bool
$c/= :: AddStoryAlbumStories -> AddStoryAlbumStories -> Bool
/= :: AddStoryAlbumStories -> AddStoryAlbumStories -> Bool
Eq, Int -> AddStoryAlbumStories -> ShowS
[AddStoryAlbumStories] -> ShowS
AddStoryAlbumStories -> String
(Int -> AddStoryAlbumStories -> ShowS)
-> (AddStoryAlbumStories -> String)
-> ([AddStoryAlbumStories] -> ShowS)
-> Show AddStoryAlbumStories
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AddStoryAlbumStories -> ShowS
showsPrec :: Int -> AddStoryAlbumStories -> ShowS
$cshow :: AddStoryAlbumStories -> String
show :: AddStoryAlbumStories -> String
$cshowList :: [AddStoryAlbumStories] -> ShowS
showList :: [AddStoryAlbumStories] -> ShowS
Show)

instance I.ShortShow AddStoryAlbumStories where
  shortShow :: AddStoryAlbumStories -> String
shortShow
    AddStoryAlbumStories
      { chat_id :: AddStoryAlbumStories -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , story_album_id :: AddStoryAlbumStories -> Maybe Int
story_album_id = Maybe Int
story_album_id_
      , story_ids :: AddStoryAlbumStories -> Maybe [Int]
story_ids      = Maybe [Int]
story_ids_
      }
        = String
"AddStoryAlbumStories"
          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 AddStoryAlbumStories where
  toJSON :: AddStoryAlbumStories -> Value
toJSON
    AddStoryAlbumStories
      { chat_id :: AddStoryAlbumStories -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , story_album_id :: AddStoryAlbumStories -> Maybe Int
story_album_id = Maybe Int
story_album_id_
      , story_ids :: AddStoryAlbumStories -> 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
"addStoryAlbumStories"
          , 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_
          ]

defaultAddStoryAlbumStories :: AddStoryAlbumStories
defaultAddStoryAlbumStories :: AddStoryAlbumStories
defaultAddStoryAlbumStories =
  AddStoryAlbumStories
    { 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
    }