{"openapi":"3.0.3","info":{"title":"API de Empleados","description":"API RESTful para la gestión de empleados. \n**Reglas de negocio integradas:**\n* El backend calcula la edad dinámicamente a partir de la `fechaNacimiento`.\n* La `fechaAlta` se asigna automáticamente por el servidor al momento de la creación.\n","version":"1.0.0"},"servers":[{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/chakray-e6b/basicCrud/1.0.0"},{"url":"/api/v1","description":"Servidor Local"}],"paths":{"/empleados":{"get":{"summary":"Obtener todos los empleados","operationId":"getEmpleados","responses":{"200":{"description":"Lista de empleados obtenida con éxito","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EmpleadoResponse"}}}}},"500":{"$ref":"#/components/responses/InternalServerError"}}},"post":{"summary":"Crear un nuevo empleado","operationId":"createEmpleado","requestBody":{"description":"Datos requeridos para registrar un empleado. (No incluir ID ni fechaAlta).","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmpleadoRequest"}}}},"responses":{"201":{"description":"Empleado creado exitosamente","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmpleadoResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/empleados/{id}":{"get":{"summary":"Obtener un empleado por su ID","operationId":"getEmpleadoById","parameters":[{"$ref":"#/components/parameters/EmpleadoId"}],"responses":{"200":{"description":"Empleado encontrado con éxito","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmpleadoResponse"}}}},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"put":{"summary":"Actualizar un empleado existente","operationId":"updateEmpleado","parameters":[{"$ref":"#/components/parameters/EmpleadoId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmpleadoRequest"}}}},"responses":{"200":{"description":"Empleado actualizado exitosamente","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmpleadoResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"delete":{"summary":"Eliminar un empleado por su ID","operationId":"deleteEmpleado","parameters":[{"$ref":"#/components/parameters/EmpleadoId"}],"responses":{"204":{"description":"Empleado eliminado exitosamente (sin contenido en la respuesta)"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"parameters":{"EmpleadoId":{"name":"id","in":"path","required":true,"description":"ID único y numérico del empleado en el sistema.","schema":{"type":"integer","format":"int64","example":1042}}},"schemas":{"EmpleadoRequest":{"type":"object","required":["nombre","puesto","fechaNacimiento"],"properties":{"nombre":{"type":"string","maxLength":50,"example":"Ana López"},"puesto":{"type":"string","maxLength":50,"example":"Ingeniera de Software"},"fechaNacimiento":{"type":"string","format":"date","example":"1992-08-15","description":"Formato ISO YYYY-MM-DD."}}},"EmpleadoResponse":{"type":"object","properties":{"id":{"type":"integer","format":"int64","example":1042},"nombre":{"type":"string","example":"Ana López"},"puesto":{"type":"string","example":"Ingeniera de Software"},"fechaNacimiento":{"type":"string","format":"date","example":"1992-08-15"},"edad":{"type":"integer","example":33,"description":"Calculado dinámicamente por el backend."},"fechaAlta":{"type":"string","format":"date","example":"2026-06-23","description":"Generado automáticamente por el backend."}}}},"responses":{"BadRequest":{"description":"Error de validación en la estructura o datos enviados (Ej. longitud excedida, campos nulos).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Bad Request"},"message":{"type":"string","example":"El campo 'nombre' no puede superar los 50 caracteres."}}}}}},"NotFound":{"description":"El recurso solicitado (empleado) no existe en el sistema.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Not Found"},"message":{"type":"string","example":"No se encontró el empleado con el ID provisto."}}}}}},"InternalServerError":{"description":"Error interno del servidor.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Internal Server Error"},"message":{"type":"string","example":"Ocurrió un error inesperado. Por favor contacte a soporte."}}}}}}}}}