<?php

namespace App\Http\Requests\Admin\Services\LetterRequest;

use App\Enums\LetterStatus;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class LetterRequestStatusRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()->can('update-letter-requests-status');
    }

    public function rules(): array
    {
        return [
            'status' => ['nullable', 'required_without:result', Rule::enum(LetterStatus::class)],
            'result' => ['nullable', 'file', 'max:10240', 'mimes:pdf,jpg,jpeg,png,doc,docx'],
        ];
    }
}
