{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.Birthdate where
import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Time.Calendar
import GHC.Generics (Generic)
import Telegram.Bot.API.Internal.Utils
data Birthdate = Birthdate
{ Birthdate -> DayOfMonth
birthdateDay :: DayOfMonth
, Birthdate -> DayOfMonth
birthdateMonth :: MonthOfYear
, Birthdate -> Maybe Year
birthdate :: Maybe Year
}
deriving ((forall x. Birthdate -> Rep Birthdate x)
-> (forall x. Rep Birthdate x -> Birthdate) -> Generic Birthdate
forall x. Rep Birthdate x -> Birthdate
forall x. Birthdate -> Rep Birthdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Birthdate -> Rep Birthdate x
from :: forall x. Birthdate -> Rep Birthdate x
$cto :: forall x. Rep Birthdate x -> Birthdate
to :: forall x. Rep Birthdate x -> Birthdate
Generic, DayOfMonth -> Birthdate -> ShowS
[Birthdate] -> ShowS
Birthdate -> String
(DayOfMonth -> Birthdate -> ShowS)
-> (Birthdate -> String)
-> ([Birthdate] -> ShowS)
-> Show Birthdate
forall a.
(DayOfMonth -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: DayOfMonth -> Birthdate -> ShowS
showsPrec :: DayOfMonth -> Birthdate -> ShowS
$cshow :: Birthdate -> String
show :: Birthdate -> String
$cshowList :: [Birthdate] -> ShowS
showList :: [Birthdate] -> ShowS
Show)
instance ToJSON Birthdate where toJSON :: Birthdate -> Value
toJSON = Birthdate -> Value
forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON Birthdate where parseJSON :: Value -> Parser Birthdate
parseJSON = Value -> Parser Birthdate
forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON