{
  "$defs": {
    "ArtifactReference": {
      "additionalProperties": false,
      "properties": {
        "artifact_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Artifact Id",
          "type": "string"
        },
        "media_type": {
          "maxLength": 128,
          "minLength": 3,
          "title": "Media Type",
          "type": "string"
        },
        "relative_path": {
          "maxLength": 512,
          "minLength": 1,
          "title": "Relative Path",
          "type": "string"
        },
        "sha256": {
          "pattern": "^[0-9a-f]{64}$",
          "title": "Sha256",
          "type": "string"
        },
        "size_bytes": {
          "minimum": 0,
          "title": "Size Bytes",
          "type": "integer"
        }
      },
      "required": [
        "artifact_id",
        "media_type",
        "relative_path",
        "sha256",
        "size_bytes"
      ],
      "title": "ArtifactReference",
      "type": "object"
    },
    "AssessmentStatus": {
      "enum": [
        "pass",
        "warn",
        "fail",
        "not_assessed"
      ],
      "title": "AssessmentStatus",
      "type": "string"
    },
    "ComparisonEntry": {
      "additionalProperties": false,
      "properties": {
        "candidate_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Candidate Id",
          "type": "string"
        },
        "context_sha256": {
          "pattern": "^[0-9a-f]{64}$",
          "title": "Context Sha256",
          "type": "string"
        },
        "exclusion_reasons": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Exclusion Reasons",
          "type": "array"
        },
        "mandatory_status": {
          "$ref": "#/$defs/AssessmentStatus"
        },
        "overall_score": {
          "anyOf": [
            {
              "maximum": 100,
              "minimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Overall Score"
        },
        "pareto_nondominated": {
          "default": false,
          "title": "Pareto Nondominated",
          "type": "boolean"
        }
      },
      "required": [
        "candidate_id",
        "mandatory_status",
        "context_sha256"
      ],
      "title": "ComparisonEntry",
      "type": "object"
    },
    "DominanceRecord": {
      "additionalProperties": false,
      "properties": {
        "dominant_candidate_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Dominant Candidate Id",
          "type": "string"
        },
        "dominated_candidate_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Dominated Candidate Id",
          "type": "string"
        },
        "strictly_better_objective_ids": {
          "items": {
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
            "type": "string"
          },
          "minItems": 1,
          "title": "Strictly Better Objective Ids",
          "type": "array"
        }
      },
      "required": [
        "dominant_candidate_id",
        "dominated_candidate_id",
        "strictly_better_objective_ids"
      ],
      "title": "DominanceRecord",
      "type": "object"
    },
    "EvaluationPolicyReference": {
      "additionalProperties": false,
      "properties": {
        "policy_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Policy Id",
          "type": "string"
        },
        "sha256": {
          "pattern": "^[0-9a-f]{64}$",
          "title": "Sha256",
          "type": "string"
        },
        "version": {
          "const": "1.0.0",
          "default": "1.0.0",
          "title": "Version",
          "type": "string"
        }
      },
      "required": [
        "policy_id",
        "sha256"
      ],
      "title": "EvaluationPolicyReference",
      "type": "object"
    },
    "EvaluationSourceReference": {
      "additionalProperties": false,
      "description": "A manifest-declared capture plus a pointer, never a host file locator.",
      "properties": {
        "artifact": {
          "$ref": "#/$defs/ArtifactReference"
        },
        "component_id": {
          "anyOf": [
            {
              "maxLength": 128,
              "minLength": 1,
              "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Component Id"
        },
        "mode_id": {
          "anyOf": [
            {
              "maxLength": 128,
              "minLength": 1,
              "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Mode Id"
        },
        "pointer": {
          "default": "",
          "maxLength": 1024,
          "pattern": "^(?:/(?:[^~]|~[01])*)*$",
          "title": "Pointer",
          "type": "string"
        },
        "result_id": {
          "anyOf": [
            {
              "maxLength": 128,
              "minLength": 1,
              "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Result Id"
        },
        "scenario_id": {
          "anyOf": [
            {
              "maxLength": 128,
              "minLength": 1,
              "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Scenario Id"
        }
      },
      "required": [
        "artifact"
      ],
      "title": "EvaluationSourceReference",
      "type": "object"
    },
    "ObjectiveValue": {
      "additionalProperties": false,
      "properties": {
        "direction": {
          "enum": [
            "maximize",
            "minimize"
          ],
          "title": "Direction",
          "type": "string"
        },
        "objective_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Objective Id",
          "type": "string"
        },
        "sources": {
          "default": [],
          "items": {
            "$ref": "#/$defs/EvaluationSourceReference"
          },
          "title": "Sources",
          "type": "array"
        },
        "statement_id": {
          "anyOf": [
            {
              "maxLength": 128,
              "minLength": 1,
              "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Statement Id"
        },
        "unit": {
          "enum": [
            "ratio",
            "1",
            "K",
            "deg",
            "m/s",
            "s",
            "W",
            "Wh",
            "W/kg",
            "W/m3",
            "W/m2",
            "kg",
            "m3",
            "m2",
            "dB",
            "bit/day",
            "bit",
            "USD",
            "EUR",
            "GBP",
            "count",
            "composite",
            "inventory",
            "score_points",
            "text",
            "bool",
            "V",
            "A",
            "m",
            "N",
            "degC",
            "km",
            "year",
            "deg/s",
            "rpm",
            "N*m",
            "N*m*s",
            "A*m2",
            "bit/s",
            "USD_2025",
            "arcsec",
            "enum",
            "m/s2"
          ],
          "title": "Unit",
          "type": "string"
        },
        "value": {
          "title": "Value",
          "type": "number"
        }
      },
      "required": [
        "objective_id",
        "value",
        "unit",
        "direction"
      ],
      "title": "ObjectiveValue",
      "type": "object"
    },
    "ObjectiveVector": {
      "additionalProperties": false,
      "properties": {
        "candidate_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Candidate Id",
          "type": "string"
        },
        "context_sha256": {
          "pattern": "^[0-9a-f]{64}$",
          "title": "Context Sha256",
          "type": "string"
        },
        "objectives": {
          "items": {
            "$ref": "#/$defs/ObjectiveValue"
          },
          "minItems": 1,
          "title": "Objectives",
          "type": "array"
        }
      },
      "required": [
        "candidate_id",
        "context_sha256",
        "objectives"
      ],
      "title": "ObjectiveVector",
      "type": "object"
    },
    "Recommendation": {
      "additionalProperties": false,
      "properties": {
        "candidate_ids": {
          "default": [],
          "items": {
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
            "type": "string"
          },
          "title": "Candidate Ids",
          "type": "array"
        },
        "decision_status": {
          "const": "proposed",
          "default": "proposed",
          "title": "Decision Status",
          "type": "string"
        },
        "material_difference_points": {
          "maximum": 100,
          "minimum": 0,
          "title": "Material Difference Points",
          "type": "number"
        },
        "provisional": {
          "default": false,
          "title": "Provisional",
          "type": "boolean"
        },
        "reasons": {
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "title": "Reasons",
          "type": "array"
        },
        "status_tier": {
          "anyOf": [
            {
              "enum": [
                "pass",
                "warn"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Status Tier"
        }
      },
      "required": [
        "material_difference_points",
        "reasons"
      ],
      "title": "Recommendation",
      "type": "object"
    }
  },
  "$id": "urn:sindri:contracts:1.0.0:candidate-comparison",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "candidates": {
      "items": {
        "$ref": "#/$defs/ComparisonEntry"
      },
      "maxItems": 100,
      "minItems": 1,
      "title": "Candidates",
      "type": "array"
    },
    "dominance": {
      "default": [],
      "items": {
        "$ref": "#/$defs/DominanceRecord"
      },
      "title": "Dominance",
      "type": "array"
    },
    "incompatibility_reasons": {
      "default": [],
      "items": {
        "type": "string"
      },
      "title": "Incompatibility Reasons",
      "type": "array"
    },
    "objective_vectors": {
      "default": [],
      "items": {
        "$ref": "#/$defs/ObjectiveVector"
      },
      "title": "Objective Vectors",
      "type": "array"
    },
    "policy": {
      "$ref": "#/$defs/EvaluationPolicyReference"
    },
    "recommendation": {
      "$ref": "#/$defs/Recommendation"
    },
    "schema_kind": {
      "const": "candidate_comparison",
      "default": "candidate_comparison",
      "title": "Schema Kind",
      "type": "string"
    },
    "schema_version": {
      "const": "1.0.0",
      "default": "1.0.0",
      "title": "Schema Version",
      "type": "string"
    }
  },
  "required": [
    "policy",
    "candidates",
    "recommendation"
  ],
  "title": "CandidateComparison",
  "type": "object",
  "x-sindri-contract-suite": "sindri.contracts",
  "x-sindri-contract-version": "1.0.0"
}
