<?php

namespace Database\Factories;

use App\Enums\ContactBudget;
use App\Enums\ContactService;
use App\Enums\ContactStatus;
use App\Models\ContactSubmission;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<ContactSubmission>
 */
class ContactSubmissionFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'name' => fake()->name(),
            'phone' => '9'.fake()->numerify('#########'),
            'email' => fake()->safeEmail(),
            'service' => fake()->randomElement(ContactService::cases())->value,
            'event_date' => fake()->optional()->dateTimeBetween('now', '+6 months'),
            'budget' => fake()->optional()->randomElement(ContactBudget::cases())?->value,
            'message' => fake()->paragraph(),
            'ip_address' => fake()->ipv4(),
            'user_agent' => fake()->userAgent(),
            'status' => ContactStatus::New,
        ];
    }

    /**
     * Indicate that the submission is new.
     */
    public function newSubmission(): static
    {
        return $this->state(fn (array $attributes) => [
            'status' => ContactStatus::New,
        ]);
    }

    /**
     * Indicate that the submission has been contacted.
     */
    public function contacted(): static
    {
        return $this->state(fn (array $attributes) => [
            'status' => ContactStatus::Contacted,
        ]);
    }

    /**
     * Indicate that the submission has converted.
     */
    public function converted(): static
    {
        return $this->state(fn (array $attributes) => [
            'status' => ContactStatus::Converted,
        ]);
    }

    /**
     * Indicate that the submission has been archived.
     */
    public function archived(): static
    {
        return $this->state(fn (array $attributes) => [
            'status' => ContactStatus::Archived,
        ]);
    }
}
