<?php

namespace Database\Factories;

use App\Models\Berita;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Berita>
 */
class BeritaFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $kategoris = ['Akademik', 'Non-Akademik', 'Kegiatan Sekolah', 'Pengumuman', 'Prestasi'];
        $statuses = ['draft', 'published'];
        
        return [
            'judul' => fake()->sentence(6),
            'kategori' => fake()->randomElement($kategoris),
            'ringkasan' => fake()->paragraph(2),
            'isi' => fake()->paragraphs(5, true),
            'gambar' => null, // Set to null for now, can be updated later
            'penulis' => fake()->name(),
            'status' => fake()->randomElement($statuses),
        ];
    }

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

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