<?php

namespace Webkul\Support\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Webkul\Support\Models\EmailTemplate;

/**
 * @extends Factory<EmailTemplate>
 */
class EmailTemplateFactory extends Factory
{
    protected $model = EmailTemplate::class;

    public function definition(): array
    {
        return [
            'code'        => fake()->unique()->slug(),
            'name'        => fake()->words(3, true),
            'subject'     => fake()->sentence(),
            'content'     => fake()->paragraphs(3, true),
            'description' => fake()->optional()->sentence(),
            'is_active'   => true,
            'sender_name' => fake()->optional()->name(),
        ];
    }

    public function inactive(): static
    {
        return $this->state(fn (array $attributes) => [
            'is_active' => false,
        ]);
    }
}
