{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mentionsapi-com/json-schema/mentionsapi-com-compare-response-schema.json",
  "title": "CompareResponse",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mentionsapi-com-openapi.json#/components/schemas/CompareResponse",
  "type": "object",
  "required": [
    "request_id",
    "side_a",
    "side_b",
    "delta",
    "citations",
    "cost_cents",
    "balance_after_cents"
  ],
  "properties": {
    "request_id": {
      "type": "string"
    },
    "side_a": {
      "$ref": "#/$defs/CompareSide"
    },
    "side_b": {
      "$ref": "#/$defs/CompareSide"
    },
    "delta": {
      "type": "object",
      "required": [
        "mention_count_diff",
        "mention_rate_a",
        "mention_rate_b",
        "delta_pct",
        "winner",
        "interpretation"
      ],
      "properties": {
        "mention_count_diff": {
          "type": "integer"
        },
        "mention_rate_a": {
          "type": "number"
        },
        "mention_rate_b": {
          "type": "number"
        },
        "delta_pct": {
          "type": "number"
        },
        "winner": {
          "type": "string",
          "enum": [
            "side_a",
            "side_b",
            "tie"
          ]
        },
        "interpretation": {
          "type": "string"
        }
      }
    },
    "citations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CompareCitation"
      }
    },
    "cost_cents": {
      "type": "integer"
    },
    "balance_after_cents": {
      "type": "integer"
    }
  },
  "$defs": {
    "CitationBranding": {
      "type": "object",
      "properties": {
        "logo_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "primary_color": {
          "type": [
            "string",
            "null"
          ]
        },
        "secondary_color": {
          "type": [
            "string",
            "null"
          ]
        },
        "og_image": {
          "type": [
            "string",
            "null"
          ]
        },
        "site_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "fetched_at": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "CompareCitation": {
      "type": "object",
      "required": [
        "url",
        "title"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "title": {
          "type": "string"
        },
        "branding": {
          "$ref": "#/$defs/CitationBranding"
        }
      }
    },
    "CompareSide": {
      "type": "object",
      "required": [
        "query",
        "brand",
        "providers",
        "mention_count",
        "provider_count"
      ],
      "properties": {
        "query": {
          "type": "string"
        },
        "brand": {
          "type": "string"
        },
        "providers": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "required": [
              "mentioned",
              "rank"
            ],
            "properties": {
              "mentioned": {
                "type": "boolean"
              },
              "rank": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          }
        },
        "mention_count": {
          "type": "integer"
        },
        "provider_count": {
          "type": "integer"
        }
      }
    }
  }
}