module TD.Query.DeleteStoryAlbum
  (DeleteStoryAlbum(..)
  , defaultDeleteStoryAlbum
  ) where

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

-- | Deletes a 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 'TD.Data.Ok.Ok'
data DeleteStoryAlbum
  = DeleteStoryAlbum
    { DeleteStoryAlbum -> Maybe Int
chat_id        :: Maybe Int -- ^ Identifier of the chat that owns the stories
    , DeleteStoryAlbum -> Maybe Int
story_album_id :: Maybe Int -- ^ Identifier of the story album
    }
  deriving (DeleteStoryAlbum -> DeleteStoryAlbum -> Bool
(DeleteStoryAlbum -> DeleteStoryAlbum -> Bool)
-> (DeleteStoryAlbum -> DeleteStoryAlbum -> Bool)
-> Eq DeleteStoryAlbum
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DeleteStoryAlbum -> DeleteStoryAlbum -> Bool
== :: DeleteStoryAlbum -> DeleteStoryAlbum -> Bool
$c/= :: DeleteStoryAlbum -> DeleteStoryAlbum -> Bool
/= :: DeleteStoryAlbum -> DeleteStoryAlbum -> Bool
Eq, Int -> DeleteStoryAlbum -> ShowS
[DeleteStoryAlbum] -> ShowS
DeleteStoryAlbum -> String
(Int -> DeleteStoryAlbum -> ShowS)
-> (DeleteStoryAlbum -> String)
-> ([DeleteStoryAlbum] -> ShowS)
-> Show DeleteStoryAlbum
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteStoryAlbum -> ShowS
showsPrec :: Int -> DeleteStoryAlbum -> ShowS
$cshow :: DeleteStoryAlbum -> String
show :: DeleteStoryAlbum -> String
$cshowList :: [DeleteStoryAlbum] -> ShowS
showList :: [DeleteStoryAlbum] -> ShowS
Show)

instance I.ShortShow DeleteStoryAlbum where
  shortShow :: DeleteStoryAlbum -> String
shortShow
    DeleteStoryAlbum
      { chat_id :: DeleteStoryAlbum -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , story_album_id :: DeleteStoryAlbum -> Maybe Int
story_album_id = Maybe Int
story_album_id_
      }
        = String
"DeleteStoryAlbum"
          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_
          ]

instance AT.ToJSON DeleteStoryAlbum where
  toJSON :: DeleteStoryAlbum -> Value
toJSON
    DeleteStoryAlbum
      { chat_id :: DeleteStoryAlbum -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , story_album_id :: DeleteStoryAlbum -> Maybe Int
story_album_id = Maybe Int
story_album_id_
      }
        = [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
"deleteStoryAlbum"
          , 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_
          ]

defaultDeleteStoryAlbum :: DeleteStoryAlbum
defaultDeleteStoryAlbum :: DeleteStoryAlbum
defaultDeleteStoryAlbum =
  DeleteStoryAlbum
    { 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
    }