<?php

namespace App\Http\Requests\Attendance;

use Illuminate\Foundation\Http\FormRequest;

class TeacherSubmitAttendanceRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'class_section_id' => ['required'],
            'class_id' => ['nullable', 'integer'],
            'date' => ['nullable', 'date'],
            'attendance' => ['required', 'array', 'min:1'],
            'attendance.*.student_id' => ['required', 'integer'],
            'attendance.*.school_id' => ['nullable', 'string'],
            'attendance.*.status' => ['required', 'in:present,absent,late'],
            'attendance.*.reason' => ['nullable', 'string'],
            'attendance.*.is_reported' => ['nullable'],
            'teachers' => ['required', 'array', 'min:1'],
        ];
    }
}