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

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

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

-- ** 'BusinessLocation'

-- | Contains information about the location of a Telegram Business account.
data BusinessLocation = BusinessLocation
  { BusinessLocation -> Text
businessLocationAddress :: Text -- ^ Address of the business.
  , BusinessLocation -> Maybe Location
businessLocationLocation :: Maybe Location -- ^ Location of the business.
  }
  deriving ((forall x. BusinessLocation -> Rep BusinessLocation x)
-> (forall x. Rep BusinessLocation x -> BusinessLocation)
-> Generic BusinessLocation
forall x. Rep BusinessLocation x -> BusinessLocation
forall x. BusinessLocation -> Rep BusinessLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BusinessLocation -> Rep BusinessLocation x
from :: forall x. BusinessLocation -> Rep BusinessLocation x
$cto :: forall x. Rep BusinessLocation x -> BusinessLocation
to :: forall x. Rep BusinessLocation x -> BusinessLocation
Generic, Int -> BusinessLocation -> ShowS
[BusinessLocation] -> ShowS
BusinessLocation -> String
(Int -> BusinessLocation -> ShowS)
-> (BusinessLocation -> String)
-> ([BusinessLocation] -> ShowS)
-> Show BusinessLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BusinessLocation -> ShowS
showsPrec :: Int -> BusinessLocation -> ShowS
$cshow :: BusinessLocation -> String
show :: BusinessLocation -> String
$cshowList :: [BusinessLocation] -> ShowS
showList :: [BusinessLocation] -> ShowS
Show)

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