<?php

namespace App\Http\Requests\Portal;

use Illuminate\Foundation\Http\FormRequest;

class UpdateStaffRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        $staffId = $this->route('staff')->id;

        return [
            'name' => 'required|string|max:255',
            'email' => 'required|email|unique:users,email,'.$staffId,
            'phone_number' => 'nullable|string|max:20',
            'role' => 'required|in:waiter,biller,kitchen',
            'password' => 'nullable|string|min:8|confirmed',
        ];
    }
}
