<?php

namespace App\Http\Requests\Recruitment;

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

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

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