<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Attendance\Attendance;
use Carbon\Carbon;

class AttendanceSeeder extends Seeder
{
    public function run(): void
    {
        $branchId = 1; // adjust if needed

        $startDate = Carbon::now()->subDays(30);
        $endDate   = Carbon::now()->subDay(); // yesterday

        for ($date = $startDate; $date->lte($endDate); $date->addDay()) {

            Attendance::firstOrCreate([
                'branch_id' => $branchId,
                'attendance_date' => $date->toDateString(),
            ], [
                'is_processed' => false,
                'is_recalculated' => false,
            ]);
        }
    }
}
