<?php

namespace App\Rules;

use Illuminate\Validation\Rule;

class TallaUniformeRules
{
    public static function rules(bool $isUpdate = false, $id = null): array
    {
        $uniqueCedulaUsuario = $isUpdate
            ? [
                'required', 'string', 'max:20', 'exists:users,cedula', Rule::unique('talla_uniformes', 'cedula_usuario')->ignore($id)
            ]
            : [
                'required', 'string', 'max:20', 'exists:users,cedula', 'unique:talla_uniformes,cedula_usuario'
            ];
        return [
            'cedula_usuario' => $uniqueCedulaUsuario,
            'tallaCamisa' => ['required', 'integer', Rule::in(range(30, 45))],
            'tallaChaqueta' => ['required', 'integer', Rule::in(range(30, 45))],
            'tallaPantalon' => ['required', 'integer', Rule::in(range(30, 45))],
            'tallaBotas' => ['required', 'integer', Rule::in(range(30, 45))],
            'tallaZapatos' => ['required', 'integer', Rule::in(range(30, 45))],
        ];
    }
}
