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

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

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

-- ** 'ChatLocation'

-- | Represents a location to which a chat is connected.
data ChatLocation = ChatLocation
  { ChatLocation -> Location
chatLocationLocation :: Location -- ^ The location to which the supergroup is connected. Can't be a live location..
  , ChatLocation -> Text
chatLocationAddress :: Text      -- ^ Location address; 1-64 characters, as defined by the chat owner.
  }
  deriving (forall x. Rep ChatLocation x -> ChatLocation
forall x. ChatLocation -> Rep ChatLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChatLocation x -> ChatLocation
$cfrom :: forall x. ChatLocation -> Rep ChatLocation x
Generic, Int -> ChatLocation -> ShowS
[ChatLocation] -> ShowS
ChatLocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChatLocation] -> ShowS
$cshowList :: [ChatLocation] -> ShowS
show :: ChatLocation -> String
$cshow :: ChatLocation -> String
showsPrec :: Int -> ChatLocation -> ShowS
$cshowsPrec :: Int -> ChatLocation -> ShowS
Show)

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