<?php

namespace Modules\Employee\Http\Requests\Employee;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Modules\Core\Enums\StatusEnum;
use Modules\Core\Traits\FailedValidation;

class UpdateEmpAttachmentRequest extends FormRequest
{
    use FailedValidation;

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'attachments' => ['nullable', 'array'],

            'attachments.*.id' => ['nullable', 'exists:attachments,id'],

            'attachments.*.file_name' => ['required', 'string', 'max:255'],
            'attachments.*.file' => ['nullable', 'file', 'mimes:jpg,jpeg,png,pdf', 'max:2048'],

            'attachments.*.is_visible' => ['boolean'],
        ];
    }


    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }
}
