typings/lib2/messagev2/messagePayload/locationMessage.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Location = exports.LocationMessage = void 0;
const internal_1 = require("../internal");
/**
 * Represents a geo location message sent by the user to the bot.
 * @extends NonRawMessage
 */
class LocationMessage extends internal_1.NonRawMessage {
    /**
     * Constructs a LocationMessage object with the specified location.
     * @param {Location} location The location of the message.
     */
    constructor(location) {
        super();
        this.type = 'location';
        this.location = location;
    }
    /**
     * Deserialize nested object properties into corresponding class instances
     */
    deserializeNestedProperties() {
        super.deserializeNestedProperties();
        this.location = internal_1.MessageUtil.deserializeLocation(this.location);
    }
    /**
     * Gets the location of the message.
     * @returns {Location} The location of the message.
     */
    getLocation() {
        return this.location;
    }
}
exports.LocationMessage = LocationMessage;
/**
 * Represents a location with title, URL, latitude, and longitude.
 */
class Location {
    /**
     * Creates a new Location instance.
     * @param {number} latitude The latitude coordinate of the location.
     * @param {number} longitude The longitude coordinate of the location.
     */
    constructor(latitude, longitude) {
        this.latitude = latitude;
        this.longitude = longitude;
    }
    /**
     * Gets the title of the location.
     * @returns {string} The title of the location.
     */
    getTitle() {
        return this.title;
    }
    /**
     * Gets the URL of the location.
     * @returns {string} The URL of the location.
     */
    getUrl() {
        return this.url;
    }
    /**
     * Gets the latitude coordinate of the location.
     * @returns {number} The latitude coordinate of the location.
     */
    getLatitude() {
        return this.latitude;
    }
    /**
     * Gets the longitude coordinate of the location.
     * @returns {number} The longitude coordinate of the location.
     */
    getLongitude() {
        return this.longitude;
    }
}
exports.Location = Location;