module TD.Query.GetSpeechRecognitionLanguages
  (GetSpeechRecognitionLanguages(..)
  ) where

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

-- | Returns 1-3 most probable languages of speech in voice notes. Returns 'TD.Data.SpeechRecognitionLanguages.SpeechRecognitionLanguages'
data GetSpeechRecognitionLanguages
  = GetSpeechRecognitionLanguages
    { GetSpeechRecognitionLanguages -> Maybe Int
chat_id :: Maybe Int -- ^ Identifier of the chat; pass 0 if none
    }
  deriving (GetSpeechRecognitionLanguages
-> GetSpeechRecognitionLanguages -> Bool
(GetSpeechRecognitionLanguages
 -> GetSpeechRecognitionLanguages -> Bool)
-> (GetSpeechRecognitionLanguages
    -> GetSpeechRecognitionLanguages -> Bool)
-> Eq GetSpeechRecognitionLanguages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetSpeechRecognitionLanguages
-> GetSpeechRecognitionLanguages -> Bool
== :: GetSpeechRecognitionLanguages
-> GetSpeechRecognitionLanguages -> Bool
$c/= :: GetSpeechRecognitionLanguages
-> GetSpeechRecognitionLanguages -> Bool
/= :: GetSpeechRecognitionLanguages
-> GetSpeechRecognitionLanguages -> Bool
Eq, Int -> GetSpeechRecognitionLanguages -> ShowS
[GetSpeechRecognitionLanguages] -> ShowS
GetSpeechRecognitionLanguages -> String
(Int -> GetSpeechRecognitionLanguages -> ShowS)
-> (GetSpeechRecognitionLanguages -> String)
-> ([GetSpeechRecognitionLanguages] -> ShowS)
-> Show GetSpeechRecognitionLanguages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetSpeechRecognitionLanguages -> ShowS
showsPrec :: Int -> GetSpeechRecognitionLanguages -> ShowS
$cshow :: GetSpeechRecognitionLanguages -> String
show :: GetSpeechRecognitionLanguages -> String
$cshowList :: [GetSpeechRecognitionLanguages] -> ShowS
showList :: [GetSpeechRecognitionLanguages] -> ShowS
Show)

instance I.ShortShow GetSpeechRecognitionLanguages where
  shortShow :: GetSpeechRecognitionLanguages -> String
shortShow
    GetSpeechRecognitionLanguages
      { chat_id :: GetSpeechRecognitionLanguages -> Maybe Int
chat_id = Maybe Int
chat_id_
      }
        = String
"GetSpeechRecognitionLanguages"
          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_
          ]

instance AT.ToJSON GetSpeechRecognitionLanguages where
  toJSON :: GetSpeechRecognitionLanguages -> Value
toJSON
    GetSpeechRecognitionLanguages
      { chat_id :: GetSpeechRecognitionLanguages -> Maybe Int
chat_id = Maybe Int
chat_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
"getSpeechRecognitionLanguages"
          , 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_
          ]