<?php

namespace App\Http\Resources;

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

class ClientFavoriteProviderResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'client_id' => $this->client_id,
            'provider_id' => $this->provider_id,
            'provider_name' => $this->provider_name ?? $this->provider?->user?->name,
            'city_name' => $this->city_name ?? null,
            'average_rating' => $this->average_rating ?? null,
            'daily_price_8h' => $this->daily_price_8h ?? null,
            'daily_price_6h' => $this->daily_price_6h ?? null,
            'daily_price_4h' => $this->daily_price_4h ?? null,
            'daily_price_2h' => $this->daily_price_2h ?? null,
            'total_services' => $this->total_services ?? null,
            'notes' => $this->notes,
            'created_at' => $this->created_at?->format('Y-m-d H:i'),
            'updated_at' => $this->updated_at?->format('Y-m-d H:i'),
        ];
    }
}
