<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Domain>
 */
class DomainFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $domain = $this->faker->unique()->domainName();
        $startDate = $this->faker->optional()->dateTimeBetween('-6 months', 'now');
        $endDate = $startDate ?
            $this->faker->optional()->dateTimeBetween($startDate, '+1 year') :
            $this->faker->optional()->dateTimeBetween('now', '+1 year');

        return [
            'name' => $domain,
            'is_active' => true,
            'daily_mailbox_limit' => $this->faker->numberBetween(50, 500),
            'domain_type' => $this->faker->randomElement(['disposable', 'temporary', 'custom']),
            'provider_type' => $this->faker->randomElement(['internal', 'external', 'partner']),
            'starts_at' => $startDate,
            'ends_at' => $endDate,
            'last_used_at' => $this->faker->optional()->dateTimeBetween('-1 month', 'now'),
            'checked_at' => $this->faker->optional()->dateTimeBetween('-1 week', 'now'),
        ];
    }
}
