{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.Contact 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

-- ** 'Contact'

-- | This object represents a phone contact.
data Contact = Contact
  { Contact -> Text
contactPhoneNumber :: Text -- ^ Contact's phone number.
  , Contact -> Text
contactFirstName   :: Text -- ^ Contact's first name.
  , Contact -> Maybe Text
contactLastName    :: Maybe Text -- ^ Contact's last name.
  , Contact -> Maybe UserId
contactUserId      :: Maybe UserId -- ^ Contact's user identifier in Telegram.
  , Contact -> Maybe Text
contactVcard       :: Maybe Text -- ^ Additional data about the contact in the form of a vCard.
  }
  deriving (forall x. Rep Contact x -> Contact
forall x. Contact -> Rep Contact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Contact x -> Contact
$cfrom :: forall x. Contact -> Rep Contact x
Generic, Int -> Contact -> ShowS
[Contact] -> ShowS
Contact -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Contact] -> ShowS
$cshowList :: [Contact] -> ShowS
show :: Contact -> String
$cshow :: Contact -> String
showsPrec :: Int -> Contact -> ShowS
$cshowsPrec :: Int -> Contact -> ShowS
Show)

instance ToJSON   Contact where toJSON :: Contact -> 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 Contact where parseJSON :: Value -> Parser Contact
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON