{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/openaxia-com/json-schema/openaxia-com-product-comparison-schema.json",
  "title": "ProductComparison",
  "description": "Same shape as the motobase_compare_products MCP tool result, plus the indexable page link.",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/openaxia-com-openapi.json#/components/schemas/ProductComparison",
  "type": "object",
  "properties": {
    "products": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProductRef"
      }
    },
    "baseline": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "values": {
            "type": "array",
            "items": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "required": [
          "key",
          "displayName",
          "values"
        ]
      }
    },
    "specs": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "property": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "group": {
            "type": [
              "string",
              "null"
            ]
          },
          "isDifferent": {
            "type": "boolean",
            "description": "Rule-based: tolerance, qualifier and set rules; not-published / unchecked cells never participate."
          },
          "values": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/$defs/Spec"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "allValues": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/Spec"
              }
            }
          },
          "specGroup": {
            "type": "string",
            "description": "v2 spec group (12-group order); `group` keeps the legacy three-group value."
          },
          "compareRule": {
            "type": "string"
          },
          "states": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "value",
                "standard",
                "optional",
                "none",
                "not_published",
                "not_applicable",
                "unknown"
              ]
            }
          },
          "differentBasis": {
            "type": "array",
            "items": {
              "type": "boolean"
            }
          },
          "best": {
            "type": "array",
            "items": {
              "type": "boolean"
            }
          }
        },
        "required": [
          "property",
          "displayName",
          "group",
          "isDifferent",
          "values",
          "allValues",
          "specGroup",
          "compareRule",
          "states",
          "differentBasis",
          "best"
        ]
      }
    },
    "notFound": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "recommended": {
      "type": "boolean",
      "description": "True when exactly two products resolve and they form a recommended (indexable) pair."
    },
    "canonicalPage": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "description": "The model comparison page when exactly two products resolve."
    },
    "templateAlignment": {
      "type": "string",
      "enum": [
        "same_template",
        "shared_rows_only",
        "no_template"
      ]
    },
    "seriesGroup": {
      "type": [
        "object",
        "null"
      ],
      "description": "\"Series & variant axes\" row group when ≥2 compared products share a published series.",
      "properties": {
        "series": {
          "type": "array",
          "items": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            }
          }
        },
        "axes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "isDifferent": {
                "type": "boolean"
              },
              "values": {
                "type": "array",
                "items": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "values": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "fromModelName": {
                      "type": "boolean"
                    },
                    "claimIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "viewAll": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "url": {
              "type": "string"
            },
            "memberCount": {
              "type": "integer"
            }
          }
        }
      }
    }
  },
  "required": [
    "products",
    "baseline",
    "specs",
    "notFound",
    "recommended",
    "canonicalPage",
    "templateAlignment"
  ],
  "$defs": {
    "EntityRef": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Identifier of the referenced product or company, in the same form as ProductSummary.slug / CompanySummary.slug (canonical identifier with the server switch `MOTOBASE_PUBLIC_URLS_ENABLED` on; numeric only while that record is not backfilled)."
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "slug",
        "name"
      ]
    },
    "Evidence": {
      "type": "object",
      "description": "Provenance of a claim-backed value.",
      "properties": {
        "claimId": {
          "type": [
            "string",
            "integer",
            "null"
          ]
        },
        "source": {
          "$ref": "#/$defs/Source"
        },
        "observedAt": {
          "type": "string"
        },
        "assertionType": {
          "type": [
            "string",
            "null"
          ]
        },
        "evidenceStrength": {
          "type": "string"
        },
        "confidence": {
          "type": "string"
        },
        "sourceExcerpt": {
          "type": "string",
          "description": "Present only when the excerpt passed this service's public review gate."
        }
      },
      "required": [
        "claimId",
        "source",
        "observedAt",
        "assertionType",
        "evidenceStrength",
        "confidence"
      ]
    },
    "ProductRef": {
      "description": "A product reference: EntityRef plus the canonical display name.",
      "allOf": [
        {
          "$ref": "#/$defs/EntityRef"
        },
        {
          "type": "object",
          "properties": {
            "displayName": {
              "type": "string",
              "description": "Canonical display name (the public page H1). Presentation only — never use it as an id, slug or filter value; `name` keeps the original value."
            }
          },
          "required": [
            "displayName"
          ]
        }
      ]
    },
    "Source": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "title": {
          "type": [
            "string",
            "null"
          ]
        },
        "kind": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": [
            "string",
            "null"
          ]
        },
        "retrievedAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "legalBasis": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "title",
        "kind",
        "url",
        "retrievedAt",
        "legalBasis"
      ]
    },
    "Spec": {
      "type": "object",
      "properties": {
        "property": {
          "type": "string"
        },
        "displayName": {
          "type": "string"
        },
        "valueType": {
          "type": "string"
        },
        "value": {},
        "unit": {
          "type": [
            "string",
            "null"
          ]
        },
        "evidence": {
          "$ref": "#/$defs/Evidence"
        }
      },
      "required": [
        "property",
        "displayName",
        "valueType",
        "value",
        "unit",
        "evidence"
      ]
    }
  }
}