module TD.Query.RateSpeechRecognition
  (RateSpeechRecognition(..)
  , defaultRateSpeechRecognition
  ) where

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

-- | Rates recognized speech in a video note or a voice note message. Returns 'TD.Data.Ok.Ok'
data RateSpeechRecognition
  = RateSpeechRecognition
    { RateSpeechRecognition -> Maybe Int
chat_id    :: Maybe Int  -- ^ Identifier of the chat to which the message belongs
    , RateSpeechRecognition -> Maybe Int
message_id :: Maybe Int  -- ^ Identifier of the message
    , RateSpeechRecognition -> Maybe Bool
is_good    :: Maybe Bool -- ^ Pass true if the speech recognition is good
    }
  deriving (RateSpeechRecognition -> RateSpeechRecognition -> Bool
(RateSpeechRecognition -> RateSpeechRecognition -> Bool)
-> (RateSpeechRecognition -> RateSpeechRecognition -> Bool)
-> Eq RateSpeechRecognition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RateSpeechRecognition -> RateSpeechRecognition -> Bool
== :: RateSpeechRecognition -> RateSpeechRecognition -> Bool
$c/= :: RateSpeechRecognition -> RateSpeechRecognition -> Bool
/= :: RateSpeechRecognition -> RateSpeechRecognition -> Bool
Eq, Int -> RateSpeechRecognition -> ShowS
[RateSpeechRecognition] -> ShowS
RateSpeechRecognition -> String
(Int -> RateSpeechRecognition -> ShowS)
-> (RateSpeechRecognition -> String)
-> ([RateSpeechRecognition] -> ShowS)
-> Show RateSpeechRecognition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RateSpeechRecognition -> ShowS
showsPrec :: Int -> RateSpeechRecognition -> ShowS
$cshow :: RateSpeechRecognition -> String
show :: RateSpeechRecognition -> String
$cshowList :: [RateSpeechRecognition] -> ShowS
showList :: [RateSpeechRecognition] -> ShowS
Show)

instance I.ShortShow RateSpeechRecognition where
  shortShow :: RateSpeechRecognition -> String
shortShow
    RateSpeechRecognition
      { chat_id :: RateSpeechRecognition -> Maybe Int
chat_id    = Maybe Int
chat_id_
      , message_id :: RateSpeechRecognition -> Maybe Int
message_id = Maybe Int
message_id_
      , is_good :: RateSpeechRecognition -> Maybe Bool
is_good    = Maybe Bool
is_good_
      }
        = String
"RateSpeechRecognition"
          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_
          , String
"is_good"    String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_good_
          ]

instance AT.ToJSON RateSpeechRecognition where
  toJSON :: RateSpeechRecognition -> Value
toJSON
    RateSpeechRecognition
      { chat_id :: RateSpeechRecognition -> Maybe Int
chat_id    = Maybe Int
chat_id_
      , message_id :: RateSpeechRecognition -> Maybe Int
message_id = Maybe Int
message_id_
      , is_good :: RateSpeechRecognition -> Maybe Bool
is_good    = Maybe Bool
is_good_
      }
        = [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
"rateSpeechRecognition"
          , 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_
          , Key
"is_good"    Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_good_
          ]

defaultRateSpeechRecognition :: RateSpeechRecognition
defaultRateSpeechRecognition :: RateSpeechRecognition
defaultRateSpeechRecognition =
  RateSpeechRecognition
    { 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
    , is_good :: Maybe Bool
is_good    = Maybe Bool
forall a. Maybe a
Nothing
    }