<?php

namespace App\Http\Resources;

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

/**
 * @property mixed id
 * @property mixed status
 * @property mixed umrah_trip_date
 * @property mixed house_type
 * @property mixed rally_point_info
 * @property mixed escorts
 * @property mixed name
 * @property mixed email
 * @property mixed phone
 * @property mixed user_id
 * @property mixed umrah_trip_id
 * @property mixed departure_city
 * @property mixed arrival_city
 * @property mixed price_per_person
 * @property mixed person_count
 * @property mixed total
 */
class UmrahTripReservationResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  Request  $request
     * @return array
     */
    public function toArray($request)
    {
        $departure_city_name = $this->departure_city ? City::withDescription(null, $this->departure_city)->name : null;
        $arrival_city_name = $this->arrival_city ? City::withDescription(null, $this->arrival_city)->name : null;
        return [
            'id' => $this->id,
            'status' => $this->status,
            'umrah_trip_date' =>$this->umrah_trip_date,
            'house_type' => __('umrahTrips.'.$this->house_type),
            'rally_point_info' => $this->rally_point_info,
            'escorts' => $this->escorts,
            'name' => $this->name,
            'email' => $this->email,
            'phone' => $this->phone,
            'user_id' => $this->user_id,
            'umrah_trip_id' => $this->umrah_trip_id,
            'departure_city' => $this->departure_city,
            'arrival_city' => $this->arrival_city,
            'departure_city_name' => $departure_city_name,
            'arrival_city_name' => $arrival_city_name,
            'price_per_person' =>$this->price_per_person,
            'person_count' =>$this->person_count,
            'total' =>$this->total,
        ];
    }

}
