<?php

namespace Database\Factories;

use App\Models\Page;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/**
 * @extends Factory<Page>
 */
class PageFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $title = fake()->sentence();

        return [
            'title' => $title,
            'slug' => Str::slug($title),
            'content' => fake()->paragraphs(3, true),
            'parent' => fake()->optional()->randomElement(['home', 'about', 'contact']),
            'meta' => [
                'description' => fake()->sentence(),
                'keywords' => implode(',', fake()->words(5)),
            ],
            'custom_header' => fake()->optional()->sentence(),
            'page_image' => fake()->optional()->imageUrl(),
            'is_published' => fake()->boolean(80), // 80% chance of being published
            'created_at' => now(),
            'updated_at' => now(),
        ];
    }
}
