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.LiveLocation as LiveLocation

-- | 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 LiveLocation
location          :: Maybe LiveLocation.LiveLocation -- ^ New live location of the message; pass null to stop sharing the live location. If the new live_period isn't set to 0x7FFFFFFF, then it 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
    }
  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 LiveLocation
location          = Maybe LiveLocation
location_
      }
        = 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 LiveLocation -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe LiveLocation
location_
          ]

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 LiveLocation
location          = Maybe LiveLocation
location_
      }
        = [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 LiveLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe LiveLocation
location_
          ]

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 LiveLocation
location          = Maybe LiveLocation
forall a. Maybe a
Nothing
    }