{
  "openapi": "3.1.0",
  "info": {
    "title": "Eyal Bercovich Profile API",
    "description": "Read-only public API exposing Dr. Eyal Bercovich's academic profile, publications, clinic information, and research areas. All endpoints are public (no authentication required) and return JSON. Data is curated and maintained by Dr. Bercovich.",
    "version": "1.0.0",
    "contact": {
      "name": "Eyal Bercovich, MD",
      "email": "ebercovic@univ.haifa.ac.il",
      "url": "https://www.eyalbercovich.com/"
    },
    "license": {
      "name": "CC BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    }
  },
  "servers": [
    { "url": "https://www.eyalbercovich.com", "description": "Production" }
  ],
  "externalDocs": {
    "description": "Developer Portal",
    "url": "https://www.eyalbercovich.com/developers/"
  },
  "tags": [
    { "name": "profile", "description": "Academic and clinical profile information" },
    { "name": "publications", "description": "Peer-reviewed publications" },
    { "name": "clinic", "description": "Medica Elisha clinic information" },
    { "name": "research", "description": "Research areas and affiliations" },
    { "name": "meta", "description": "API metadata and status" }
  ],
  "paths": {
    "/api/profile": {
      "get": {
        "summary": "Get full profile",
        "description": "Returns identity, positions, training, credentials, and languages for Dr. Eyal Bercovich.",
        "tags": ["profile"],
        "responses": {
          "200": {
            "description": "Profile object",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Profile" }
              }
            }
          }
        }
      }
    },
    "/api/publications": {
      "get": {
        "summary": "List publications",
        "description": "Returns peer-reviewed publications. Supports filtering by year and journal.",
        "tags": ["publications"],
        "parameters": [
          { "name": "year", "in": "query", "schema": { "type": "integer" }, "description": "Filter by publication year" },
          { "name": "journal", "in": "query", "schema": { "type": "string" }, "description": "Filter by journal name (partial match)" },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 50 }, "description": "Max results" }
        ],
        "responses": {
          "200": {
            "description": "List of publications",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": { "type": "integer" },
                    "publications": { "type": "array", "items": { "$ref": "#/components/schemas/Publication" } }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/publications/{doi}": {
      "get": {
        "summary": "Get a publication by DOI",
        "tags": ["publications"],
        "parameters": [
          { "name": "doi", "in": "path", "required": true, "schema": { "type": "string" }, "description": "URL-encoded DOI" }
        ],
        "responses": {
          "200": { "description": "Publication object", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Publication" } } } },
          "404": { "description": "Not found" }
        }
      }
    },
    "/api/clinic": {
      "get": {
        "summary": "Get clinic information",
        "description": "Returns clinic name, location, phone, services, insurance coverage, and booking links.",
        "tags": ["clinic"],
        "responses": {
          "200": {
            "description": "Clinic object",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/Clinic" } }
            }
          }
        }
      }
    },
    "/api/services": {
      "get": {
        "summary": "List clinical services",
        "description": "Returns service catalog with English and Hebrew names.",
        "tags": ["clinic"],
        "responses": {
          "200": {
            "description": "Services catalog",
            "content": { "application/json": { "schema": { "type": "object", "properties": { "services": { "type": "array", "items": { "$ref": "#/components/schemas/Service" } } } } } }
          }
        }
      }
    },
    "/api/research": {
      "get": {
        "summary": "Get research areas",
        "tags": ["research"],
        "responses": {
          "200": { "description": "Research areas", "content": { "application/json": { "schema": { "type": "object" } } } }
        }
      }
    },
    "/api/status": {
      "get": {
        "summary": "Health check",
        "tags": ["meta"],
        "responses": {
          "200": {
            "description": "API status",
            "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean" }, "version": { "type": "string" }, "ts": { "type": "string", "format": "date-time" } } } } }
          }
        }
      }
    },
    "/api/export.csv": {
      "get": {
        "summary": "Export publications as CSV",
        "tags": ["publications"],
        "responses": {
          "200": { "description": "CSV download", "content": { "text/csv": { "schema": { "type": "string" } } } }
        }
      }
    },
    "/api/openapi.json": {
      "get": {
        "summary": "OpenAPI specification",
        "tags": ["meta"],
        "responses": { "200": { "description": "This document" } }
      }
    }
  },
  "components": {
    "schemas": {
      "Profile": {
        "type": "object",
        "required": ["name", "specialty", "positions"],
        "properties": {
          "name": { "type": "string" },
          "credentials": { "type": "string" },
          "specialty": { "type": "string" },
          "orcid": { "type": "string" },
          "email": { "type": "string", "format": "email" },
          "languages": { "type": "array", "items": { "type": "string" } },
          "positions": { "type": "array", "items": { "type": "string" } },
          "training": { "type": "array", "items": { "type": "string" } }
        }
      },
      "Publication": {
        "type": "object",
        "required": ["title", "authors", "journal", "year"],
        "properties": {
          "title": { "type": "string" },
          "authors": { "type": "string" },
          "journal": { "type": "string" },
          "year": { "type": "integer" },
          "volume": { "type": "string" },
          "issue": { "type": "string" },
          "pages": { "type": "string" },
          "doi": { "type": "string" },
          "pubmed": { "type": "string", "format": "uri" },
          "url": { "type": "string", "format": "uri" }
        }
      },
      "Clinic": {
        "type": "object",
        "required": ["name", "address", "phone"],
        "properties": {
          "name": { "type": "string" },
          "nameHebrew": { "type": "string" },
          "parent": { "type": "string" },
          "address": { "type": "string" },
          "phone": { "type": "string" },
          "email": { "type": "string", "format": "email" },
          "coordinates": { "type": "object", "properties": { "latitude": { "type": "number" }, "longitude": { "type": "number" } } },
          "insurance": { "type": "array", "items": { "type": "string" } },
          "bookingLinks": { "type": "object", "additionalProperties": { "type": "string", "format": "uri" } }
        }
      },
      "Service": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": { "type": "string" },
          "nameHebrew": { "type": "string" },
          "category": { "type": "string" }
        }
      }
    },
    "securitySchemes": {}
  },
  "security": []
}
