{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module Telegram.Bot.API.Types.PollType where
import Data.Aeson (Value(String), FromJSON (..), ToJSON (..))
import Data.Text (Text)
import GHC.Generics (Generic)
import Telegram.Bot.API.Internal.Utils
data PollType =
PollTypeQuiz | PollTypeRegular
deriving (forall x. Rep PollType x -> PollType
forall x. PollType -> Rep PollType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PollType x -> PollType
$cfrom :: forall x. PollType -> Rep PollType x
Generic, Int -> PollType -> ShowS
[PollType] -> ShowS
PollType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PollType] -> ShowS
$cshowList :: [PollType] -> ShowS
show :: PollType -> String
$cshow :: PollType -> String
showsPrec :: Int -> PollType -> ShowS
$cshowsPrec :: Int -> PollType -> ShowS
Show)
getPollType :: PollType -> Text
getPollType :: PollType -> Text
getPollType PollType
PollTypeQuiz = Text
"quiz"
getPollType PollType
PollTypeRegular = Text
"regular"
instance ToJSON PollType where
toJSON :: PollType -> Value
toJSON = Text -> Value
String forall b c a. (b -> c) -> (a -> b) -> a -> c
. PollType -> Text
getPollType
instance FromJSON PollType where parseJSON :: Value -> Parser PollType
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON