<?php

namespace Modules\Mailgateway\Models;

use Modules\Mailgateway\Types\Type;
use Modules\Mailgateway\Types\LocalType;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<Mailgateway>
 */
class MailgatewayFactory extends Factory
{
    protected $model = Mailgateway::class;

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition()
    {
        return [
            'name' => $this->faker->words(5, true),
            'type' => new LocalType(),
            'domain' => $this->faker->safeEmailDomain(),
        ];
    }

    public function type(Type $type): self
    {
        return $this->state(['type' => $type]);
    }

    public function name(string $name): self
    {
        return $this->state(['name' => $name]);
    }

    public function domain(string $domain): self
    {
        return $this->state(['domain' => $domain]);
    }
}