module TD.Query.GetPreparedInlineMessage
  (GetPreparedInlineMessage(..)
  , defaultGetPreparedInlineMessage
  ) 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

-- | Saves an inline message to be sent by the given user. Returns 'TD.Data.PreparedInlineMessage.PreparedInlineMessage'
data GetPreparedInlineMessage
  = GetPreparedInlineMessage
    { GetPreparedInlineMessage -> Maybe Int
bot_user_id         :: Maybe Int    -- ^ Identifier of the bot that created the message
    , GetPreparedInlineMessage -> Maybe Text
prepared_message_id :: Maybe T.Text -- ^ Identifier of the prepared message
    }
  deriving (GetPreparedInlineMessage -> GetPreparedInlineMessage -> Bool
(GetPreparedInlineMessage -> GetPreparedInlineMessage -> Bool)
-> (GetPreparedInlineMessage -> GetPreparedInlineMessage -> Bool)
-> Eq GetPreparedInlineMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetPreparedInlineMessage -> GetPreparedInlineMessage -> Bool
== :: GetPreparedInlineMessage -> GetPreparedInlineMessage -> Bool
$c/= :: GetPreparedInlineMessage -> GetPreparedInlineMessage -> Bool
/= :: GetPreparedInlineMessage -> GetPreparedInlineMessage -> Bool
Eq, Int -> GetPreparedInlineMessage -> ShowS
[GetPreparedInlineMessage] -> ShowS
GetPreparedInlineMessage -> String
(Int -> GetPreparedInlineMessage -> ShowS)
-> (GetPreparedInlineMessage -> String)
-> ([GetPreparedInlineMessage] -> ShowS)
-> Show GetPreparedInlineMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetPreparedInlineMessage -> ShowS
showsPrec :: Int -> GetPreparedInlineMessage -> ShowS
$cshow :: GetPreparedInlineMessage -> String
show :: GetPreparedInlineMessage -> String
$cshowList :: [GetPreparedInlineMessage] -> ShowS
showList :: [GetPreparedInlineMessage] -> ShowS
Show)

instance I.ShortShow GetPreparedInlineMessage where
  shortShow :: GetPreparedInlineMessage -> String
shortShow
    GetPreparedInlineMessage
      { bot_user_id :: GetPreparedInlineMessage -> Maybe Int
bot_user_id         = Maybe Int
bot_user_id_
      , prepared_message_id :: GetPreparedInlineMessage -> Maybe Text
prepared_message_id = Maybe Text
prepared_message_id_
      }
        = String
"GetPreparedInlineMessage"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"bot_user_id"         String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
bot_user_id_
          , String
"prepared_message_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
prepared_message_id_
          ]

instance AT.ToJSON GetPreparedInlineMessage where
  toJSON :: GetPreparedInlineMessage -> Value
toJSON
    GetPreparedInlineMessage
      { bot_user_id :: GetPreparedInlineMessage -> Maybe Int
bot_user_id         = Maybe Int
bot_user_id_
      , prepared_message_id :: GetPreparedInlineMessage -> Maybe Text
prepared_message_id = Maybe Text
prepared_message_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
"getPreparedInlineMessage"
          , Key
"bot_user_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
bot_user_id_
          , Key
"prepared_message_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
prepared_message_id_
          ]

defaultGetPreparedInlineMessage :: GetPreparedInlineMessage
defaultGetPreparedInlineMessage :: GetPreparedInlineMessage
defaultGetPreparedInlineMessage =
  GetPreparedInlineMessage
    { bot_user_id :: Maybe Int
bot_user_id         = Maybe Int
forall a. Maybe a
Nothing
    , prepared_message_id :: Maybe Text
prepared_message_id = Maybe Text
forall a. Maybe a
Nothing
    }