<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class Image extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        $d = [];
        #$d["id"] = $this->id;
        $d["name"] = $this->name;
        $d["description"] = $this->description;
        $d["filename"] = $this->filename;
        $d["size"] = $this->size;
        $d["exit"] = ["DateTimeOriginal" => $this->DateTimeOriginal];
        $d["url"] = [
            "small" => url("/".$this->getGallery()->getTenant()->url."/".$this->getGallery()->url."/".$this->id."/file?size=small"),
            "medium" => url("/".$this->getGallery()->getTenant()->url."/".$this->getGallery()->url."/".$this->id."/file?size=medium"),
            "big" => url("/".$this->getGallery()->getTenant()->url."/".$this->getGallery()->url."/".$this->id."/file?size=big")
        ];
        return $d;
    }
}
