<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ParticipantImportRequest extends FormRequest
{
    public function authorize(): bool
    {
        return auth()->check();
    }

    public function rules(): array
    {
        return [
            'file' => ['required', 'file', 'mimes:xlsx,xls,csv', 'max:10240'],
            'fail_on_error' => ['boolean'],
        ];
    }

    public function messages(): array
    {
        return [
            'file.required' => 'Sila pilih fail untuk diimport.',
            'file.mimes' => 'Format fail mestilah .xlsx, .xls atau .csv.',
            'file.max' => 'Saiz fail tidak boleh melebihi 10MB.',
        ];
    }
}
