<?php

namespace App\Http\Resources;

use App\Helpers\ImageHelper;
use App\User;
use Illuminate\Http\Resources\Json\JsonResource;

/**
 * @property mixed id
 * @property mixed comment
 * @property mixed user_id
 * @property mixed hotel_id
 * @property mixed evaluate_average
 * @property mixed umrah_trip_id
 * @property mixed status
 * @property mixed created_at
 * @property mixed hotel_reservation_id
 * @property mixed umrah_trip_reservation_id
 */
class EvaluateResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'comment' => $this->comment,
            'evaluate_average' => $this->evaluate_average,
            'user_id' => $this->user_id,
            'user_name' => $this->user ? $this->user->name : '',
            'user_image' => $this->user ? ImageHelper::getFullPath($this->user->photo ?? 'uploads/avatar.png') : '',
            'hotel_id' => $this->hotel_id,
            'hotel_reservation_id' => $this->hotel_reservation_id,
            'umrah_trip_id' => $this->umrah_trip_id,
            'umrah_trip_reservation_id' => $this->umrah_trip_reservation_id,
            'status' => $this->status,
            'created_at' => $this->created_at,

        ];
    }
}
