<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UploadAdminDocumentRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'name'        => ['required', 'string', 'max:255'],
            'description' => ['nullable', 'string', 'max:1000'],
            'file'        => [
                'required',
                'file',
                'max:51200', // 50 MB
                'mimes:pdf,doc,docx,xls,xlsx,csv,txt,jpg,jpeg,png,gif,webp,zip',
            ],
        ];
    }

    public function messages(): array
    {
        return [
            'file.max'   => 'The file must not exceed 50MB.',
            'file.mimes' => 'Allowed file types: PDF, Word, Excel, CSV, TXT, images (JPG, PNG, GIF, WebP), ZIP.',
        ];
    }
}
