module TD.Query.SendBusinessMessageAlbum
  (SendBusinessMessageAlbum(..)
  , defaultSendBusinessMessageAlbum
  ) 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
import qualified TD.Data.InputMessageReplyTo as InputMessageReplyTo
import qualified TD.Data.InputMessageContent as InputMessageContent

-- | Sends 2-10 messages grouped together into an album on behalf of a business account; for bots only. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages. Returns 'TD.Data.BusinessMessages.BusinessMessages'
data SendBusinessMessageAlbum
  = SendBusinessMessageAlbum
    { SendBusinessMessageAlbum -> Maybe Text
business_connection_id :: Maybe T.Text                                    -- ^ Unique identifier of business connection on behalf of which to send the request
    , SendBusinessMessageAlbum -> Maybe Int
chat_id                :: Maybe Int                                       -- ^ Target chat
    , SendBusinessMessageAlbum -> Maybe InputMessageReplyTo
reply_to               :: Maybe InputMessageReplyTo.InputMessageReplyTo   -- ^ Information about the message to be replied; pass null if none
    , SendBusinessMessageAlbum -> Maybe Bool
disable_notification   :: Maybe Bool                                      -- ^ Pass true to disable notification for the message
    , SendBusinessMessageAlbum -> Maybe Bool
protect_content        :: Maybe Bool                                      -- ^ Pass true if the content of the message must be protected from forwarding and saving
    , SendBusinessMessageAlbum -> Maybe Int
effect_id              :: Maybe Int                                       -- ^ Identifier of the effect to apply to the message
    , SendBusinessMessageAlbum -> Maybe [InputMessageContent]
input_message_contents :: Maybe [InputMessageContent.InputMessageContent] -- ^ Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media
    }
  deriving (SendBusinessMessageAlbum -> SendBusinessMessageAlbum -> Bool
(SendBusinessMessageAlbum -> SendBusinessMessageAlbum -> Bool)
-> (SendBusinessMessageAlbum -> SendBusinessMessageAlbum -> Bool)
-> Eq SendBusinessMessageAlbum
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendBusinessMessageAlbum -> SendBusinessMessageAlbum -> Bool
== :: SendBusinessMessageAlbum -> SendBusinessMessageAlbum -> Bool
$c/= :: SendBusinessMessageAlbum -> SendBusinessMessageAlbum -> Bool
/= :: SendBusinessMessageAlbum -> SendBusinessMessageAlbum -> Bool
Eq, Int -> SendBusinessMessageAlbum -> ShowS
[SendBusinessMessageAlbum] -> ShowS
SendBusinessMessageAlbum -> String
(Int -> SendBusinessMessageAlbum -> ShowS)
-> (SendBusinessMessageAlbum -> String)
-> ([SendBusinessMessageAlbum] -> ShowS)
-> Show SendBusinessMessageAlbum
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendBusinessMessageAlbum -> ShowS
showsPrec :: Int -> SendBusinessMessageAlbum -> ShowS
$cshow :: SendBusinessMessageAlbum -> String
show :: SendBusinessMessageAlbum -> String
$cshowList :: [SendBusinessMessageAlbum] -> ShowS
showList :: [SendBusinessMessageAlbum] -> ShowS
Show)

instance I.ShortShow SendBusinessMessageAlbum where
  shortShow :: SendBusinessMessageAlbum -> String
shortShow
    SendBusinessMessageAlbum
      { business_connection_id :: SendBusinessMessageAlbum -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , chat_id :: SendBusinessMessageAlbum -> Maybe Int
chat_id                = Maybe Int
chat_id_
      , reply_to :: SendBusinessMessageAlbum -> Maybe InputMessageReplyTo
reply_to               = Maybe InputMessageReplyTo
reply_to_
      , disable_notification :: SendBusinessMessageAlbum -> Maybe Bool
disable_notification   = Maybe Bool
disable_notification_
      , protect_content :: SendBusinessMessageAlbum -> Maybe Bool
protect_content        = Maybe Bool
protect_content_
      , effect_id :: SendBusinessMessageAlbum -> Maybe Int
effect_id              = Maybe Int
effect_id_
      , input_message_contents :: SendBusinessMessageAlbum -> Maybe [InputMessageContent]
input_message_contents = Maybe [InputMessageContent]
input_message_contents_
      }
        = String
"SendBusinessMessageAlbum"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"business_connection_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
business_connection_id_
          , String
"chat_id"                String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          , String
"reply_to"               String -> Maybe InputMessageReplyTo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputMessageReplyTo
reply_to_
          , String
"disable_notification"   String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
disable_notification_
          , String
"protect_content"        String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
protect_content_
          , String
"effect_id"              String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
effect_id_
          , String
"input_message_contents" String -> Maybe [InputMessageContent] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [InputMessageContent]
input_message_contents_
          ]

instance AT.ToJSON SendBusinessMessageAlbum where
  toJSON :: SendBusinessMessageAlbum -> Value
toJSON
    SendBusinessMessageAlbum
      { business_connection_id :: SendBusinessMessageAlbum -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , chat_id :: SendBusinessMessageAlbum -> Maybe Int
chat_id                = Maybe Int
chat_id_
      , reply_to :: SendBusinessMessageAlbum -> Maybe InputMessageReplyTo
reply_to               = Maybe InputMessageReplyTo
reply_to_
      , disable_notification :: SendBusinessMessageAlbum -> Maybe Bool
disable_notification   = Maybe Bool
disable_notification_
      , protect_content :: SendBusinessMessageAlbum -> Maybe Bool
protect_content        = Maybe Bool
protect_content_
      , effect_id :: SendBusinessMessageAlbum -> Maybe Int
effect_id              = Maybe Int
effect_id_
      , input_message_contents :: SendBusinessMessageAlbum -> Maybe [InputMessageContent]
input_message_contents = Maybe [InputMessageContent]
input_message_contents_
      }
        = [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
"sendBusinessMessageAlbum"
          , Key
"business_connection_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
business_connection_id_
          , 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
"reply_to"               Key -> Maybe InputMessageReplyTo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputMessageReplyTo
reply_to_
          , Key
"disable_notification"   Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
disable_notification_
          , Key
"protect_content"        Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
protect_content_
          , Key
"effect_id"              Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64  Maybe Int
effect_id_
          , Key
"input_message_contents" Key -> Maybe [InputMessageContent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [InputMessageContent]
input_message_contents_
          ]

defaultSendBusinessMessageAlbum :: SendBusinessMessageAlbum
defaultSendBusinessMessageAlbum :: SendBusinessMessageAlbum
defaultSendBusinessMessageAlbum =
  SendBusinessMessageAlbum
    { business_connection_id :: Maybe Text
business_connection_id = Maybe Text
forall a. Maybe a
Nothing
    , chat_id :: Maybe Int
chat_id                = Maybe Int
forall a. Maybe a
Nothing
    , reply_to :: Maybe InputMessageReplyTo
reply_to               = Maybe InputMessageReplyTo
forall a. Maybe a
Nothing
    , disable_notification :: Maybe Bool
disable_notification   = Maybe Bool
forall a. Maybe a
Nothing
    , protect_content :: Maybe Bool
protect_content        = Maybe Bool
forall a. Maybe a
Nothing
    , effect_id :: Maybe Int
effect_id              = Maybe Int
forall a. Maybe a
Nothing
    , input_message_contents :: Maybe [InputMessageContent]
input_message_contents = Maybe [InputMessageContent]
forall a. Maybe a
Nothing
    }