{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.Voice where

import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Text (Text)
import GHC.Generics (Generic)

import Telegram.Bot.API.Types.Common 
import Telegram.Bot.API.Internal.Utils

-- ** 'Voice'

-- | This object represents a voice note.
data Voice = Voice
  { Voice -> FileId
voiceFileId   :: FileId -- ^ Unique identifier for this file.
  , Voice -> FileId
voiceFileUniqueId :: FileId -- ^ Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
  , Voice -> Seconds
voiceDuration :: Seconds -- ^ Duration of the audio in seconds as defined by sender.
  , Voice -> Maybe Text
voiceMimeType :: Maybe Text -- ^ MIME type of the file as defined by sender.
  , Voice -> Maybe Integer
voiceFileSize :: Maybe Integer -- ^ File size in bytes.
  }
  deriving ((forall x. Voice -> Rep Voice x)
-> (forall x. Rep Voice x -> Voice) -> Generic Voice
forall x. Rep Voice x -> Voice
forall x. Voice -> Rep Voice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Voice -> Rep Voice x
from :: forall x. Voice -> Rep Voice x
$cto :: forall x. Rep Voice x -> Voice
to :: forall x. Rep Voice x -> Voice
Generic, Int -> Voice -> ShowS
[Voice] -> ShowS
Voice -> String
(Int -> Voice -> ShowS)
-> (Voice -> String) -> ([Voice] -> ShowS) -> Show Voice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Voice -> ShowS
showsPrec :: Int -> Voice -> ShowS
$cshow :: Voice -> String
show :: Voice -> String
$cshowList :: [Voice] -> ShowS
showList :: [Voice] -> ShowS
Show)

instance ToJSON   Voice where toJSON :: Voice -> Value
toJSON = Voice -> Value
forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON Voice where parseJSON :: Value -> Parser Voice
parseJSON = Value -> Parser Voice
forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON