<?php

namespace App\Rules;

use Illuminate\Validation\Rule;

class TransporteRules
{
    public static function rules(bool $isUpdate = false, $id = null): array
    {
        $identificacionRules = $isUpdate
            ? ['required', 'string', 'max:100', Rule::unique('transportes', 'identificacion')->ignore($id)]
            : ['required', 'string', 'max:100', 'unique:transportes,identificacion'];

        return [
            'tipo' => ['required', 'string', 'max:50', Rule::in(['Lancha', 'Camion', 'Moto', 'Camioneta', 'Furgon', 'Otro'])],
            'identificacion' => $identificacionRules,
            'conductor' => ['required', 'string', 'max:150'],
            'estado' => ['required', 'string', 'max:20', Rule::in(['Activo', 'Inactivo'])],
            'observaciones' => ['nullable', 'string', 'max:1000'],
        ];
    }
}