<?php

namespace Saswp\DTOs\Response;

class PropertyImageDTO
{
    public readonly int $id;
    public readonly int $property_id;
    public readonly string $path;
    public readonly int $order;
    public readonly string $type;
    public readonly string $alt;
    public readonly string $description;
    public readonly string $full_path;
    public readonly string $full_path_resized;
    public readonly string $full_path_large;
    public readonly string $full_path_large_webp;
    public readonly string $full_path_medium;
    public readonly string $full_path_thumb;

    public function __construct(array $_data)
    {

        $this->id  = isset($_data['id']) ?$_data['id']:0;
        $this->property_id  = isset($_data['property_id']) ?$_data['property_id']:0;
        $this->path  = isset($_data['path']) ?$_data['path']:'';
        $this->order  = isset($_data['order']) ?$_data['order']:0;
        $this->type  = isset($_data['type']) ?$_data['type']:'';
        $this->alt  = isset($_data['alt']) ?$_data['alt']:'';
        $this->description  = isset($_data['description']) ?$_data['description']:'';
        $this->full_path  = isset($_data['full_path']) ?$_data['full_path']:'';
        $this->full_path_resized  = isset($_data['full_path_resized']) ?$_data['full_path_resized']:'';
        $this->full_path_large  = isset($_data['full_path_large']) ?$_data['full_path_large']:'';
        $this->full_path_large_webp  = isset($_data['full_path_large_webp']) ?$_data['full_path_large_webp']:'';
        $this->full_path_medium  = isset($_data['full_path_medium']) ?$_data['full_path_medium']:'';
        $this->full_path_thumb  = isset($_data['full_path_thumb']) ?$_data['full_path_thumb']:'';
    }

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