{
  "openapi": "3.1.0",
  "info": {
    "title": "GrabJet Operator Integration API",
    "version": "draft-v1",
    "description": "Draft OpenAPI starter for sandbox onboarding. Official operator-specific schema is issued after onboarding approval."
  },
  "servers": [
    { "url": "http://localhost:8888" }
  ],
  "paths": {
    "/api/v1/integrations/operators/{operator_id}/aircraft": {
      "post": {
        "summary": "Submit aircraft update",
        "parameters": [
          { "name": "operator_id", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "X-API-Key", "in": "header", "required": true, "schema": { "type": "string" } },
          { "name": "Idempotency-Key", "in": "header", "required": true, "schema": { "type": "string" } },
          { "name": "X-GrabJet-Event", "in": "header", "required": true, "schema": { "type": "string", "example": "aircraft.updated" } }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/IntegrationEvent" }
            }
          }
        },
        "responses": {
          "200": { "description": "Accepted" },
          "202": { "description": "Accepted for staging/review" },
          "401": { "description": "Unauthorized" },
          "422": { "description": "Mapping or validation failed" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "IntegrationEvent": {
        "type": "object",
        "required": ["event_id", "event_type", "operator_reference", "occurred_at", "data"],
        "properties": {
          "event_id": { "type": "string" },
          "event_type": { "type": "string" },
          "operator_reference": { "type": "string" },
          "occurred_at": { "type": "string", "format": "date-time" },
          "data": { "type": "object", "additionalProperties": true }
        }
      }
    }
  }
}
