module TD.Query.ComposeRichMessageWithAi
  (ComposeRichMessageWithAi(..)
  , defaultComposeRichMessageWithAi
  ) where

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

-- | Changes a rich message using an AI model. May return an error with a message "AICOMPOSE_FLOOD_PREMIUM" if Telegram Premium is required to send further requests. Returns 'TD.Data.RichMessage.RichMessage'
data ComposeRichMessageWithAi
  = ComposeRichMessageWithAi
    { ComposeRichMessageWithAi -> Maybe InputRichMessage
message                    :: Maybe InputRichMessage.InputRichMessage -- ^ The original message
    , ComposeRichMessageWithAi -> Maybe Text
translate_to_language_code :: Maybe T.Text                            -- ^ Pass a language code to which the text will be translated; pass an empty string if translation isn't needed. See translateText.to_language_code for the list of supported values
    , ComposeRichMessageWithAi -> Maybe Text
style_name                 :: Maybe T.Text                            -- ^ Name of the style of the resulted text; handle updateTextCompositionStyles to get the list of supported styles; pass an empty string to keep the current style of the text or if a custom prompt is used
    , ComposeRichMessageWithAi -> Maybe Text
custom_prompt              :: Maybe T.Text                            -- ^ Custom prompt that will be used instead of style_name; 0-getOption("text_composition_style_prompt_length_max") characters
    , ComposeRichMessageWithAi -> Maybe Bool
add_emojis                 :: Maybe Bool                              -- ^ Pass true to add emoji to the text
    }
  deriving (ComposeRichMessageWithAi -> ComposeRichMessageWithAi -> Bool
(ComposeRichMessageWithAi -> ComposeRichMessageWithAi -> Bool)
-> (ComposeRichMessageWithAi -> ComposeRichMessageWithAi -> Bool)
-> Eq ComposeRichMessageWithAi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ComposeRichMessageWithAi -> ComposeRichMessageWithAi -> Bool
== :: ComposeRichMessageWithAi -> ComposeRichMessageWithAi -> Bool
$c/= :: ComposeRichMessageWithAi -> ComposeRichMessageWithAi -> Bool
/= :: ComposeRichMessageWithAi -> ComposeRichMessageWithAi -> Bool
Eq, Int -> ComposeRichMessageWithAi -> ShowS
[ComposeRichMessageWithAi] -> ShowS
ComposeRichMessageWithAi -> String
(Int -> ComposeRichMessageWithAi -> ShowS)
-> (ComposeRichMessageWithAi -> String)
-> ([ComposeRichMessageWithAi] -> ShowS)
-> Show ComposeRichMessageWithAi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ComposeRichMessageWithAi -> ShowS
showsPrec :: Int -> ComposeRichMessageWithAi -> ShowS
$cshow :: ComposeRichMessageWithAi -> String
show :: ComposeRichMessageWithAi -> String
$cshowList :: [ComposeRichMessageWithAi] -> ShowS
showList :: [ComposeRichMessageWithAi] -> ShowS
Show)

instance I.ShortShow ComposeRichMessageWithAi where
  shortShow :: ComposeRichMessageWithAi -> String
shortShow
    ComposeRichMessageWithAi
      { message :: ComposeRichMessageWithAi -> Maybe InputRichMessage
message                    = Maybe InputRichMessage
message_
      , translate_to_language_code :: ComposeRichMessageWithAi -> Maybe Text
translate_to_language_code = Maybe Text
translate_to_language_code_
      , style_name :: ComposeRichMessageWithAi -> Maybe Text
style_name                 = Maybe Text
style_name_
      , custom_prompt :: ComposeRichMessageWithAi -> Maybe Text
custom_prompt              = Maybe Text
custom_prompt_
      , add_emojis :: ComposeRichMessageWithAi -> Maybe Bool
add_emojis                 = Maybe Bool
add_emojis_
      }
        = String
"ComposeRichMessageWithAi"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"message"                    String -> Maybe InputRichMessage -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputRichMessage
message_
          , String
"translate_to_language_code" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
translate_to_language_code_
          , String
"style_name"                 String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
style_name_
          , String
"custom_prompt"              String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
custom_prompt_
          , String
"add_emojis"                 String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
add_emojis_
          ]

instance AT.ToJSON ComposeRichMessageWithAi where
  toJSON :: ComposeRichMessageWithAi -> Value
toJSON
    ComposeRichMessageWithAi
      { message :: ComposeRichMessageWithAi -> Maybe InputRichMessage
message                    = Maybe InputRichMessage
message_
      , translate_to_language_code :: ComposeRichMessageWithAi -> Maybe Text
translate_to_language_code = Maybe Text
translate_to_language_code_
      , style_name :: ComposeRichMessageWithAi -> Maybe Text
style_name                 = Maybe Text
style_name_
      , custom_prompt :: ComposeRichMessageWithAi -> Maybe Text
custom_prompt              = Maybe Text
custom_prompt_
      , add_emojis :: ComposeRichMessageWithAi -> Maybe Bool
add_emojis                 = Maybe Bool
add_emojis_
      }
        = [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
"composeRichMessageWithAi"
          , Key
"message"                    Key -> Maybe InputRichMessage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputRichMessage
message_
          , Key
"translate_to_language_code" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
translate_to_language_code_
          , Key
"style_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
style_name_
          , Key
"custom_prompt"              Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
custom_prompt_
          , Key
"add_emojis"                 Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
add_emojis_
          ]

defaultComposeRichMessageWithAi :: ComposeRichMessageWithAi
defaultComposeRichMessageWithAi :: ComposeRichMessageWithAi
defaultComposeRichMessageWithAi =
  ComposeRichMessageWithAi
    { message :: Maybe InputRichMessage
message                    = Maybe InputRichMessage
forall a. Maybe a
Nothing
    , translate_to_language_code :: Maybe Text
translate_to_language_code = Maybe Text
forall a. Maybe a
Nothing
    , style_name :: Maybe Text
style_name                 = Maybe Text
forall a. Maybe a
Nothing
    , custom_prompt :: Maybe Text
custom_prompt              = Maybe Text
forall a. Maybe a
Nothing
    , add_emojis :: Maybe Bool
add_emojis                 = Maybe Bool
forall a. Maybe a
Nothing
    }