module TD.Query.GetStoryAlbumStories
  (GetStoryAlbumStories(..)
  , defaultGetStoryAlbumStories
  ) where

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

-- | Returns the list of stories added to the given story album. For optimal performance, the number of returned stories is chosen by TDLib. Returns 'TD.Data.Stories.Stories'
data GetStoryAlbumStories
  = GetStoryAlbumStories
    { GetStoryAlbumStories -> Maybe Int
chat_id        :: Maybe Int -- ^ Chat identifier
    , GetStoryAlbumStories -> Maybe Int
story_album_id :: Maybe Int -- ^ Story album identifier
    , GetStoryAlbumStories -> Maybe Int
offset         :: Maybe Int -- ^ Offset of the first entry to return; use 0 to get results from the first album story
    , GetStoryAlbumStories -> Maybe Int
limit          :: Maybe Int -- ^ The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit
    }
  deriving (GetStoryAlbumStories -> GetStoryAlbumStories -> Bool
(GetStoryAlbumStories -> GetStoryAlbumStories -> Bool)
-> (GetStoryAlbumStories -> GetStoryAlbumStories -> Bool)
-> Eq GetStoryAlbumStories
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetStoryAlbumStories -> GetStoryAlbumStories -> Bool
== :: GetStoryAlbumStories -> GetStoryAlbumStories -> Bool
$c/= :: GetStoryAlbumStories -> GetStoryAlbumStories -> Bool
/= :: GetStoryAlbumStories -> GetStoryAlbumStories -> Bool
Eq, Int -> GetStoryAlbumStories -> ShowS
[GetStoryAlbumStories] -> ShowS
GetStoryAlbumStories -> String
(Int -> GetStoryAlbumStories -> ShowS)
-> (GetStoryAlbumStories -> String)
-> ([GetStoryAlbumStories] -> ShowS)
-> Show GetStoryAlbumStories
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetStoryAlbumStories -> ShowS
showsPrec :: Int -> GetStoryAlbumStories -> ShowS
$cshow :: GetStoryAlbumStories -> String
show :: GetStoryAlbumStories -> String
$cshowList :: [GetStoryAlbumStories] -> ShowS
showList :: [GetStoryAlbumStories] -> ShowS
Show)

instance I.ShortShow GetStoryAlbumStories where
  shortShow :: GetStoryAlbumStories -> String
shortShow
    GetStoryAlbumStories
      { chat_id :: GetStoryAlbumStories -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , story_album_id :: GetStoryAlbumStories -> Maybe Int
story_album_id = Maybe Int
story_album_id_
      , offset :: GetStoryAlbumStories -> Maybe Int
offset         = Maybe Int
offset_
      , limit :: GetStoryAlbumStories -> Maybe Int
limit          = Maybe Int
limit_
      }
        = String
"GetStoryAlbumStories"
          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
"offset"         String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
offset_
          , String
"limit"          String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
          ]

instance AT.ToJSON GetStoryAlbumStories where
  toJSON :: GetStoryAlbumStories -> Value
toJSON
    GetStoryAlbumStories
      { chat_id :: GetStoryAlbumStories -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , story_album_id :: GetStoryAlbumStories -> Maybe Int
story_album_id = Maybe Int
story_album_id_
      , offset :: GetStoryAlbumStories -> Maybe Int
offset         = Maybe Int
offset_
      , limit :: GetStoryAlbumStories -> Maybe Int
limit          = Maybe Int
limit_
      }
        = [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
"getStoryAlbumStories"
          , 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
"offset"         Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
offset_
          , Key
"limit"          Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
limit_
          ]

defaultGetStoryAlbumStories :: GetStoryAlbumStories
defaultGetStoryAlbumStories :: GetStoryAlbumStories
defaultGetStoryAlbumStories =
  GetStoryAlbumStories
    { 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
    , offset :: Maybe Int
offset         = Maybe Int
forall a. Maybe a
Nothing
    , limit :: Maybe Int
limit          = Maybe Int
forall a. Maybe a
Nothing
    }