<?php

namespace App\Http\Requests\Scores;

use App\Http\Requests\ApiFormRequest;

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

    public function validationData(): array
    {
        $request = request();
        $data = $request->query->all();

        $json = json_decode($request->getContent() ?: '', true);
        if (is_array($json)) {
            $data = array_merge($data, $json);
        }

        return array_merge($data, $request->request->all());
    }

    public function rules(): array
    {
        return [
            'class_section_id' => ['nullable', 'integer', 'min:1'],
            'semester' => ['nullable', 'string', 'max:50'],
            'school_year' => ['nullable', 'string', 'max:50'],
        ];
    }
}
