<?php

namespace App\Http\Requests\Incidents;

use App\Http\Requests\ApiFormRequest;

class IncidentStoreRequest extends ApiFormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        $incidentTypes = [
            'payment',
            'attendance',
            'grade',
            'behavior',
            'talking_off_task',
            'calling_out',
            'minor_disruption',
            'minor_dress_code',
            'forgetting_materials',
            'repeated_defiance',
            'disrespectful_tone',
            'minor_profanity',
            'repeated_tardiness',
            'device_misuse',
            'minor_conflict',
            'bullying_harassment',
            'fighting_aggression',
            'threats',
            'theft',
            'vandalism',
            'sexual_harassment',
            'serious_cyber_incident',
            'contraband',
            'weapons_drugs',
            'other',
        ];

        return [
            'student_id' => ['required', 'integer', 'min:1', 'exists:students,id'],
            'grade' => ['required', 'string', 'max:50'],
            'incident' => ['required', 'string', 'in:' . implode(',', $incidentTypes)],
            'description' => ['required', 'string', 'max:2000'],
            'incident_state' => ['nullable', 'string', 'in:Open,Closed,Canceled'],
            'state_description' => ['nullable', 'string', 'max:2000'],
        ];
    }
}
