{
  "openapi": "3.1.0",
  "info": {
    "title": "Dewei Zhai — public API",
    "version": "1.0.0",
    "summary": "Read-only JSON endpoints describing the owner, services, cases, and stack. Intended for AI agents and automated consumers.",
    "contact": {
      "name": "Dewei Zhai",
      "email": "dewei.zhai@gmail.com",
      "url": "https://zhaidewei.com"
    },
    "license": {
      "name": "No license — content rights reserved."
    }
  },
  "servers": [
    {
      "url": "https://zhaidewei.com"
    }
  ],
  "paths": {
    "/api/profile": {
      "get": {
        "summary": "Profile (identity, specialties, certifications, education, engagement, contact).",
        "operationId": "getProfile",
        "responses": {
          "200": {
            "description": "Profile payload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/services": {
      "get": {
        "summary": "Services offered and project types accepted / avoided.",
        "operationId": "getServices",
        "responses": {
          "200": {
            "description": "Services payload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServicesEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/cases": {
      "get": {
        "summary": "Non-confidential case studies of past freelance engagements (HTML view at /cv).",
        "operationId": "getCases",
        "responses": {
          "200": {
            "description": "Cases payload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CasesEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/stack": {
      "get": {
        "summary": "Grouped technology stack, certifications, education.",
        "operationId": "getStack",
        "responses": {
          "200": {
            "description": "Stack payload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StackEnvelope"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Envelope": {
        "type": "object",
        "required": [
          "version",
          "data"
        ],
        "properties": {
          "version": {
            "type": "string",
            "const": "1"
          },
          "data": {
            "type": "object"
          }
        }
      },
      "ProfileEnvelope": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "required": [
                  "name",
                  "role",
                  "location",
                  "specialties",
                  "contact"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "role": {
                    "type": "string"
                  },
                  "location": {
                    "type": "string"
                  },
                  "timezone": {
                    "type": "string"
                  },
                  "domain": {
                    "type": "string"
                  },
                  "summary": {
                    "type": "string"
                  },
                  "tagline": {
                    "type": "string"
                  },
                  "specialties": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "certifications": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "education": {
                    "type": "object",
                    "properties": {
                      "degree": {
                        "type": "string"
                      },
                      "institution": {
                        "type": "string"
                      },
                      "equivalence": {
                        "type": "string"
                      }
                    }
                  },
                  "engagement": {
                    "type": "object",
                    "properties": {
                      "model": {
                        "type": "string"
                      },
                      "retainers": {
                        "type": "boolean"
                      },
                      "introCallMinutes": {
                        "type": "integer"
                      }
                    }
                  },
                  "contact": {
                    "type": "object",
                    "properties": {
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "linkedin": {
                        "type": "string",
                        "format": "uri"
                      },
                      "github": {
                        "type": "string",
                        "format": "uri"
                      }
                    }
                  },
                  "links": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "ServicesEnvelope": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "services": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "slug",
                        "name"
                      ],
                      "properties": {
                        "slug": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "problemsSolved": {
                          "type": "string"
                        },
                        "situation": {
                          "type": "string"
                        },
                        "technologies": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "outcome": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "projectTypes": {
                    "type": "object",
                    "properties": {
                      "accept": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "avoid": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "CasesEnvelope": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "cases": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "slug",
                        "client",
                        "role",
                        "period",
                        "summary"
                      ],
                      "properties": {
                        "slug": {
                          "type": "string"
                        },
                        "client": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string"
                        },
                        "period": {
                          "type": "string"
                        },
                        "summary": {
                          "type": "string"
                        },
                        "stack": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "outcomes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "StackEnvelope": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "technologies": {
                    "type": "object",
                    "properties": {
                      "cloud": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "etl": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "warehouse": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "languages": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "automation": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "devops": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "certifications": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "education": {
                    "type": "object",
                    "properties": {
                      "degree": {
                        "type": "string"
                      },
                      "institution": {
                        "type": "string"
                      },
                      "equivalence": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        ]
      }
    }
  }
}