{
  "openapi": "3.0.3",
  "info": {
    "title": "Baulkham Hills Conveyancing Public API",
    "description": "Public endpoints for AI-assisted search and published conveyancing insights.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://baulkhamhillsconveyancing.com.au"
    }
  ],
  "paths": {
    "/api/search": {
      "get": {
        "summary": "Run an AI-enhanced search",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Search query (minimum 2 characters).",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Search results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": ["services", "faqs", "blog", "process", "testimonials"]
                          },
                          "title": {
                            "type": "string"
                          },
                          "snippet": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri"
                          },
                          "score": {
                            "type": "number"
                          },
                          "keyPhrases": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": ["id", "type", "title", "snippet", "url", "score"]
                      }
                    }
                  },
                  "required": ["query", "results"]
                }
              }
            }
          }
        }
      }
    },
    "/api/blog-posts": {
      "get": {
        "summary": "List published blog posts",
        "parameters": [
          {
            "name": "published",
            "in": "query",
            "description": "Filter to only published posts.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["true", "false"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Blog post list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": { "type": "string" },
                      "title": { "type": "string" },
                      "excerpt": { "type": "string" },
                      "slug": { "type": "string" },
                      "publishedAt": { "type": "string", "format": "date-time" },
                      "updatedAt": { "type": "string", "format": "date-time" }
                    },
                    "required": ["id", "title", "slug"]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/blog-posts/{slug}": {
      "get": {
        "summary": "Fetch a published blog post",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Blog post details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": { "type": "string" },
                    "title": { "type": "string" },
                    "content": { "type": "string" },
                    "excerpt": { "type": "string" },
                    "slug": { "type": "string" },
                    "featuredImage": { "type": "string" },
                    "publishedAt": { "type": "string", "format": "date-time" },
                    "updatedAt": { "type": "string", "format": "date-time" }
                  },
                  "required": ["id", "title", "content", "slug"]
                }
              }
            }
          }
        }
      }
    }
  }
}
