<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class BulkEmployeeRegistrationUploadRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true; // Authorization handled by middleware
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'csv_file' => [
                'required',
                'file',
                'mimes:csv,txt',
                'max:10240', // 10MB
            ],
            'send_invitations' => ['nullable', 'boolean'],
        ];
    }

    /**
     * Get custom messages for validator errors.
     *
     * @return array<string, string>
     */
    public function messages(): array
    {
        return [
            'csv_file.required' => 'CSV file is required.',
            'csv_file.file' => 'CSV file must be a valid file.',
            'csv_file.mimes' => 'File must be a CSV file.',
            'csv_file.max' => 'CSV file size must not exceed 10MB.',
            'send_invitations.boolean' => 'Send invitations must be a boolean value.',
        ];
    }
}
