<?php

namespace Database\Factories;

use App\Enums\LeadSource;
use App\Enums\LeadStatus;
use App\Models\Lead;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<Lead>
 */
class LeadFactory extends Factory
{
    /**
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'name' => fake()->name(),
            'phone' => fake()->phoneNumber(),
            'target_course' => fake()->optional()->words(2, true),
            'education_level' => fake()->optional()->randomElement(['Lise', 'Üniversite', 'Lisans', 'Yüksek Lisans']),
            'subject' => fake()->optional()->randomElement(['stcw', 'kaptanlik', 'belge', 'diger']),
            'message' => fake()->optional()->paragraph(),
            'status' => fake()->randomElement(LeadStatus::cases()),
            'notes' => null,
            'is_read' => fake()->boolean(30),
            'source' => fake()->randomElement(LeadSource::cases()),
            'utm' => null,
            'consent_kvkk' => true,
            'consent_text_version' => 'v1.0',
        ];
    }

    public function unread(): static
    {
        return $this->state(fn (array $attributes) => [
            'is_read' => false,
            'status' => LeadStatus::New,
        ]);
    }
}
