{
  "openapi": "3.0.3",
  "info": {
    "title": "KolayCharge Compat API",
    "version": "1.0.0",
    "description": "EV ↔ charger compatibility intelligence. Rate limit: 60 req/min.",
    "contact": {
      "url": "https://kolaycharge.com"
    },
    "license": {
      "name": "CC BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    }
  },
  "servers": [
    {
      "url": "/api/v1",
      "description": "Production"
    }
  ],
  "security": [],
  "paths": {
    "/vehicles/{slug}": {
      "get": {
        "operationId": "getVehicle",
        "summary": "Vehicle variant detail",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "tesla-model-y-2024-awd-eu"
          }
        ],
        "responses": {
          "200": {
            "description": "Vehicle detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VehicleDetail"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/vehicles/{slug}/compatibility": {
      "get": {
        "operationId": "getVehicleCompatibility",
        "summary": "Compatible chargers for a vehicle",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Compatible chargers list"
          },
          "404": {
            "description": "Vehicle not found"
          }
        }
      }
    },
    "/chargers/{slug}": {
      "get": {
        "operationId": "getCharger",
        "summary": "Charger model detail",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "abb-terra-360"
          }
        ],
        "responses": {
          "200": {
            "description": "Charger detail"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/chargers/{slug}/compatibility": {
      "get": {
        "operationId": "getChargerCompatibility",
        "summary": "Compatible vehicles for a charger",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Compatible vehicles list"
          },
          "404": {
            "description": "Charger not found"
          }
        }
      }
    },
    "/compatibility/{vehicleSlug}/{chargerSlug}": {
      "get": {
        "operationId": "getCompatibilityCell",
        "summary": "Single vehicle × charger compatibility edge",
        "parameters": [
          {
            "name": "vehicleSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "chargerSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "region",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "EU",
                "TR",
                "NA",
                "GB"
              ],
              "default": "EU"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Compatibility edge with provenance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompatCell"
                }
              }
            }
          },
          "404": {
            "description": "No edge found"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      },
      "VehicleDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "brand": {
            "type": "string"
          },
          "family": {
            "type": "string"
          },
          "trim": {
            "type": "string",
            "nullable": true
          },
          "model_year": {
            "type": "integer"
          },
          "max_dc_kw_oem": {
            "type": "number",
            "nullable": true
          },
          "max_ac_kw_oem": {
            "type": "number",
            "nullable": true
          },
          "battery_kwh_usable": {
            "type": "number",
            "nullable": true
          },
          "architecture_voltage_v": {
            "type": "integer",
            "nullable": true
          },
          "bidirectional": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CompatCell": {
        "type": "object",
        "properties": {
          "vehicle": {
            "type": "string"
          },
          "charger": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "kw": {
            "type": "number"
          },
          "state": {
            "type": "string",
            "enum": [
              "ok",
              "adp",
              "limited",
              "no",
              "unk"
            ]
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "protocols": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "adapterRequired": {
            "type": "boolean"
          },
          "edgeVersion": {
            "type": "integer"
          },
          "derivationVersion": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      }
    }
  }
}