{
  "openapi": "3.1.0",
  "info": {
    "title": "API de geocodificación",
    "version": "v0",
    "description": "Sandbox de HanoIT. Todas las respuestas son simuladas."
  },
  "servers": [
    {
      "url": "/",
      "description": "Sandbox"
    }
  ],
  "paths": {
    "/api/v1/geocoding": {
      "post": {
        "tags": [
          "Geocodificación"
        ],
        "summary": "Geocodificación directa",
        "operationId": "forward",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForwardRequest"
              },
              "example": {
                "address": "Carrera 7 # 11-10",
                "city": "Bogotá",
                "country": "Colombia"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeocodeFeature"
                },
                "example": {
                  "type": "Feature",
                  "geometry": {
                    "type": "Point",
                    "coordinates": [
                      -74.0759,
                      4.5981
                    ]
                  },
                  "properties": {
                    "address": "Carrera 7 # 11-10",
                    "city": "Bogotá",
                    "country": "Colombia",
                    "standardizedAddress": "Carrera 7 # 11-10, Bogotá, Colombia",
                    "geocodingScore": 98.5,
                    "geocodingStatus": "MATCHED"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Petición inválida en el sandbox",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "message": "Invalid geocoding request."
                }
              }
            }
          },
          "415": {
            "description": "Contenido distinto de application/json en el sandbox"
          },
          "413": {
            "description": "El cuerpo supera el límite del sandbox"
          },
          "404": {
            "description": "Sin coincidencias en los datos de prueba del sandbox",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "message": "No match in sandbox data."
                }
              }
            }
          },
          "429": {
            "description": "Límite de solicitudes simulado",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "message": "Simulated rate limit exceeded."
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Tiempo de espera en segundos",
                "schema": {
                  "type": "integer"
                },
                "example": 5
              }
            }
          },
          "503": {
            "description": "Indisponibilidad temporal simulada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "message": "Simulated service unavailable."
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "X-Sandbox-Scenario",
            "description": "Simula un límite de solicitudes o una indisponibilidad temporal. Omite el encabezado para validar la entrada normalmente.",
            "schema": {
              "type": "string",
              "enum": [
                "rate-limit",
                "unavailable"
              ]
            }
          }
        ]
      }
    },
    "/api/v1/reverse-geocoding": {
      "post": {
        "tags": [
          "Geocodificación"
        ],
        "summary": "Geocodificación inversa",
        "operationId": "reverse",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReverseRequest"
              },
              "example": {
                "location": {
                  "type": "Point",
                  "coordinates": [
                    -74.0759,
                    4.5981
                  ]
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeocodeFeature"
                },
                "example": {
                  "type": "Feature",
                  "geometry": {
                    "type": "Point",
                    "coordinates": [
                      -74.0759,
                      4.5981
                    ]
                  },
                  "properties": {
                    "address": "Carrera 7 # 11-10",
                    "city": "Bogotá",
                    "country": "Colombia",
                    "standardizedAddress": "Carrera 7 # 11-10, Bogotá, Colombia",
                    "geocodingScore": 98.5,
                    "geocodingStatus": "MATCHED"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Petición inválida en el sandbox",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "message": "Invalid geocoding request."
                }
              }
            }
          },
          "415": {
            "description": "Contenido distinto de application/json en el sandbox"
          },
          "413": {
            "description": "El cuerpo supera el límite del sandbox"
          },
          "404": {
            "description": "Sin coincidencias en los datos de prueba del sandbox",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "message": "No match in sandbox data."
                }
              }
            }
          },
          "429": {
            "description": "Límite de solicitudes simulado",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "message": "Simulated rate limit exceeded."
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Tiempo de espera en segundos",
                "schema": {
                  "type": "integer"
                },
                "example": 5
              }
            }
          },
          "503": {
            "description": "Indisponibilidad temporal simulada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "message": "Simulated service unavailable."
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "X-Sandbox-Scenario",
            "description": "Simula un límite de solicitudes o una indisponibilidad temporal. Omite el encabezado para validar la entrada normalmente.",
            "schema": {
              "type": "string",
              "enum": [
                "rate-limit",
                "unavailable"
              ]
            }
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "Point": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "coordinates": {
            "type": "array",
            "items": {
              "type": "number",
              "format": "double"
            },
            "description": "Orden: [longitud, latitud]."
          }
        }
      },
      "ReverseRequest": {
        "type": "object",
        "properties": {
          "location": {
            "$ref": "#/components/schemas/Point"
          }
        }
      },
      "GeocodeFeature": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "geometry": {
            "$ref": "#/components/schemas/Point"
          },
          "properties": {
            "$ref": "#/components/schemas/Properties"
          }
        }
      },
      "Properties": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "standardizedAddress": {
            "type": "string"
          },
          "geocodingScore": {
            "type": "number",
            "format": "double"
          },
          "geocodingStatus": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "country": {
            "type": "string"
          }
        }
      },
      "ForwardRequest": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "country": {
            "type": "string"
          }
        }
      }
    }
  }
}
