<?php

namespace Modules\HR\Http\Requests\BiometricDevice;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Modules\Core\Enums\StatusEnum;
use Modules\Core\Traits\FailedValidation;

class StoreBiometricDeviceRequest extends FormRequest
{
    use FailedValidation;
    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'branch_id' => [
                'nullable',
                'integer',
            ],
            'name' => [
                'required',
                'string',
                'max:255',
                'unique:biometric_devices,name',
            ],
            'device_uid' => [
                'nullable',
                'string',
                'max:255',
            ],
            'ip_address' => [
                'nullable',
                'string',
                'max:255',
            ],
            'port' => [
                'nullable',
                'string',
                'max:255',
            ],
            'location' => [
                'nullable',
                'string',
                'max:255',
            ],
            'status' => [
                'required',
                'string',
                Rule::in(StatusEnum::casesAsArray()),
            ],
        ];
    }

    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }
}
