<?php

namespace App\Http\Resources\Turistico;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class AvaliacaoResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id'          => $this->id,
            'user'        => [
                'id'   => $this->user?->id,
                'name' => $this->user?->name,
            ],
            'nota'        => $this->nota,
            'comentario'  => $this->comentario,
            'criado_em'   => $this->created_at?->toIso8601String(),
        ];
    }
}
