{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.Poll where
import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Text (Text)
import Data.Time.Clock.POSIX (POSIXTime)
import GHC.Generics (Generic)
import Telegram.Bot.API.Types.Common
import Telegram.Bot.API.Types.MessageEntity
import Telegram.Bot.API.Types.PollOption
import Telegram.Bot.API.Types.PollType
import Telegram.Bot.API.Internal.Utils
data Poll = Poll
{ Poll -> PollId
pollId :: PollId
, Poll -> Text
pollQuestion :: Text
, Poll -> [PollOption]
pollOptions :: [PollOption]
, Poll -> Int
pollTotalVoterCount :: Int
, Poll -> Bool
pollIsClosed :: Bool
, Poll -> Bool
pollIsAnonymous :: Bool
, Poll -> PollType
pollType :: PollType
, Poll -> Bool
pollAllowsMultipleAnswers :: Bool
, Poll -> Maybe Int
pollCorrectOptionId :: Maybe Int
, Poll -> Maybe Text
pollExplanation :: Maybe Text
, Poll -> Maybe [MessageEntity]
pollExplanationEntities :: Maybe [MessageEntity]
, Poll -> Maybe Seconds
pollOpenPeriod :: Maybe Seconds
, Poll -> Maybe POSIXTime
pollCloseData :: Maybe POSIXTime
}
deriving (forall x. Rep Poll x -> Poll
forall x. Poll -> Rep Poll x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Poll x -> Poll
$cfrom :: forall x. Poll -> Rep Poll x
Generic, Int -> Poll -> ShowS
[Poll] -> ShowS
Poll -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Poll] -> ShowS
$cshowList :: [Poll] -> ShowS
show :: Poll -> String
$cshow :: Poll -> String
showsPrec :: Int -> Poll -> ShowS
$cshowsPrec :: Int -> Poll -> ShowS
Show)
instance ToJSON Poll where toJSON :: Poll -> Value
toJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON Poll where parseJSON :: Value -> Parser Poll
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON