<?php

namespace App\Http\Requests\Admin;

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

class UpdateWalletStatusRequest 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:wallethistory,id'],
            'status' => ['required', 'integer', Rule::in([1, 3])],
        ];
    }
}
