module TD.Query.AddQuickReplyShortcutMessage
  (AddQuickReplyShortcutMessage(..)
  , defaultAddQuickReplyShortcutMessage
  ) 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.InputMessageContent as InputMessageContent

-- | Adds a message to a quick reply shortcut. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. The shortcut must not contain more than getOption("quick_reply_shortcut_message_count_max") messages after adding the new message. Returns the added message. Returns 'TD.Data.QuickReplyMessage.QuickReplyMessage'
data AddQuickReplyShortcutMessage
  = AddQuickReplyShortcutMessage
    { AddQuickReplyShortcutMessage -> Maybe Text
shortcut_name         :: Maybe T.Text                                  -- ^ Name of the target shortcut
    , AddQuickReplyShortcutMessage -> Maybe Int
reply_to_message_id   :: Maybe Int                                     -- ^ Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none
    , AddQuickReplyShortcutMessage -> Maybe InputMessageContent
input_message_content :: Maybe InputMessageContent.InputMessageContent -- ^ The content of the message to be added; inputMessagePoll, inputMessageForwarded and inputMessageLocation with live_period aren't supported
    }
  deriving (AddQuickReplyShortcutMessage
-> AddQuickReplyShortcutMessage -> Bool
(AddQuickReplyShortcutMessage
 -> AddQuickReplyShortcutMessage -> Bool)
-> (AddQuickReplyShortcutMessage
    -> AddQuickReplyShortcutMessage -> Bool)
-> Eq AddQuickReplyShortcutMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AddQuickReplyShortcutMessage
-> AddQuickReplyShortcutMessage -> Bool
== :: AddQuickReplyShortcutMessage
-> AddQuickReplyShortcutMessage -> Bool
$c/= :: AddQuickReplyShortcutMessage
-> AddQuickReplyShortcutMessage -> Bool
/= :: AddQuickReplyShortcutMessage
-> AddQuickReplyShortcutMessage -> Bool
Eq, Int -> AddQuickReplyShortcutMessage -> ShowS
[AddQuickReplyShortcutMessage] -> ShowS
AddQuickReplyShortcutMessage -> String
(Int -> AddQuickReplyShortcutMessage -> ShowS)
-> (AddQuickReplyShortcutMessage -> String)
-> ([AddQuickReplyShortcutMessage] -> ShowS)
-> Show AddQuickReplyShortcutMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AddQuickReplyShortcutMessage -> ShowS
showsPrec :: Int -> AddQuickReplyShortcutMessage -> ShowS
$cshow :: AddQuickReplyShortcutMessage -> String
show :: AddQuickReplyShortcutMessage -> String
$cshowList :: [AddQuickReplyShortcutMessage] -> ShowS
showList :: [AddQuickReplyShortcutMessage] -> ShowS
Show)

instance I.ShortShow AddQuickReplyShortcutMessage where
  shortShow :: AddQuickReplyShortcutMessage -> String
shortShow
    AddQuickReplyShortcutMessage
      { shortcut_name :: AddQuickReplyShortcutMessage -> Maybe Text
shortcut_name         = Maybe Text
shortcut_name_
      , reply_to_message_id :: AddQuickReplyShortcutMessage -> Maybe Int
reply_to_message_id   = Maybe Int
reply_to_message_id_
      , input_message_content :: AddQuickReplyShortcutMessage -> Maybe InputMessageContent
input_message_content = Maybe InputMessageContent
input_message_content_
      }
        = String
"AddQuickReplyShortcutMessage"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"shortcut_name"         String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
shortcut_name_
          , String
"reply_to_message_id"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
reply_to_message_id_
          , String
"input_message_content" String -> Maybe InputMessageContent -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputMessageContent
input_message_content_
          ]

instance AT.ToJSON AddQuickReplyShortcutMessage where
  toJSON :: AddQuickReplyShortcutMessage -> Value
toJSON
    AddQuickReplyShortcutMessage
      { shortcut_name :: AddQuickReplyShortcutMessage -> Maybe Text
shortcut_name         = Maybe Text
shortcut_name_
      , reply_to_message_id :: AddQuickReplyShortcutMessage -> Maybe Int
reply_to_message_id   = Maybe Int
reply_to_message_id_
      , input_message_content :: AddQuickReplyShortcutMessage -> Maybe InputMessageContent
input_message_content = Maybe InputMessageContent
input_message_content_
      }
        = [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
"addQuickReplyShortcutMessage"
          , Key
"shortcut_name"         Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
shortcut_name_
          , Key
"reply_to_message_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
reply_to_message_id_
          , Key
"input_message_content" 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_content_
          ]

defaultAddQuickReplyShortcutMessage :: AddQuickReplyShortcutMessage
defaultAddQuickReplyShortcutMessage :: AddQuickReplyShortcutMessage
defaultAddQuickReplyShortcutMessage =
  AddQuickReplyShortcutMessage
    { shortcut_name :: Maybe Text
shortcut_name         = Maybe Text
forall a. Maybe a
Nothing
    , reply_to_message_id :: Maybe Int
reply_to_message_id   = Maybe Int
forall a. Maybe a
Nothing
    , input_message_content :: Maybe InputMessageContent
input_message_content = Maybe InputMessageContent
forall a. Maybe a
Nothing
    }