module TD.Query.EditBusinessMessageLiveLocation
  (EditBusinessMessageLiveLocation(..)
  , defaultEditBusinessMessageLiveLocation
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
import qualified TD.Data.ReplyMarkup as ReplyMarkup
import qualified TD.Data.Location as Location

-- | Edits the content of a live location in a message sent on behalf of a business account; for bots only. Returns 'TD.Data.BusinessMessage.BusinessMessage'
data EditBusinessMessageLiveLocation
  = EditBusinessMessageLiveLocation
    { EditBusinessMessageLiveLocation -> Maybe Text
business_connection_id :: Maybe T.Text                  -- ^ Unique identifier of business connection on behalf of which the message was sent
    , EditBusinessMessageLiveLocation -> Maybe Int
chat_id                :: Maybe Int                     -- ^ The chat the message belongs to
    , EditBusinessMessageLiveLocation -> Maybe Int
message_id             :: Maybe Int                     -- ^ Identifier of the message
    , EditBusinessMessageLiveLocation -> Maybe ReplyMarkup
reply_markup           :: Maybe ReplyMarkup.ReplyMarkup -- ^ The new message reply markup; pass null if none
    , EditBusinessMessageLiveLocation -> Maybe Location
location               :: Maybe Location.Location       -- ^ New location content of the message; pass null to stop sharing the live location
    , EditBusinessMessageLiveLocation -> Maybe Int
live_period            :: Maybe Int                     -- ^ New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period
    , EditBusinessMessageLiveLocation -> Maybe Int
heading                :: Maybe Int                     -- ^ The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
    , EditBusinessMessageLiveLocation -> Maybe Int
proximity_alert_radius :: Maybe Int                     -- ^ The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled
    }
  deriving (EditBusinessMessageLiveLocation
-> EditBusinessMessageLiveLocation -> Bool
(EditBusinessMessageLiveLocation
 -> EditBusinessMessageLiveLocation -> Bool)
-> (EditBusinessMessageLiveLocation
    -> EditBusinessMessageLiveLocation -> Bool)
-> Eq EditBusinessMessageLiveLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EditBusinessMessageLiveLocation
-> EditBusinessMessageLiveLocation -> Bool
== :: EditBusinessMessageLiveLocation
-> EditBusinessMessageLiveLocation -> Bool
$c/= :: EditBusinessMessageLiveLocation
-> EditBusinessMessageLiveLocation -> Bool
/= :: EditBusinessMessageLiveLocation
-> EditBusinessMessageLiveLocation -> Bool
Eq, Int -> EditBusinessMessageLiveLocation -> ShowS
[EditBusinessMessageLiveLocation] -> ShowS
EditBusinessMessageLiveLocation -> String
(Int -> EditBusinessMessageLiveLocation -> ShowS)
-> (EditBusinessMessageLiveLocation -> String)
-> ([EditBusinessMessageLiveLocation] -> ShowS)
-> Show EditBusinessMessageLiveLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EditBusinessMessageLiveLocation -> ShowS
showsPrec :: Int -> EditBusinessMessageLiveLocation -> ShowS
$cshow :: EditBusinessMessageLiveLocation -> String
show :: EditBusinessMessageLiveLocation -> String
$cshowList :: [EditBusinessMessageLiveLocation] -> ShowS
showList :: [EditBusinessMessageLiveLocation] -> ShowS
Show)

instance I.ShortShow EditBusinessMessageLiveLocation where
  shortShow :: EditBusinessMessageLiveLocation -> String
shortShow
    EditBusinessMessageLiveLocation
      { business_connection_id :: EditBusinessMessageLiveLocation -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , chat_id :: EditBusinessMessageLiveLocation -> Maybe Int
chat_id                = Maybe Int
chat_id_
      , message_id :: EditBusinessMessageLiveLocation -> Maybe Int
message_id             = Maybe Int
message_id_
      , reply_markup :: EditBusinessMessageLiveLocation -> Maybe ReplyMarkup
reply_markup           = Maybe ReplyMarkup
reply_markup_
      , location :: EditBusinessMessageLiveLocation -> Maybe Location
location               = Maybe Location
location_
      , live_period :: EditBusinessMessageLiveLocation -> Maybe Int
live_period            = Maybe Int
live_period_
      , heading :: EditBusinessMessageLiveLocation -> Maybe Int
heading                = Maybe Int
heading_
      , proximity_alert_radius :: EditBusinessMessageLiveLocation -> Maybe Int
proximity_alert_radius = Maybe Int
proximity_alert_radius_
      }
        = String
"EditBusinessMessageLiveLocation"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"business_connection_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
business_connection_id_
          , String
"chat_id"                String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          , String
"message_id"             String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
          , String
"reply_markup"           String -> Maybe ReplyMarkup -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ReplyMarkup
reply_markup_
          , String
"location"               String -> Maybe Location -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Location
location_
          , String
"live_period"            String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
live_period_
          , String
"heading"                String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
heading_
          , String
"proximity_alert_radius" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
proximity_alert_radius_
          ]

