<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\AcademicYear;

class AcademicYearSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $academicYears = [
            [
                'name' => '2023/2024',
                'start_date' => '2023-07-01',
                'end_date' => '2024-06-30',
                'is_active' => false,
                'description' => 'Tahun Ajaran 2023/2024'
            ],
            [
                'name' => '2024/2025',
                'start_date' => '2024-07-01',
                'end_date' => '2025-06-30',
                'is_active' => false,
                'description' => 'Tahun Ajaran 2024/2025'
            ],
            [
                'name' => '2025/2026',
                'start_date' => '2025-07-01',
                'end_date' => '2026-06-30',
                'is_active' => true,
                'description' => 'Tahun Ajaran 2025/2026 (Aktif)'
            ],
            [
                'name' => '2026/2027',
                'start_date' => '2026-07-01',
                'end_date' => '2027-06-30',
                'is_active' => false,
                'description' => 'Tahun Ajaran 2026/2027'
            ],
        ];

        foreach ($academicYears as $year) {
            AcademicYear::updateOrCreate(
                ['name' => $year['name']],
                $year
            );
        }

        $this->command->info('Academic Years seeded successfully!');
    }
}
