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

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

import Telegram.Bot.API.Internal.Utils

-- ** 'PollOption'

-- | This object contains information about one answer option in a poll.
data PollOption = PollOption
  { PollOption -> Text
pollOptionText       :: Text -- ^ Option text, 1-100 characters.
  , PollOption -> Int
pollOptionVoterCount :: Int  -- ^ Number of users that voted for this option.
  }
  deriving ((forall x. PollOption -> Rep PollOption x)
-> (forall x. Rep PollOption x -> PollOption) -> Generic PollOption
forall x. Rep PollOption x -> PollOption
forall x. PollOption -> Rep PollOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PollOption -> Rep PollOption x
from :: forall x. PollOption -> Rep PollOption x
$cto :: forall x. Rep PollOption x -> PollOption
to :: forall x. Rep PollOption x -> PollOption
Generic, Int -> PollOption -> ShowS
[PollOption] -> ShowS
PollOption -> String
(Int -> PollOption -> ShowS)
-> (PollOption -> String)
-> ([PollOption] -> ShowS)
-> Show PollOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PollOption -> ShowS
showsPrec :: Int -> PollOption -> ShowS
$cshow :: PollOption -> String
show :: PollOption -> String
$cshowList :: [PollOption] -> ShowS
showList :: [PollOption] -> ShowS
Show)

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