module TD.Query.RecognizeSpeech
  (RecognizeSpeech(..)
  , defaultRecognizeSpeech
  ) where

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

-- | Recognizes speech in a video note or a voice note message. Returns 'TD.Data.Ok.Ok'
data RecognizeSpeech
  = RecognizeSpeech
    { RecognizeSpeech -> Maybe Int
chat_id    :: Maybe Int -- ^ Identifier of the chat to which the message belongs
    , RecognizeSpeech -> Maybe Int
message_id :: Maybe Int -- ^ Identifier of the message. Use messageProperties.can_recognize_speech to check whether the message is suitable
    }
  deriving (RecognizeSpeech -> RecognizeSpeech -> Bool
(RecognizeSpeech -> RecognizeSpeech -> Bool)
-> (RecognizeSpeech -> RecognizeSpeech -> Bool)
-> Eq RecognizeSpeech
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RecognizeSpeech -> RecognizeSpeech -> Bool
== :: RecognizeSpeech -> RecognizeSpeech -> Bool
$c/= :: RecognizeSpeech -> RecognizeSpeech -> Bool
/= :: RecognizeSpeech -> RecognizeSpeech -> Bool
Eq, Int -> RecognizeSpeech -> ShowS
[RecognizeSpeech] -> ShowS
RecognizeSpeech -> String
(Int -> RecognizeSpeech -> ShowS)
-> (RecognizeSpeech -> String)
-> ([RecognizeSpeech] -> ShowS)
-> Show RecognizeSpeech
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RecognizeSpeech -> ShowS
showsPrec :: Int -> RecognizeSpeech -> ShowS
$cshow :: RecognizeSpeech -> String
show :: RecognizeSpeech -> String
$cshowList :: [RecognizeSpeech] -> ShowS
showList :: [RecognizeSpeech] -> ShowS
Show)

instance I.ShortShow RecognizeSpeech where
  shortShow :: RecognizeSpeech -> String
shortShow
    RecognizeSpeech
      { chat_id :: RecognizeSpeech -> Maybe Int
chat_id    = Maybe Int
chat_id_
      , message_id :: RecognizeSpeech -> Maybe Int
message_id = Maybe Int
message_id_
      }
        = String
"RecognizeSpeech"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_id"    String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          , String
"message_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
          ]

instance AT.ToJSON RecognizeSpeech where
  toJSON :: RecognizeSpeech -> Value
toJSON
    RecognizeSpeech
      { chat_id :: RecognizeSpeech -> Maybe Int
chat_id    = Maybe Int
chat_id_
      , message_id :: RecognizeSpeech -> Maybe Int
message_id = Maybe Int
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
"recognizeSpeech"
          , 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
"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
message_id_
          ]

defaultRecognizeSpeech :: RecognizeSpeech
defaultRecognizeSpeech :: RecognizeSpeech
defaultRecognizeSpeech =
  RecognizeSpeech
    { chat_id :: Maybe Int
chat_id    = Maybe Int
forall a. Maybe a
Nothing
    , message_id :: Maybe Int
message_id = Maybe Int
forall a. Maybe a
Nothing
    }