{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cnccompass-com/json-schema/cnccompass-com-search-response-schema.json",
  "title": "SearchResponse",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cnccompass-com-openapi.yml#/components/schemas/SearchResponse",
  "properties": {
    "answer": {
      "title": "Answer",
      "type": "string"
    },
    "brief": {
      "$ref": "#/$defs/SearchBrief"
    },
    "missing": {
      "items": {
        "type": "string"
      },
      "title": "Missing",
      "type": "array"
    },
    "follow_up_question": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Follow Up Question"
    },
    "suppliers": {
      "items": {
        "$ref": "#/$defs/SupplierHit"
      },
      "title": "Suppliers",
      "type": "array"
    },
    "filters": {
      "items": {
        "$ref": "#/$defs/AppliedFilter"
      },
      "title": "Filters",
      "type": "array"
    },
    "offset": {
      "default": 0,
      "title": "Offset",
      "type": "integer"
    },
    "limit": {
      "default": 5,
      "title": "Limit",
      "type": "integer"
    },
    "has_more": {
      "default": false,
      "title": "Has More",
      "type": "boolean"
    },
    "total_records": {
      "default": 0,
      "title": "Total Records",
      "type": "integer"
    },
    "index_records": {
      "default": 0,
      "title": "Index Records",
      "type": "integer"
    },
    "retrieval": {
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "integer"
          }
        ]
      },
      "title": "Retrieval",
      "type": "object"
    }
  },
  "required": [
    "answer",
    "brief"
  ],
  "type": "object",
  "$defs": {
    "AppliedFilter": {
      "description": "One brief field used to filter records, with how many index records declare it.",
      "properties": {
        "field": {
          "title": "Field",
          "type": "string"
        },
        "label": {
          "title": "Label",
          "type": "string"
        },
        "keys": {
          "items": {
            "type": "string"
          },
          "title": "Keys",
          "type": "array"
        },
        "records": {
          "default": 0,
          "title": "Records",
          "type": "integer"
        }
      },
      "required": [
        "field",
        "label"
      ],
      "title": "AppliedFilter",
      "type": "object"
    },
    "Evidence": {
      "properties": {
        "label": {
          "title": "Label",
          "type": "string"
        },
        "quote": {
          "title": "Quote",
          "type": "string"
        },
        "source_url": {
          "default": "",
          "title": "Source Url",
          "type": "string"
        }
      },
      "required": [
        "label",
        "quote"
      ],
      "title": "Evidence",
      "type": "object"
    },
    "SearchBrief": {
      "properties": {
        "material": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Material"
        },
        "process": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Process"
        },
        "finish": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Finish"
        },
        "tolerance": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Tolerance"
        },
        "quantity": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Quantity"
        },
        "location": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Location"
        },
        "certification": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Certification"
        }
      },
      "title": "SearchBrief",
      "type": "object"
    },
    "SupplierHit": {
      "properties": {
        "slug": {
          "title": "Slug",
          "type": "string"
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "location": {
          "default": "",
          "title": "Location",
          "type": "string"
        },
        "score": {
          "title": "Score",
          "type": "number"
        },
        "match_reasons": {
          "items": {
            "type": "string"
          },
          "title": "Match Reasons",
          "type": "array"
        },
        "matched_fields": {
          "items": {
            "type": "string"
          },
          "title": "Matched Fields",
          "type": "array"
        },
        "website_url": {
          "default": "",
          "title": "Website Url",
          "type": "string"
        },
        "website_kind": {
          "default": "",
          "title": "Website Kind",
          "type": "string"
        },
        "factory_verification": {
          "default": "",
          "title": "Factory Verification",
          "type": "string"
        },
        "inquiry_url": {
          "default": "",
          "title": "Inquiry Url",
          "type": "string"
        },
        "evidence": {
          "items": {
            "$ref": "#/$defs/Evidence"
          },
          "title": "Evidence",
          "type": "array"
        }
      },
      "required": [
        "slug",
        "name",
        "score"
      ],
      "title": "SupplierHit",
      "type": "object"
    }
  }
}