<?php

namespace App\Http\Requests;

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

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

    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', Rule::unique('users')],
            'phone' => ['nullable', 'string', 'max:20', Rule::unique('users')],
            'role_id' => ['required', 'integer', Rule::exists('roles', 'id')],
            'branch_id' => ['nullable', 'integer', Rule::exists('branches', 'id')],
            'pin' => ['required', 'string', 'min:4', 'max:8'],
            'password' => ['nullable', 'string', 'min:8'],
            'is_active' => ['boolean'],
        ];
    }
}
