<?php

namespace Database\Factories;

use App\Enums\SpaceOperationalStatus;
use App\Models\Space;
use App\Models\SpaceType;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/**
 * @extends Factory<Space>
 */
class SpaceFactory extends Factory
{
    protected $model = Space::class;

    /**
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $name = fake()->words(2, true);

        return [
            'space_type_id' => SpaceType::factory(),
            'name' => Str::title($name),
            'code' => Str::upper(Str::slug($name, '-')).'-'.fake()->unique()->numberBetween(100, 999),
            'description' => fake()->optional()->paragraph(),
            'location' => fake()->optional()->randomElement(['Ground Floor', 'First Floor', 'Garden Wing']),
            'min_capacity' => fake()->numberBetween(10, 50),
            'max_capacity' => fake()->numberBetween(51, 500),
            'standard_rate' => fake()->randomFloat(2, 5000, 50000),
            'hourly_rate' => fake()->randomFloat(2, 500, 5000),
            'half_day_rate' => fake()->randomFloat(2, 2500, 25000),
            'full_day_rate' => fake()->randomFloat(2, 5000, 50000),
            'setup_duration_minutes' => fake()->randomElement([30, 60, 90]),
            'breakdown_duration_minutes' => fake()->randomElement([30, 60, 90]),
            'opening_time' => '08:00',
            'closing_time' => '22:00',
            'amenities' => fake()->optional()->sentence(),
            'equipment' => fake()->optional()->sentence(),
            'terms' => fake()->optional()->sentence(),
            'operational_status' => SpaceOperationalStatus::Active,
        ];
    }
}
