import Accessor from "@arcgis/core/core/Accessor.js";
import { property } from "@arcgis/core/core/accessorSupport/decorators.js";

export interface ILocationResponse {
    name: string,
    region: string,
    country: string,
    lat: number,
    lon: number,
    tz_id: string,
    localtime_epoch: number,
    localtime: string
}

export default class LocationResponse extends Accessor implements ILocationResponse {
    @property()
    name: string;
    @property()
    region: string;
    @property()
    country: string;
    @property()
    lat: number;
    @property()
    lon: number;
    @property()
    tz_id: string;
    @property()
    localtime_epoch: number;
    @property()
    localtime: string;

    constructor(locationResponse: ILocationResponse) {
        super();
        this.name = locationResponse.name;
        this.region = locationResponse.region;
        this.country = locationResponse.country;
        this.lat = locationResponse.lat;
        this.lon = locationResponse.lon;
        this.tz_id = locationResponse.tz_id;
        this.localtime_epoch = locationResponse.localtime_epoch;
        this.localtime = locationResponse.localtime
    }

}
