{"openapi":"3.0.0","info":{"title":"API de Reserva de Canchas de Fútbol","description":"Sistema para gestionar reservas de canchas deportivas","version":"1.0.0","contact":{"name":"Edgar Suarez","email":"edgar.suarez@uees.edu.ec"}},"servers":[{"url":"https://api.reservacanchas.com/v1","description":"Servidor de Producción"},{"url":"https://api-dev.reservacanchas.com/v1","description":"Servidor de Desarrollo"}],"tags":[{"name":"Canchas","description":"Operaciones relacionadas con las canchas"},{"name":"Reservas","description":"Operaciones relacionadas con las reservas"},{"name":"Pagos","description":"Operaciones relacionadas con los pagos"}],"paths":{"/canchas":{"get":{"tags":["Canchas"],"summary":"Consultar todas las canchas disponibles","description":"Obtiene la lista de todas las canchas del complejo deportivo","operationId":"consultarCanchas","responses":{"200":{"description":"Lista de canchas obtenida exitosamente","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":1},"nombre":{"type":"string","example":"Cancha Principal"},"tipo":{"type":"string","example":"Fútbol 11","enum":["Fútbol 5","Fútbol 7","Fútbol 11"]},"estado":{"type":"string","example":"disponible","enum":["disponible","ocupada","mantenimiento"]},"precioPorHora":{"type":"number","format":"float","example":50.0}}}}}}}}},"500":{"description":"Error interno del servidor","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Error al obtener las canchas"}}}}}}}}},"/canchas/tipo/{tipo}":{"get":{"tags":["Canchas"],"summary":"Consultar canchas por tipo","description":"Obtiene las canchas filtradas por tipo (Fútbol 5, 7 u 11)","operationId":"consultarCanchasPorTipo","parameters":[{"name":"tipo","in":"path","required":true,"description":"Tipo de cancha a consultar","schema":{"type":"string","enum":["Fútbol 5","Fútbol 7","Fútbol 11"]},"example":"Fútbol 7"}],"responses":{"200":{"description":"Canchas filtradas por tipo obtenidas exitosamente","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":2},"nombre":{"type":"string","example":"Cancha Norte"},"tipo":{"type":"string","example":"Fútbol 7"},"estado":{"type":"string","example":"disponible"},"precioPorHora":{"type":"number","format":"float","example":35.0}}}}}}}}},"400":{"description":"Tipo de cancha inválido","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Tipo de cancha no válido"}}}}}},"404":{"description":"No se encontraron canchas del tipo especificado","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"No hay canchas disponibles de tipo Fútbol 7"}}}}}},"500":{"description":"Error interno del servidor","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Error al consultar las canchas"}}}}}}}}},"/canchas/{id}/horarios":{"get":{"tags":["Canchas"],"summary":"Consultar horarios disponibles de una cancha","description":"Obtiene los horarios disponibles de una cancha específica para una fecha determinada","operationId":"consultarHorariosDisponibles","parameters":[{"name":"id","in":"path","required":true,"description":"ID de la cancha","schema":{"type":"integer"},"example":1},{"name":"fecha","in":"query","required":true,"description":"Fecha para consultar disponibilidad (formato YYYY-MM-DD)","schema":{"type":"string","format":"date"},"example":"2026-04-15"}],"responses":{"200":{"description":"Horarios disponibles obtenidos exitosamente","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"canchaId":{"type":"integer","example":1},"nombreCancha":{"type":"string","example":"Cancha Principal"},"fecha":{"type":"string","format":"date","example":"2026-04-15"},"horariosDisponibles":{"type":"array","items":{"type":"object","properties":{"horaInicio":{"type":"string","example":"08:00"},"horaFin":{"type":"string","example":"09:00"},"disponible":{"type":"boolean","example":true},"precio":{"type":"number","format":"float","example":50.0}}}}}}}}}}},"400":{"description":"Parámetros inválidos","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Formato de fecha inválido"}}}}}},"404":{"description":"Cancha no encontrada","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Cancha no encontrada"}}}}}},"500":{"description":"Error interno del servidor","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Error al consultar horarios"}}}}}}}}},"/reservas":{"post":{"tags":["Reservas"],"summary":"Crear una nueva reserva","description":"Crea una reserva para una cancha en un horario específico","operationId":"crearReserva","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["canchaId","fecha","horaInicio","horaFin","clienteId"],"properties":{"canchaId":{"type":"integer","example":1},"fecha":{"type":"string","format":"date","example":"2026-04-15"},"horaInicio":{"type":"string","example":"10:00"},"horaFin":{"type":"string","example":"11:00"},"clienteId":{"type":"integer","example":101},"observaciones":{"type":"string","example":"Necesito balón incluido"}}}}}},"responses":{"201":{"description":"Reserva creada exitosamente","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"Reserva creada exitosamente"},"data":{"type":"object","properties":{"reservaId":{"type":"integer","example":501},"canchaId":{"type":"integer","example":1},"nombreCancha":{"type":"string","example":"Cancha Principal"},"fecha":{"type":"string","format":"date","example":"2026-04-15"},"horaInicio":{"type":"string","example":"10:00"},"horaFin":{"type":"string","example":"11:00"},"estado":{"type":"string","example":"pendiente_pago"},"total":{"type":"number","format":"float","example":50.0},"fechaCreacion":{"type":"string","format":"date-time","example":"2026-04-10T14:30:00Z"}}}}}}}},"400":{"description":"Datos inválidos o incompletos","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Datos incompletos o inválidos"}}}}}},"409":{"description":"Conflicto - Horario no disponible","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"El horario seleccionado ya está reservado"}}}}}},"500":{"description":"Error interno del servidor","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Error al crear la reserva"}}}}}}}}},"/reservas/cliente/{clienteId}":{"get":{"tags":["Reservas"],"summary":"Consultar reservas de un cliente","description":"Obtiene todas las reservas asociadas a un cliente específico","operationId":"consultarMisReservas","parameters":[{"name":"clienteId","in":"path","required":true,"description":"ID del cliente","schema":{"type":"integer"},"example":101},{"name":"estado","in":"query","required":false,"description":"Filtrar por estado de la reserva","schema":{"type":"string","enum":["pendiente_pago","confirmada","completada","cancelada"]},"example":"confirmada"}],"responses":{"200":{"description":"Reservas del cliente obtenidas exitosamente","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"type":"object","properties":{"reservaId":{"type":"integer","example":501},"canchaId":{"type":"integer","example":1},"nombreCancha":{"type":"string","example":"Cancha Principal"},"fecha":{"type":"string","format":"date","example":"2026-04-15"},"horaInicio":{"type":"string","example":"10:00"},"horaFin":{"type":"string","example":"11:00"},"estado":{"type":"string","example":"confirmada"},"total":{"type":"number","format":"float","example":50.0},"fechaCreacion":{"type":"string","format":"date-time","example":"2026-04-10T14:30:00Z"}}}}}}}}},"404":{"description":"Cliente no encontrado","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Cliente no encontrado"}}}}}},"500":{"description":"Error interno del servidor","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Error al consultar reservas"}}}}}}}}},"/reservas/{id}":{"put":{"tags":["Reservas"],"summary":"Modificar una reserva existente","description":"Permite modificar la fecha u horario de una reserva existente","operationId":"modificarReserva","parameters":[{"name":"id","in":"path","required":true,"description":"ID de la reserva a modificar","schema":{"type":"integer"},"example":501}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fecha":{"type":"string","format":"date","example":"2026-04-16"},"horaInicio":{"type":"string","example":"14:00"},"horaFin":{"type":"string","example":"15:00"},"observaciones":{"type":"string","example":"Cambio de horario solicitado"}}}}}},"responses":{"200":{"description":"Reserva modificada exitosamente","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"Reserva modificada exitosamente"},"data":{"type":"object","properties":{"reservaId":{"type":"integer","example":501},"canchaId":{"type":"integer","example":1},"nombreCancha":{"type":"string","example":"Cancha Principal"},"fecha":{"type":"string","format":"date","example":"2026-04-16"},"horaInicio":{"type":"string","example":"14:00"},"horaFin":{"type":"string","example":"15:00"},"estado":{"type":"string","example":"confirmada"},"total":{"type":"number","format":"float","example":50.0}}}}}}}},"400":{"description":"Datos inválidos","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Datos inválidos para modificar la reserva"}}}}}},"404":{"description":"Reserva no encontrada","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Reserva no encontrada"}}}}}},"409":{"description":"Conflicto - Nuevo horario no disponible","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"El nuevo horario no está disponible"}}}}}},"500":{"description":"Error interno del servidor","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Error al modificar la reserva"}}}}}}}},"delete":{"tags":["Reservas"],"summary":"Cancelar una reserva","description":"Cancela una reserva existente","operationId":"cancelarReserva","parameters":[{"name":"id","in":"path","required":true,"description":"ID de la reserva a cancelar","schema":{"type":"integer"},"example":501}],"responses":{"200":{"description":"Reserva cancelada exitosamente","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"Reserva cancelada exitosamente"},"data":{"type":"object","properties":{"reservaId":{"type":"integer","example":501},"estado":{"type":"string","example":"cancelada"},"fechaCancelacion":{"type":"string","format":"date-time","example":"2026-04-11T10:15:00Z"}}}}}}}},"404":{"description":"Reserva no encontrada","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Reserva no encontrada"}}}}}},"409":{"description":"Conflicto - Reserva ya fue cancelada o completada","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"No se puede cancelar una reserva ya completada o cancelada"}}}}}},"500":{"description":"Error interno del servidor","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Error al cancelar la reserva"}}}}}}}}},"/pagos":{"post":{"tags":["Pagos"],"summary":"Procesar pago de una reserva","description":"Procesa el pago de una reserva y actualiza su estado a confirmada","operationId":"procesarPago","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reservaId","metodoPago","monto"],"properties":{"reservaId":{"type":"integer","example":501},"metodoPago":{"type":"string","enum":["efectivo","tarjeta_credito","tarjeta_debito","transferencia"],"example":"tarjeta_credito"},"monto":{"type":"number","format":"float","example":50.0},"datosTarjeta":{"type":"object","properties":{"numeroTarjeta":{"type":"string","example":"4111111111111111"},"nombreTitular":{"type":"string","example":"Edgar Suarez"},"fechaExpiracion":{"type":"string","example":"12/27"},"cvv":{"type":"string","example":"123"}}}}}}}},"responses":{"200":{"description":"Pago procesado exitosamente","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"Pago procesado exitosamente"},"data":{"type":"object","properties":{"pagoId":{"type":"integer","example":1001},"reservaId":{"type":"integer","example":501},"monto":{"type":"number","format":"float","example":50.0},"metodoPago":{"type":"string","example":"tarjeta_credito"},"estadoPago":{"type":"string","example":"aprobado"},"fechaPago":{"type":"string","format":"date-time","example":"2026-04-11T15:30:00Z"},"numeroTransaccion":{"type":"string","example":"TXN-20240411-1001"}}}}}}}},"400":{"description":"Datos de pago inválidos","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Datos de pago incompletos o inválidos"}}}}}},"402":{"description":"Pago rechazado","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Pago rechazado por la entidad bancaria"}}}}}},"404":{"description":"Reserva no encontrada","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Reserva no encontrada"}}}}}},"409":{"description":"Conflicto - Reserva ya pagada","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"La reserva ya fue pagada anteriormente"}}}}}},"500":{"description":"Error interno del servidor","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Error al procesar el pago"}}}}}}}}},"/pagos/{reservaId}":{"get":{"tags":["Pagos"],"summary":"Consultar estado de pago de una reserva","description":"Obtiene el estado y detalles del pago asociado a una reserva","operationId":"consultarEstadoPago","parameters":[{"name":"reservaId","in":"path","required":true,"description":"ID de la reserva","schema":{"type":"integer"},"example":501}],"responses":{"200":{"description":"Estado de pago obtenido exitosamente","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"pagoId":{"type":"integer","example":1001},"reservaId":{"type":"integer","example":501},"monto":{"type":"number","format":"float","example":50.0},"metodoPago":{"type":"string","example":"tarjeta_credito"},"estadoPago":{"type":"string","enum":["pendiente","aprobado","rechazado","reembolsado"],"example":"aprobado"},"fechaPago":{"type":"string","format":"date-time","example":"2026-04-11T15:30:00Z"},"numeroTransaccion":{"type":"string","example":"TXN-20240411-1001"}}}}}}}},"404":{"description":"No se encontró pago para esta reserva","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"No se encontró información de pago para esta reserva"}}}}}},"500":{"description":"Error interno del servidor","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"message":{"type":"string","example":"Error al consultar el estado del pago"}}}}}}}}}}}