<?php

namespace App\Http\Requests\Recruitment;

use App\Domain\Recruitment\Enums\EmployerStatus;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

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

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