{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module Telegram.Bot.API.Methods.SendContact where

import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Proxy
import Data.Text
import GHC.Generics (Generic)
import Servant.API
import Servant.Client hiding (Response)

import Telegram.Bot.API.Internal.Utils
import Telegram.Bot.API.MakingRequests
import Telegram.Bot.API.Types

-- ** 'sendContact'

-- | Request parameters for 'sendContact'.
data SendContactRequest = SendContactRequest
  { SendContactRequest -> SomeChatId
sendContactChatId :: SomeChatId -- ^ Unique identifier for the target chat or username of the target channel (in the format @channelusername).
  , SendContactRequest -> Maybe MessageThreadId
sendContactMessageThreadId :: Maybe MessageThreadId -- ^ Unique identifier for the target message thread (topic) of the forum; for forum supergroups only.
  , SendContactRequest -> Text
sendContactPhoneNumber :: Text -- ^ Contact's phone number
  , SendContactRequest -> Text
sendContactFirstName  :: Text -- ^ Contact's first name
  , SendContactRequest -> Text
sendContactLastName  :: Text -- ^ Contact's last name
  , SendContactRequest -> Text
sendContactVcard  :: Text -- ^ Additional data about the contact in the form of a vCard, 0-2048 bytes
  , SendContactRequest -> Maybe Bool
sendContactDisableNotification :: Maybe Bool -- ^ Sends the message silently. Users will receive a notification with no sound.
  , SendContactRequest -> Maybe Bool
sendContactProtectContent :: Maybe Bool -- ^ Protects the contents of the sent message from forwarding and saving
  , SendContactRequest -> Maybe MessageId
sendContactReplyToMessageId :: Maybe MessageId -- ^ If the message is a reply, ID of the original message
  , SendContactRequest -> Maybe Bool
sendContactAllowSendingWithoutReply :: Maybe Bool -- ^ Pass True, if the message should be sent even if the specified replied-to message is not found
  , SendContactRequest -> Maybe InlineKeyboardMarkup
sendContactReplyMarkup :: Maybe InlineKeyboardMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
  }
  deriving forall x. Rep SendContactRequest x -> SendContactRequest
forall x. SendContactRequest -> Rep SendContactRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendContactRequest x -> SendContactRequest
$cfrom :: forall x. SendContactRequest -> Rep SendContactRequest x
Generic

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

type SendContact = "sendContact"
  :> ReqBody '[JSON] SendContactRequest
  :> Post '[JSON] (Response Message)

-- | Use this method to send phone contacts.
--   On success, the sent Message is returned.
sendContact :: SendContactRequest ->  ClientM (Response Message)
sendContact :: SendContactRequest -> ClientM (Response Message)
sendContact = forall api.
HasClient ClientM api =>
Proxy api -> Client ClientM api
client (forall {k} (t :: k). Proxy t
Proxy @SendContact)