<?php

namespace App\Http\Requests\Applicants;

use App\Domain\Applicants\Enums\ApplicantStatus;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class ChangeApplicantStatusRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'status' => ['required', Rule::in(ApplicantStatus::values())],
            'reason' => ['nullable', 'string', 'max:1000'],
        ];
    }

    public function status(): ApplicantStatus
    {
        return ApplicantStatus::from($this->string('status')->toString());
    }
}
