module TD.Query.EditInlineMessageLiveLocation
  (EditInlineMessageLiveLocation(..)
  , defaultEditInlineMessageLiveLocation
  ) 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 an inline message sent via a bot; for bots only. Returns 'TD.Data.Ok.Ok'
data EditInlineMessageLiveLocation
  = EditInlineMessageLiveLocation
    { EditInlineMessageLiveLocation -> Maybe Text
inline_message_id      :: Maybe T.Text                  -- ^ Inline message identifier
    , EditInlineMessageLiveLocation -> Maybe ReplyMarkup
reply_markup           :: Maybe ReplyMarkup.ReplyMarkup -- ^ The new message reply markup; pass null if none
    , EditInlineMessageLiveLocation -> Maybe Location
location               :: Maybe Location.Location       -- ^ New location content of the message; pass null to stop sharing the live location
    , EditInlineMessageLiveLocation -> 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
    , EditInlineMessageLiveLocation -> Maybe Int
heading                :: Maybe Int                     -- ^ The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
    , EditInlineMessageLiveLocation -> 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 (EditInlineMessageLiveLocation
-> EditInlineMessageLiveLocation -> Bool
(EditInlineMessageLiveLocation
 -> EditInlineMessageLiveLocation -> Bool)
-> (EditInlineMessageLiveLocation
    -> EditInlineMessageLiveLocation -> Bool)
-> Eq EditInlineMessageLiveLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EditInlineMessageLiveLocation
-> EditInlineMessageLiveLocation -> Bool
== :: EditInlineMessageLiveLocation
-> EditInlineMessageLiveLocation -> Bool
$c/= :: EditInlineMessageLiveLocation
-> EditInlineMessageLiveLocation -> Bool
/= :: EditInlineMessageLiveLocation
-> EditInlineMessageLiveLocation -> Bool
Eq, Int -> EditInlineMessageLiveLocation -> ShowS
[EditInlineMessageLiveLocation] -> ShowS
EditInlineMessageLiveLocation -> String
(Int -> EditInlineMessageLiveLocation -> ShowS)
-> (EditInlineMessageLiveLocation -> String)
-> ([EditInlineMessageLiveLocation] -> ShowS)
-> Show EditInlineMessageLiveLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EditInlineMessageLiveLocation -> ShowS
showsPrec :: Int -> EditInlineMessageLiveLocation -> ShowS
$cshow :: EditInlineMessageLiveLocation -> String
show :: EditInlineMessageLiveLocation -> String
$cshowList :: [EditInlineMessageLiveLocation] -> ShowS
showList :: [EditInlineMessageLiveLocation] -> ShowS
Show)

instance I.ShortShow EditInlineMessageLiveLocation where
  shortShow :: EditInlineMessageLiveLocation -> String
shortShow
    EditInlineMessageLiveLocation
      { inline_message_id :: EditInlineMessageLiveLocation -> Maybe Text
inline_message_id      = Maybe Text
inline_message_id_
      , reply_markup :: EditInlineMessageLiveLocation -> Maybe ReplyMarkup
reply_markup           = Maybe ReplyMarkup
reply_markup_
      , location :: EditInlineMessageLiveLocation -> Maybe Location
location               = Maybe Location
location_
      , live_period :: EditInlineMessageLiveLocation -> Maybe Int
live_period            = Maybe Int
live_period_
      , heading :: EditInlineMessageLiveLocation -> Maybe Int
heading                = Maybe Int
heading_
      , proximity_alert_radius :: EditInlineMessageLiveLocation -> Maybe Int
proximity_alert_radius = Maybe Int
proximity_alert_radius_
      }
        = String
"EditInlineMessageLiveLocation"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"inline_message_id"      String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
inline_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 EditInlineMessageLiveLocation where
  toJSON :: EditInlineMessageLiveLocation -> Value
toJSON
    EditInlineMessageLiveLocation
      { inline_message_id :: EditInlineMessageLiveLocation -> Maybe Text
inline_message_id      = Maybe Text
inline_message_id_
      , reply_markup :: EditInlineMessageLiveLocation -> Maybe ReplyMarkup
reply_markup           = Maybe ReplyMarkup
reply_markup_
      , location :: EditInlineMessageLiveLocation -> Maybe Location
location               = Maybe Location
location_
      , live_period :: EditInlineMessageLiveLocation -> Maybe Int
live_period            = Maybe Int
live_period_
      , heading :: EditInlineMessageLiveLocation -> Maybe Int
heading                = Maybe Int
heading_
      , proximity_alert_radius :: EditInlineMessageLiveLocation -> 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
"editInlineMessageLiveLocation"
          , Key
"inline_message_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
inline_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_
          ]

defaultEditInlineMessageLiveLocation :: EditInlineMessageLiveLocation
defaultEditInlineMessageLiveLocation :: EditInlineMessageLiveLocation
defaultEditInlineMessageLiveLocation =
  EditInlineMessageLiveLocation
    { inline_message_id :: Maybe Text
inline_message_id      = Maybe Text
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
    }