{
    "openapi": "3.0.0",
    "info": {
        "title": "API de Canchas Deportivas",
        "description": "API para la gestión de canchas deportivas, reservas y eventos",
        "contact": {
            "name": "Soporte API",
            "email": "admin@example.com"
        },
        "license": {
            "name": "Apache 2.0",
            "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
        },
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "http://my-default-host.com",
            "description": "Servidor de desarrollo"
        }
    ],
    "paths": {
        "/api/auth/login": {
            "post": {
                "tags": [
                    "Autenticación"
                ],
                "summary": "Iniciar sesión",
                "description": "Inicia sesión y devuelve un token de autenticación",
                "operationId": "authLogin",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "email",
                                    "password"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "usuario@example.com"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "password123"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Login exitoso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Login exitoso"
                                        },
                                        "token": {
                                            "type": "string",
                                            "example": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
                                        },
                                        "user": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Credenciales inválidas",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Credenciales inválidas"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Error de validación",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Error de validación"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/auth/register": {
            "post": {
                "tags": [
                    "Autenticación"
                ],
                "summary": "Registrar nuevo usuario",
                "description": "Registra un nuevo usuario y devuelve un token de autenticación",
                "operationId": "authRegister",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name",
                                    "email",
                                    "password",
                                    "password_confirmation"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "example": "Juan Pérez"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "example": "usuario@example.com"
                                    },
                                    "password": {
                                        "type": "string",
                                        "format": "password",
                                        "example": "password123"
                                    },
                                    "password_confirmation": {
                                        "type": "string",
                                        "example": "password123"
                                    },
                                    "telefono": {
                                        "type": "string",
                                        "example": "123456789"
                                    },
                                    "fecha_nacimiento": {
                                        "type": "string",
                                        "format": "date",
                                        "example": "1990-01-01"
                                    },
                                    "genero": {
                                        "type": "string",
                                        "example": "M"
                                    },
                                    "tipo_documento": {
                                        "type": "string",
                                        "example": "DNI"
                                    },
                                    "numero_documento": {
                                        "type": "string",
                                        "example": "12345678"
                                    },
                                    "direccion": {
                                        "type": "string",
                                        "example": "Calle Principal 123"
                                    },
                                    "ciudad": {
                                        "type": "string",
                                        "example": "Lima"
                                    },
                                    "pais": {
                                        "type": "string",
                                        "example": "Perú"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Usuario registrado exitosamente",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Usuario registrado exitosamente"
                                        },
                                        "token": {
                                            "type": "string",
                                            "example": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
                                        },
                                        "user": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Error de validación",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Error de validación"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/canchas": {
            "get": {
                "tags": [
                    "Canchas"
                ],
                "summary": "Listar todas las canchas",
                "description": "Obtiene todas las canchas activas con filtros opcionales",
                "operationId": "getCanchas",
                "parameters": [
                    {
                        "name": "deporte",
                        "in": "query",
                        "description": "ID de la categoría de deporte",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "ciudad",
                        "in": "query",
                        "description": "Filtrar por ciudad",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "precio_min",
                        "in": "query",
                        "description": "Precio mínimo por hora",
                        "required": false,
                        "schema": {
                            "type": "number"
                        }
                    },
                    {
                        "name": "precio_max",
                        "in": "query",
                        "description": "Precio máximo por hora",
                        "required": false,
                        "schema": {
                            "type": "number"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Lista de canchas",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/Cancha"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "Cancha": {
                "required": [
                    "nombre",
                    "descripcion",
                    "direccion",
                    "ciudad",
                    "precio_por_hora",
                    "estado",
                    "user_id",
                    "categoria_id"
                ],
                "properties": {
                    "id": {
                        "type": "integer",
                        "format": "int64",
                        "example": 1
                    },
                    "nombre": {
                        "type": "string",
                        "example": "Cancha de Fútbol 5"
                    },
                    "descripcion": {
                        "type": "string",
                        "example": "Cancha de césped sintético con iluminación"
                    },
                    "direccion": {
                        "type": "string",
                        "example": "Av. Principal 123"
                    },
                    "ciudad": {
                        "type": "string",
                        "example": "Lima"
                    },
                    "precio_por_hora": {
                        "type": "number",
                        "format": "float",
                        "example": 50
                    },
                    "estado": {
                        "type": "string",
                        "enum": [
                            "activa",
                            "inactiva",
                            "mantenimiento"
                        ],
                        "example": "activa"
                    },
                    "user_id": {
                        "type": "integer",
                        "format": "int64",
                        "example": 1
                    },
                    "categoria_id": {
                        "type": "integer",
                        "format": "int64",
                        "example": 1
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "bearerFormat": "JWT",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Autenticación",
            "description": "API para autenticación de usuarios"
        },
        {
            "name": "Canchas",
            "description": "API para gestión de canchas deportivas"
        }
    ]
}