openapi: 3.0.0
info:
  title: Gabriella GIS API
  description: >
    Public API for geocoding and system health checks for Gabriella GIS.
    **Deprecation Policy**: All deprecations will be announced via the
    `Deprecation` and `Sunset` HTTP headers at least 6 months before endpoint
    removal.
  version: 1.0.0
servers:
  - url: https://www.gabriellagis.com
    description: Production server
paths:
  /api/v1/cnefe/geocode:
    post:
      operationId: geocodeAddressesV1
      summary: Geocode a list of Brazilian addresses using CNEFE data.
      description: >-
        Accepts a list of address strings and returns their estimated
        coordinates.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - addresses
              properties:
                addresses:
                  type: array
                  items:
                    type: string
                  description: Array of address strings to geocode.
      responses:
        '200':
          description: Successful geocoding results
          content:
            application/json:
              schema:
                type: object
                required:
                  - results
                properties:
                  results:
                    type: array
                    items:
                      type: object
                      required:
                        - address
                        - lat
                        - lon
                      properties:
                        address:
                          type: string
                        lat:
                          type: number
                        lon:
                          type: number
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /api/v1/health:
    get:
      operationId: checkSystemHealthV1
      summary: Get the health status of the API server.
      description: Returns JSON containing uptime, redis connection status, and version.
      responses:
        '200':
          description: Server is healthy
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - time
                  - uptime
                  - redis
                  - version
                properties:
                  status:
                    type: string
                  time:
                    type: integer
                  uptime:
                    type: number
                  redis:
                    type: string
                  version:
                    type: string
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: integer
              description: HTTP status code or specific error code.
            message:
              type: string
              description: Human-readable error message.