instance AT.ToJSON EditBusinessMessageLiveLocation where
  toJSON :: EditBusinessMessageLiveLocation -> Value
toJSON
    EditBusinessMessageLiveLocation
      { business_connection_id :: EditBusinessMessageLiveLocation -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , chat_id :: EditBusinessMessageLiveLocation -> Maybe Int
chat_id                = Maybe Int
chat_id_
      , message_id :: EditBusinessMessageLiveLocation -> Maybe Int
message_id             = Maybe Int
message_id_
      , reply_markup :: EditBusinessMessageLiveLocation -> Maybe ReplyMarkup
reply_markup           = Maybe ReplyMarkup
reply_markup_
      , location :: EditBusinessMessageLiveLocation -> Maybe Location
location               = Maybe Location
location_
      , live_period :: EditBusinessMessageLiveLocation -> Maybe Int
live_period            = Maybe Int
live_period_
      , heading :: EditBusinessMessageLiveLocation -> Maybe Int
heading                = Maybe Int
heading_
      , proximity_alert_radius :: EditBusinessMessageLiveLocation -> Maybe Int
proximity_alert_radius = Maybe Int
proximity_alert_radius_
      }
        = [Pair] -> Value
A.object
          [ Key
"@type"                  Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"editBusinessMessageLiveLocation"
          , Key
"business_connection_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
business_connection_id_
          , Key
"chat_id"                Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
chat_id_
          , Key
"message_id"             Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
message_id_
          , Key
"reply_markup"           Key -> Maybe ReplyMarkup -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ReplyMarkup
reply_markup_
          , Key
"location"               Key -> Maybe Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Location
location_
          , Key
"live_period"            Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
live_period_
          , Key
"heading"                Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
heading_
          , Key
"proximity_alert_radius" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
proximity_alert_radius_
          ]

defaultEditBusinessMessageLiveLocation :: EditBusinessMessageLiveLocation
defaultEditBusinessMessageLiveLocation :: EditBusinessMessageLiveLocation
defaultEditBusinessMessageLiveLocation =
  EditBusinessMessageLiveLocation
    { business_connection_id :: Maybe Text
business_connection_id = Maybe Text
forall a. Maybe a
Nothing
    , chat_id :: Maybe Int
chat_id                = Maybe Int
forall a. Maybe a
Nothing
    , message_id :: Maybe Int
message_id             = Maybe Int
forall a. Maybe a
Nothing
    , reply_markup :: Maybe ReplyMarkup
reply_markup           = Maybe ReplyMarkup
forall a. Maybe a
Nothing
    , location :: Maybe Location
location               = Maybe Location
forall a. Maybe a
Nothing
    , live_period :: Maybe Int
live_period            = Maybe Int
forall a. Maybe a
Nothing
    , heading :: Maybe Int
heading                = Maybe Int
forall a. Maybe a
Nothing
    , proximity_alert_radius :: Maybe Int
proximity_alert_radius = Maybe Int
forall a. Maybe a
Nothing
    }