<?php

namespace Saswp\DTOs\Response;

class PropertyLocationDTO
{

    public readonly int $id;
    public readonly string $unit;
    public readonly string $full_address;
    public readonly string $address;
    public readonly string $suburb;
    public readonly string $city;
    public readonly string $state;
    public readonly string $country;
    public readonly string $post_code;
    public readonly string $latitude;
    public readonly string $longitude;

    public function __construct(array $_data)
    {
        $this->id  = isset($_data['id']) ?$_data['id']:0;
        $this->unit  = isset($_data['unit']) ?$_data['unit']:'';
        $this->full_address  = isset($_data['full_address']) ?$_data['full_address']:'';
        $this->address  = isset($_data['address']) ?$_data['address']:'';
        $this->suburb  = isset($_data['suburb']) ?$_data['suburb']:'';
        $this->city  = isset($_data['city']) ?$_data['city']:'';
        $this->state  = isset($_data['state']) ?$_data['state']:'';
        $this->country  = isset($_data['country']) ?$_data['country']:'';
        $this->post_code  = isset($_data['post_code']) ?$_data['post_code']:'';
        $this->latitude  = isset($_data['latitude']) ?$_data['latitude']:'';
        $this->longitude  = isset($_data['longitude']) ?$_data['longitude']:'';
    }

    public function toArray(): array
    {
        return (array)$this;
    }
}
