{
  "openapi": "3.1.1",
  "info": {
    "title": "HakiChain Public Discovery API",
    "version": "1.0.0",
    "description": "A machine-readable directory of public HakiChain resources. This API does not expose customer or legal-work data."
  },
  "servers": [{ "url": "https://hakichain.com" }],
  "paths": {
    "/api/v1/platform": {
      "get": {
        "operationId": "getHakiChainPlatform",
        "summary": "Get public HakiChain platform resources",
        "description": "Returns links to public documentation, developer resources, the OpenAPI specification, agent instructions, and support. Request text/markdown with an Accept: text/markdown header.",
        "responses": {
          "200": {
            "description": "Public platform metadata",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Platform" }
              },
              "text/markdown": {
                "schema": { "type": "string" }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Platform": {
        "type": "object",
        "required": ["name", "description", "documentation", "developerResources", "openapi", "agentInstructions", "support"],
        "properties": {
          "name": { "type": "string", "description": "Product name", "example": "HakiChain" },
          "description": { "type": "string", "description": "Product summary" },
          "documentation": { "type": "string", "format": "uri", "description": "Public product documentation" },
          "developerResources": { "type": "string", "format": "uri", "description": "Public developer resources" },
          "openapi": { "type": "string", "format": "uri", "description": "OpenAPI specification URL" },
          "agentInstructions": { "type": "string", "format": "uri", "description": "Agent instruction file URL" },
          "support": { "type": "string", "format": "uri", "description": "Support contact URI" }
        }
      },
      "Error": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "object",
            "required": ["code", "message", "hint"],
            "properties": {
              "code": { "type": "string", "description": "Stable machine-readable error code" },
              "message": { "type": "string", "description": "Human-readable error summary" },
              "hint": { "type": "string", "description": "Suggested resolution" }
            }
          }
        }
      }
    }
  }
}
