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

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

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

-- ** 'ProximityAlertTriggered'

-- | This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
data ProximityAlertTriggered = ProximityAlertTriggered
  { ProximityAlertTriggered -> User
proximityAlertTriggeredTraveler :: User  -- ^ User that triggered the alert.
  , ProximityAlertTriggered -> User
proximityAlertTriggeredWatcher  :: User  -- ^ User that set the alert.
  , ProximityAlertTriggered -> Int
proximityAlertTriggeredDistance :: Int -- ^ The distance between the users.
  }
  deriving (forall x. Rep ProximityAlertTriggered x -> ProximityAlertTriggered
forall x. ProximityAlertTriggered -> Rep ProximityAlertTriggered x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProximityAlertTriggered x -> ProximityAlertTriggered
$cfrom :: forall x. ProximityAlertTriggered -> Rep ProximityAlertTriggered x
Generic, Int -> ProximityAlertTriggered -> ShowS
[ProximityAlertTriggered] -> ShowS
ProximityAlertTriggered -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProximityAlertTriggered] -> ShowS
$cshowList :: [ProximityAlertTriggered] -> ShowS
show :: ProximityAlertTriggered -> String
$cshow :: ProximityAlertTriggered -> String
showsPrec :: Int -> ProximityAlertTriggered -> ShowS
$cshowsPrec :: Int -> ProximityAlertTriggered -> ShowS
Show)

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