module TD.Query.FixRecognizedTextWithAi
  (FixRecognizedTextWithAi(..)
  ) 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.FormattedText as FormattedText

-- | Fixes text received as a result of speech recognition using an AI model by correcting recognition errors and adding punctuation; must not be used in secret chats. May return an error with a message "AICOMPOSE_FLOOD_PREMIUM" if Telegram Premium is required to send further requests. Returns 'TD.Data.FormattedText.FormattedText'
data FixRecognizedTextWithAi
  = FixRecognizedTextWithAi
    { FixRecognizedTextWithAi -> Maybe FormattedText
text :: Maybe FormattedText.FormattedText -- ^ The recognized text
    }
  deriving (FixRecognizedTextWithAi -> FixRecognizedTextWithAi -> Bool
(FixRecognizedTextWithAi -> FixRecognizedTextWithAi -> Bool)
-> (FixRecognizedTextWithAi -> FixRecognizedTextWithAi -> Bool)
-> Eq FixRecognizedTextWithAi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FixRecognizedTextWithAi -> FixRecognizedTextWithAi -> Bool
== :: FixRecognizedTextWithAi -> FixRecognizedTextWithAi -> Bool
$c/= :: FixRecognizedTextWithAi -> FixRecognizedTextWithAi -> Bool
/= :: FixRecognizedTextWithAi -> FixRecognizedTextWithAi -> Bool
Eq, Int -> FixRecognizedTextWithAi -> ShowS
[FixRecognizedTextWithAi] -> ShowS
FixRecognizedTextWithAi -> String
(Int -> FixRecognizedTextWithAi -> ShowS)
-> (FixRecognizedTextWithAi -> String)
-> ([FixRecognizedTextWithAi] -> ShowS)
-> Show FixRecognizedTextWithAi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FixRecognizedTextWithAi -> ShowS
showsPrec :: Int -> FixRecognizedTextWithAi -> ShowS
$cshow :: FixRecognizedTextWithAi -> String
show :: FixRecognizedTextWithAi -> String
$cshowList :: [FixRecognizedTextWithAi] -> ShowS
showList :: [FixRecognizedTextWithAi] -> ShowS
Show)

instance I.ShortShow FixRecognizedTextWithAi where
  shortShow :: FixRecognizedTextWithAi -> String
shortShow
    FixRecognizedTextWithAi
      { text :: FixRecognizedTextWithAi -> Maybe FormattedText
text = Maybe FormattedText
text_
      }
        = String
"FixRecognizedTextWithAi"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"text" String -> Maybe FormattedText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FormattedText
text_
          ]

instance AT.ToJSON FixRecognizedTextWithAi where
  toJSON :: FixRecognizedTextWithAi -> Value
toJSON
    FixRecognizedTextWithAi
      { text :: FixRecognizedTextWithAi -> Maybe FormattedText
text = Maybe FormattedText
text_
      }
        = [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
"fixRecognizedTextWithAi"
          , Key
"text"  Key -> Maybe FormattedText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe FormattedText
text_
          ]