{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/compatair-fr/json-schema/compatair-fr-compatibility-result-schema.json",
  "title": "CompatibilityResult",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/compatair-fr-openapi.yml#/components/schemas/CompatibilityResult",
  "allOf": [
    {
      "$ref": "#/$defs/PublicEnvelope"
    },
    {
      "type": "object",
      "required": [
        "schemaVersion",
        "catalogVersion",
        "verdictVersion",
        "calculationVersion",
        "input",
        "compressor",
        "tool",
        "compatibility",
        "overall_system_verdict",
        "air_supply_verdict",
        "compatibility_receipt",
        "engine_evaluation",
        "sources",
        "detailsUrl",
        "proofUrl"
      ],
      "properties": {
        "schemaVersion": {
          "const": "2.0.0"
        },
        "catalogVersion": {
          "type": "string"
        },
        "catalogVerifiedAt": {
          "type": "string",
          "format": "date"
        },
        "verdictVersion": {
          "type": "string"
        },
        "calculationVersion": {
          "type": "string"
        },
        "input": {
          "type": "object",
          "required": [
            "compressorId",
            "toolId"
          ],
          "properties": {
            "compressorId": {
              "type": "string"
            },
            "toolId": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "compressor": {
          "$ref": "#/$defs/ProductIdentity"
        },
        "tool": {
          "$ref": "#/$defs/ProductIdentity"
        },
        "compatibility": {
          "$ref": "#/$defs/ScopedVerdict"
        },
        "overall_system_verdict": {
          "$ref": "#/$defs/ScopedVerdict"
        },
        "air_supply_verdict": {
          "$ref": "#/$defs/ScopedVerdict"
        },
        "compatibility_receipt": {
          "$ref": "https://compatair.fr/schemas/compatibility-receipt-1.0.0.json"
        },
        "engine_evaluation": {
          "$ref": "#/$defs/EngineEvaluation"
        },
        "sources": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/EvidenceSource"
          }
        },
        "detailsUrl": {
          "type": "string",
          "format": "uri"
        },
        "proofUrl": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  ],
  "unevaluatedProperties": false,
  "$defs": {
    "EngineEvaluation": {
      "type": "object",
      "required": [
        "verdict"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "compressorId": {
          "type": "string"
        },
        "toolId": {
          "type": "string"
        },
        "verdict": {
          "enum": [
            "continuous",
            "intermittent",
            "incompatible",
            "insufficient_data"
          ]
        },
        "confidence": {
          "enum": [
            "high",
            "medium",
            "low"
          ]
        },
        "limitingFactor": {
          "type": "string"
        },
        "requiredFadLpm": {
          "type": "number"
        },
        "availableFadLpm": {
          "type": "number"
        },
        "availableFadBasis": {
          "enum": [
            "exact",
            "interpolated",
            "higher-pressure-bound"
          ]
        },
        "availableFadReferencePressureBar": {
          "type": "number"
        },
        "marginPercent": {
          "type": "number"
        },
        "calculationVersion": {
          "type": "string"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "EvidenceSource": {
      "type": "object",
      "required": [
        "id",
        "label",
        "url",
        "sourceType",
        "sourceRole",
        "retrievedAt",
        "confidence"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "sourceType": {
          "enum": [
            "manufacturer",
            "manual",
            "merchant",
            "measured"
          ]
        },
        "sourceRole": {
          "enum": [
            "primary",
            "independent_corroboration",
            "secondary"
          ]
        },
        "retrievedAt": {
          "type": "string",
          "format": "date"
        },
        "confidence": {
          "enum": [
            "A",
            "B",
            "C",
            "D"
          ]
        }
      },
      "additionalProperties": false
    },
    "MerchantIdentifiers": {
      "type": "object",
      "required": [
        "distributor_skus"
      ],
      "properties": {
        "mpn": {
          "type": "string"
        },
        "normalized_mpn": {
          "type": "string"
        },
        "ean": {
          "type": "string",
          "pattern": "^\\d{8,14}$"
        },
        "gtin": {
          "type": "string",
          "pattern": "^\\d{8,14}$"
        },
        "distributor_skus": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "distributor_id",
              "sku",
              "normalized_sku"
            ],
            "properties": {
              "distributor_id": {
                "type": "string"
              },
              "sku": {
                "type": "string"
              },
              "normalized_sku": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    "ProductIdentity": {
      "type": "object",
      "required": [
        "id",
        "brand",
        "model",
        "slug",
        "identifiers"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "brand": {
          "type": "string"
        },
        "model": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "identifiers": {
          "$ref": "#/$defs/MerchantIdentifiers"
        }
      },
      "additionalProperties": false
    },
    "PublicEnvelope": {
      "type": "object",
      "required": [
        "verdict",
        "verdict_scope",
        "verdict_schema_version",
        "canonical_url",
        "product_urls",
        "source_urls",
        "method_version",
        "catalog_version",
        "observed_at",
        "limitations",
        "next_actions"
      ],
      "properties": {
        "verdict": {
          "enum": [
            "information",
            "compatible",
            "compatible_with_limits",
            "incompatible",
            "insufficient_data"
          ]
        },
        "verdict_scope": {
          "enum": [
            "information",
            "request",
            "air_supply",
            "complete_air_system",
            "commercial_constraints"
          ]
        },
        "verdict_schema_version": {
          "const": "2.0.0"
        },
        "canonical_url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://compatair\\.fr/"
        },
        "product_urls": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://compatair\\.fr/"
          },
          "uniqueItems": true
        },
        "source_urls": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "uniqueItems": true
        },
        "method_version": {
          "type": "string",
          "pattern": "^2026\\.[0-9]{2}$"
        },
        "catalog_version": {
          "type": "string",
          "minLength": 1
        },
        "observed_at": {
          "type": "string",
          "format": "date"
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "next_actions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "ScopedVerdict": {
      "type": "object",
      "required": [
        "schema_version",
        "scope",
        "verdict",
        "limiting_factor",
        "limitations"
      ],
      "properties": {
        "schema_version": {
          "const": "2.0.0"
        },
        "scope": {
          "enum": [
            "air_supply",
            "complete_air_system",
            "commercial_constraints"
          ]
        },
        "verdict": {
          "enum": [
            "information",
            "compatible",
            "compatible_with_limits",
            "incompatible",
            "insufficient_data"
          ]
        },
        "engine_verdict": {
          "enum": [
            "continuous",
            "intermittent",
            "incompatible",
            "insufficient_data"
          ]
        },
        "limiting_factor": {
          "type": [
            "string",
            "null"
          ]
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "metrics": {
          "type": "object",
          "properties": {
            "required_fad_lpm": {
              "type": [
                "number",
                "null"
              ]
            },
            "available_fad_lpm": {
              "type": [
                "number",
                "null"
              ]
            },
            "effective_average_capacity_lpm": {
              "type": [
                "number",
                "null"
              ]
            },
            "required_pressure_bar": {
              "type": [
                "number",
                "null"
              ]
            },
            "available_pressure_bar": {
              "type": [
                "number",
                "null"
              ]
            },
            "demand_flow_lpm": {
              "type": [
                "number",
                "null"
              ]
            },
            "recommended_fad_lpm": {
              "type": [
                "number",
                "null"
              ]
            },
            "margin_percent": {
              "type": [
                "number",
                "null"
              ]
            },
            "mode": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
  }
}