<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'max:255'],
            'machine_number' => ['nullable', 'string', 'max:20'],
            'cloud_id' => ['required', 'string', 'max:100'],
            'password' => ['nullable', 'string', 'max:50'],
            'personnel_target' => ['required', 'in:guru,siswa,both'],
        ];
    }

    public function messages(): array
    {
        return [
            'name.required' => 'Nama/Lokasi mesin fingerprint wajib diisi.',
            'cloud_id.required' => 'Cloud ID / SN wajib diisi.',
            'personnel_target.required' => 'Target push personil wajib dipilih.',
        ];
    }
}
