{
  "openapi": "3.1.1",
  "info": {
    "title": "APAtelier.Web | v1",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://www.apatelier.cz/"
    }
  ],
  "paths": {
    "/api/ai/search": {
      "get": {
        "tags": [
          "AI"
        ],
        "summary": "Search projects and images using natural language",
        "description": "Accepts a natural-language query and returns machine-readable project and image matches. The search evaluates public projects, related messages, and linked images, including cross-references between projects and messages.",
        "operationId": "AiSearch",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiSearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpValidationProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AiSearchImageResult": {
        "required": [
          "imagePath",
          "thumbnailPath",
          "imageTitle",
          "projectTitle",
          "projectUrlPath",
          "projectYear",
          "matchReasons",
          "relatedMessages"
        ],
        "type": "object",
        "properties": {
          "imagePath": {
            "type": "string"
          },
          "thumbnailPath": {
            "type": [
              "null",
              "string"
            ]
          },
          "imageTitle": {
            "type": [
              "null",
              "string"
            ]
          },
          "projectTitle": {
            "type": "string"
          },
          "projectUrlPath": {
            "type": "string"
          },
          "projectYear": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "matchReasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "relatedMessages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AiSearchProjectResult": {
        "required": [
          "projectId",
          "title",
          "subtitle",
          "urlPath",
          "year",
          "excerpt",
          "imagePaths",
          "relatedMessages",
          "matchReasons"
        ],
        "type": "object",
        "properties": {
          "projectId": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "subtitle": {
            "type": [
              "null",
              "string"
            ]
          },
          "urlPath": {
            "type": "string"
          },
          "year": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "excerpt": {
            "type": [
              "null",
              "string"
            ]
          },
          "imagePaths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "relatedMessages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "matchReasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AiSearchResponse": {
        "required": [
          "query",
          "totalProjects",
          "totalImages",
          "projects",
          "images",
          "interpretedTerms",
          "year"
        ],
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "totalProjects": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "totalImages": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "projects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiSearchProjectResult"
            }
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiSearchImageResult"
            }
          },
          "interpretedTerms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "year": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "HttpValidationProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "detail": {
            "type": [
              "null",
              "string"
            ]
          },
          "instance": {
            "type": [
              "null",
              "string"
            ]
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "AI"
    }
  ]
}