<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class UpdateWithdrawStatusRequest extends FormRequest
{
    public function authorize(): bool
    {
        return auth()->check();
    }

    protected function prepareForValidation(): void
    {
        $this->merge([
            'history_id' => $this->route('id'),
        ]);
    }

    public function rules(): array
    {
        return [
            'history_id' => ['required', 'integer', 'exists:withdrawhistory,id'],
            'status' => ['required', 'integer', Rule::in([1, 3])],
        ];
    }
}
