{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/blumee-app/json-schema/blumee-app-photo-search-response-schema.json",
  "title": "PhotoSearchResponse",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blumee-app-openapi.json#/components/schemas/PhotoSearchResponse",
  "type": "object",
  "properties": {
    "identify": {
      "$ref": "#/$defs/IdentifyResponse"
    },
    "intent": {
      "type": "string",
      "enum": [
        "bouquet",
        "houseplant",
        "unknown"
      ],
      "default": "unknown"
    },
    "hits": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PhotoSearchHit"
      }
    },
    "total": {
      "type": "integer",
      "minimum": 0
    },
    "breakdown": {
      "type": "object",
      "properties": {
        "catalog": {
          "type": "integer",
          "minimum": 0
        },
        "search": {
          "type": "integer",
          "minimum": 0
        },
        "merged": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "catalog",
        "search",
        "merged"
      ],
      "additionalProperties": false
    },
    "extractedColors": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ExtractedColor"
      },
      "default": []
    },
    "timings": {
      "type": "object",
      "properties": {
        "identify": {
          "type": "integer",
          "minimum": 0
        },
        "catalog": {
          "type": "integer",
          "minimum": 0
        },
        "search": {
          "type": "integer",
          "minimum": 0
        },
        "colors": {
          "type": "integer",
          "minimum": 0,
          "default": 0
        },
        "total": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "identify",
        "catalog",
        "search",
        "total"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "identify",
    "hits",
    "total",
    "breakdown",
    "timings"
  ],
  "additionalProperties": false,
  "$defs": {
    "CatalogPartner": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ],
      "additionalProperties": false
    },
    "ExtractedColor": {
      "type": "object",
      "properties": {
        "hex": {
          "type": "string",
          "pattern": "^#[0-9a-fA-F]{6}$"
        },
        "share": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "hex",
        "share"
      ],
      "additionalProperties": false
    },
    "IdentifyMatch": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "species",
            "genus",
            "label"
          ]
        },
        "scientificName": {
          "type": "string"
        },
        "genus": {
          "type": "string"
        },
        "family": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "confidence": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "knownSpecies": {
          "type": "boolean"
        },
        "speciesId": {
          "type": "string",
          "format": "uuid"
        },
        "gbifId": {
          "type": "string"
        },
        "providers": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "plantnet",
              "openai-vision"
            ]
          },
          "minItems": 1
        },
        "approximateCount": {
          "type": "integer",
          "minimum": 0
        },
        "colors": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "aliasesDe": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "kind",
        "scientificName",
        "confidence",
        "knownSpecies",
        "providers"
      ],
      "additionalProperties": false
    },
    "IdentifyResponse": {
      "type": "object",
      "properties": {
        "ok": {
          "type": "boolean",
          "const": true
        },
        "language": {
          "type": "string"
        },
        "verdict": {
          "type": "string",
          "enum": [
            "flower",
            "low_confidence",
            "no_known_genera",
            "not_a_bouquet"
          ]
        },
        "organConfidence": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "matches": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/IdentifyMatch"
          }
        },
        "generaRollup": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "genus": {
                "type": "string"
              },
              "confidence": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "knownSpecies": {
                "type": "boolean"
              },
              "label": {
                "type": "string"
              }
            },
            "required": [
              "genus",
              "confidence",
              "knownSpecies"
            ],
            "additionalProperties": false
          }
        },
        "palette": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "style": {
          "type": "string"
        },
        "occasionGuess": {
          "type": "string"
        },
        "arrangement": {
          "type": "object",
          "properties": {
            "shape": {
              "type": "string"
            },
            "symmetry": {
              "type": "string"
            },
            "stemCountEstimate": {
              "type": "integer",
              "minimum": 0
            },
            "wrapping": {
              "type": "string"
            }
          },
          "required": [
            "shape",
            "symmetry",
            "stemCountEstimate",
            "wrapping"
          ],
          "additionalProperties": false
        },
        "freshness": {
          "type": "string"
        },
        "providersUsed": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "plantnet",
              "openai-vision"
            ]
          }
        },
        "raw": {
          "type": "object",
          "properties": {
            "plantnet": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "language": {
                      "type": "string"
                    },
                    "bestMatch": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "predictedOrgans": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "organ": {
                            "type": "string"
                          },
                          "score": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "organ",
                          "score"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "remainingRequests": {
                      "type": "number"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "scientificName": {
                            "type": "string"
                          },
                          "scientificNameWithoutAuthor": {
                            "type": "string"
                          },
                          "genus": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "family": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "commonNames": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "score": {
                            "type": "number"
                          },
                          "gbifId": {
                            "type": "string"
                          },
                          "powoId": {
                            "type": "string"
                          },
                          "iucnCategory": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "scientificName",
                          "scientificNameWithoutAuthor",
                          "genus",
                          "family",
                          "commonNames",
                          "score"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "language",
                    "bestMatch",
                    "predictedOrgans",
                    "remainingRequests",
                    "results"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "vision": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "isBouquet": {
                      "type": "boolean"
                    },
                    "isPottedPlant": {
                      "type": "boolean"
                    },
                    "flowers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "commonName": {
                            "type": "string"
                          },
                          "scientificGuess": {
                            "type": "string"
                          },
                          "approximateCount": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "colors": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "confidence": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          }
                        },
                        "required": [
                          "commonName",
                          "scientificGuess",
                          "approximateCount",
                          "colors",
                          "confidence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "colors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "style": {
                      "type": "string"
                    },
                    "occasionGuess": {
                      "type": "string"
                    },
                    "overallConfidence": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    "arrangement": {
                      "type": "object",
                      "properties": {
                        "shape": {
                          "type": "string"
                        },
                        "symmetry": {
                          "type": "string"
                        },
                        "stemCountEstimate": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "wrapping": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shape",
                        "symmetry",
                        "stemCountEstimate",
                        "wrapping"
                      ],
                      "additionalProperties": false
                    },
                    "freshness": {
                      "type": "string"
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "promptTokens": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "completionTokens": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "totalTokens": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "promptTokens",
                        "completionTokens",
                        "totalTokens"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "model",
                    "isBouquet",
                    "flowers",
                    "colors",
                    "style",
                    "occasionGuess",
                    "overallConfidence",
                    "arrangement",
                    "freshness"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "plantnet",
            "vision"
          ],
          "additionalProperties": false
        },
        "timings": {
          "type": "object",
          "additionalProperties": {
            "type": "integer",
            "minimum": 0
          },
          "propertyNames": {
            "enum": [
              "plantnet",
              "openai-vision"
            ]
          }
        }
      },
      "required": [
        "ok",
        "language",
        "verdict",
        "organConfidence",
        "matches",
        "generaRollup",
        "providersUsed",
        "raw",
        "timings"
      ],
      "additionalProperties": false
    },
    "PhotoSearchHit": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "title": {
          "type": "string"
        },
        "price": {
          "type": "string"
        },
        "currency": {
          "type": "string"
        },
        "imageUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "image": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "src": {
                  "type": "string"
                },
                "width": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "height": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "variants": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string"
                      },
                      "width": {
                        "type": "integer",
                        "exclusiveMinimum": 0
                      }
                    },
                    "required": [
                      "url",
                      "width"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "src",
                "width",
                "height",
                "variants"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "partner": {
          "$ref": "#/$defs/CatalogPartner"
        },
        "flowers": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "colors": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "occasion": {
          "type": [
            "string",
            "null"
          ]
        },
        "available": {
          "type": "boolean"
        },
        "source": {
          "type": "string",
          "enum": [
            "catalog",
            "search"
          ]
        },
        "similarity": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      },
      "required": [
        "id",
        "title",
        "price",
        "currency",
        "imageUrl",
        "partner",
        "flowers",
        "colors",
        "occasion",
        "available",
        "source"
      ],
      "additionalProperties": false
    }
  }
}