<?php

namespace Modules\Routing\Http\Resources;

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

class RoutePricingResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            'vehicle_option' => $this->vehicle_option->value,
            'price' => (string) $this->price,
            'is_blocked' => $this->is_blocked,
            'max_per_booking' => config("booking.{$this->vehicle_option->value}_max_per_booking"),
        ];
    }
}
