openapi: 3.0.3

info:
  title: Accessibility GIS API (PostgREST)
  description: |
    OpenAPI specification για PostgREST API -
    PostgreSQL/PostGIS functions & views για
    Υποδομές Προσβασιμότητας Δήμων.
  version: "1.0.0"

servers:
  - url: http://localhost:3000
    description: PostgREST Local Server

components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: query
      name: a_key

security:
  - ApiKeyAuth: []

paths:

  # =========================================================
  # VIEWS μέσω FUNCTIONS
  # =========================================================

  /rpc/parking_vw_fnc:
    get:
      summary: Θέσεις στάθμευσης ΑμεΑ
      parameters:
        - name: a_key
          in: query
          required: true
          schema:
            type: string
        - name: p_dimos_id
          in: query
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Λίστα parking
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object

  /rpc/crossings_vw_fnc:
    get:
      summary: Διαβάσεις πεζών
      parameters:
        - name: a_key
          in: query
          required: true
          schema:
            type: string
        - name: c_dimos_id
          in: query
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Λίστα crossings
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object

  /rpc/pedestrian_ramps_vw_fnc:
    get:
      summary: Ράμπες πεζοδρομίου
      parameters:
        - name: a_key
          in: query
          required: true
          schema:
            type: string
        - name: r_dimos_id
          in: query
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Λίστα pedestrian ramps
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object

  /rpc/building_ramps_vw_fnc:
    get:
      summary: Ράμπες κτιρίων
      parameters:
        - name: a_key
          in: query
          required: true
          schema:
            type: string
        - name: b_dimos_id
          in: query
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Λίστα building ramps
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object

  # =========================================================
  # ΣΤΑΤΙΣΤΙΚΑ ΑΝΑ ΔΗΜΟ
  # =========================================================

  /rpc/parking_per_dimos_fnc:
    get:
      summary: Στατιστικά parking ανά Δήμο
      parameters:
        - name: a_key
          in: query
          required: true
          schema:
            type: string
        - name: p_dimos_id
          in: query
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Parking count ανά Δήμο
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object

  /rpc/crossings_per_dimos_fnc:
    get:
      summary: Στατιστικά crossings ανά Δήμο
      parameters:
        - name: a_key
          in: query
          required: true
          schema:
            type: string
        - name: c_dimos_id
          in: query
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Crossings count ανά Δήμο
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object

  /rpc/pedestrian_ramps_per_dimos_fnc:
    get:
      summary: Στατιστικά ραμπών πεζοδρομίου
      parameters:
        - name: a_key
          in: query
          required: true
          schema:
            type: string
        - name: r_dimos_id
          in: query
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Pedestrian ramps count
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object

  /rpc/building_ramps_per_dimos_fnc:
    get:
      summary: Στατιστικά ραμπών κτιρίων
      parameters:
        - name: a_key
          in: query
          required: true
          schema:
            type: string
        - name: b_dimos_id
          in: query
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Building ramps count
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object

  # =========================================================
  # ΧΩΡΙΚΕΣ ΑΝΑΖΗΤΗΣΕΙΣ
  # =========================================================

  /rpc/parking_near_point:
    get:
      summary: Parking κοντά σε σημείο
      parameters:
        - name: lon
          in: query
          required: true
          schema: { type: number, format: double }
        - name: lat
          in: query
          required: true
          schema: { type: number, format: double }
        - name: max_distance
          in: query
          required: true
          schema: { type: number }
        - name: a_key
          in: query
          required: true
          schema: { type: string }
        - name: ftype
          in: query
          required: false
          schema:
            type: string
            enum: [geojson, kml, csv]
            default: geojson
      responses:
        '200':
          description: GeoJSON / KML / CSV
          content:
            application/json:
              schema: { type: object }
            text/plain:
              schema: { type: string }

  /rpc/crossings_near_point:
    get:
      summary: Διαβάσεις κοντά σε σημείο
      parameters:
        - name: lon
          in: query
          required: true
          schema: { type: number }
        - name: lat
          in: query
          required: true
          schema: { type: number }
        - name: max_distance
          in: query
          required: true
          schema: { type: number }
        - name: a_key
          in: query
          required: true
          schema: { type: string }
        - name: ftype
          in: query
          required: false
          schema:
            type: string
            enum: [geojson, kml, csv]
      responses:
        '200':
          description: Geo output
          content:
            application/json:
              schema: { type: object }
            text/plain:
              schema: { type: string }

  /rpc/pedestrian_ramps_near_point:
    get:
      summary: Ράμπες πεζοδρομίου κοντά σε σημείο
      parameters:
        - name: lon
          in: query
          required: true
          schema: { type: number }
        - name: lat
          in: query
          required: true
          schema: { type: number }
        - name: max_distance
          in: query
          required: true
          schema: { type: number }
        - name: a_key
          in: query
          required: true
          schema: { type: string }
        - name: ftype
          in: query
          schema:
            type: string
            enum: [geojson, kml, csv]
      responses:
        '200':
          description: Geo output
          content:
            application/json:
              schema: { type: object }
            text/plain:
              schema: { type: string }

  /rpc/building_ramps_near_point:
    get:
      summary: Ράμπες κτιρίων κοντά σε σημείο
      parameters:
        - name: lon
          in: query
          required: true
          schema: { type: number }
        - name: lat
          in: query
          required: true
          schema: { type: number }
        - name: max_distance
          in: query
          required: true
          schema: { type: number }
        - name: a_key
          in: query
          required: true
          schema: { type: string }
        - name: ftype
          in: query
          schema:
            type: string
            enum: [geojson, kml, csv]
      responses:
        '200':
          description: Geo output
          content:
            application/json:
              schema: { type: object }
            text/plain:
              schema: { type: string }
