<?php

namespace Modules\Booking\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use Modules\Booking\Enums\BookingChannel;
use Modules\Booking\Enums\BookingStatus;
use Modules\Booking\Models\Booking;
use Modules\Catalog\Models\DepartureTimeSlot;
use Modules\Routing\Models\EvRoute;

/**
 * @extends Factory<Booking>
 */
class BookingFactory extends Factory
{
    protected $model = Booking::class;

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'booking_ref' => 'EVB-'.strtoupper(Str::random(6)),
            'user_id' => null,
            'openid' => null,
            'ev_route_id' => EvRoute::factory(),
            'linked_booking_id' => null,
            'is_return_leg' => false,
            'departure_time_slot_id' => DepartureTimeSlot::factory(),
            'travel_date' => now()->addDay()->toDateString(),
            'passenger_name' => $this->faker->name(),
            'passenger_phone' => $this->faker->phoneNumber(),
            'pickup_address' => $this->faker->address(),
            'pickup_lat' => null,
            'pickup_lng' => null,
            'dropoff_address' => $this->faker->address(),
            'dropoff_lat' => null,
            'dropoff_lng' => null,
            'price' => $this->faker->randomFloat(2, 5000, 50000),
            'status' => BookingStatus::PendingPayment,
            'created_by_channel' => BookingChannel::MiniApp,
            'driver_name' => null,
            'driver_phone' => null,
            'car_plate_number' => null,
            'car_model' => null,
        ];
    }
}
