<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class MapItemResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id'                 => $this->id,
            'title'              => $this->title,
            'year'               => $this->year,
            'aet'                => $this->aet,
            'aetComment'         => $this->aet_comment,
            'mapInformation'     => $this->when($this->mapInformation, new MapInformationResource($this->mapInformation)),
        ];
    }
}
