<?php

namespace App\Http\Requests\Classes;

use App\Http\Requests\ApiFormRequest;
use Illuminate\Validation\Rule;

class ClassSectionStoreRequest extends ApiFormRequest
{
    public function authorize(): bool
    {
        return $this->user() !== null;
    }

    public function rules(): array
    {
        return [
            'class_id' => ['required', 'integer', 'min:1'],
            'class_section_id' => ['required', 'integer', 'min:1', Rule::unique('classSection', 'class_section_id')],
            'class_section_name' => ['required', 'string', 'max:100'],
            'semester' => ['required', 'string', 'max:255'],
            'school_year' => ['required', 'string', 'max:9'],
        ];
    }
}
