{
  "$defs": {
    "AllowedValuesCriterion": {
      "additionalProperties": false,
      "properties": {
        "allowed_values": {
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "title": "Allowed Values",
          "type": "array"
        },
        "criterion_type": {
          "const": "allowed_values",
          "default": "allowed_values",
          "title": "Criterion Type",
          "type": "string"
        }
      },
      "required": [
        "allowed_values"
      ],
      "title": "AllowedValuesCriterion",
      "type": "object"
    },
    "ApplicabilityKind": {
      "enum": [
        "spacecraft",
        "subsystem",
        "component",
        "mode",
        "scenario"
      ],
      "title": "ApplicabilityKind",
      "type": "string"
    },
    "ApplicabilityReference": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "$ref": "#/$defs/ApplicabilityKind"
        },
        "target_id": {
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
          "title": "Target Id",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "target_id"
      ],
      "title": "ApplicabilityReference",
      "type": "object"
    },
    "BooleanCriterion": {
      "additionalProperties": false,
      "properties": {
        "criterion_type": {
          "const": "boolean",
          "default": "boolean",
          "title": "Criterion Type",
          "type": "string"
        },
        "expected": {
          "title": "Expected",
          "type": "boolean"
        }
      },
      "required": [
        "expected"
      ],
      "title": "BooleanCriterion",
      "type": "object"
    },
    "EngineeringDomain": {
      "enum": [
        "system",
        "mission",
        "environment",
        "mass",
        "power",
        "thermal",
        "propulsion",
        "adcs",
        "communications",
        "launch",
        "lifetime",
        "cost",
        "geometry",
        "placement",
        "deployables",
        "operations"
      ],
      "title": "EngineeringDomain",
      "type": "string"
    },
    "EngineeringStatementKind": {
      "enum": [
        "requirement",
        "preference",
        "assumption",
        "objective",
        "authorization",
        "acceptance",
        "proposed_change"
      ],
      "title": "EngineeringStatementKind",
      "type": "string"
    },
    "RangeCriterion": {
      "additionalProperties": false,
      "properties": {
        "criterion_type": {
          "const": "range",
          "default": "range",
          "title": "Criterion Type",
          "type": "string"
        },
        "maximum": {
          "title": "Maximum",
          "type": "number"
        },
        "maximum_inclusive": {
          "default": true,
          "title": "Maximum Inclusive",
          "type": "boolean"
        },
        "minimum": {
          "title": "Minimum",
          "type": "number"
        },
        "minimum_inclusive": {
          "default": true,
          "title": "Minimum Inclusive",
          "type": "boolean"
        }
      },
      "required": [
        "minimum",
        "maximum"
      ],
      "title": "RangeCriterion",
      "type": "object"
    },
    "ScalarCriterion": {
      "additionalProperties": false,
      "properties": {
        "criterion_type": {
          "const": "scalar",
          "default": "scalar",
          "title": "Criterion Type",
          "type": "string"
        },
        "operator": {
          "$ref": "#/$defs/ScalarOperator"
        },
        "tolerance": {
          "anyOf": [
            {
              "exclusiveMinimum": 0.0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Tolerance"
        },
        "value": {
          "title": "Value",
          "type": "number"
        }
      },
      "required": [
        "operator",
        "value"
      ],
      "title": "ScalarCriterion",
      "type": "object"
    },
    "ScalarOperator": {
      "enum": [
        "lt",
        "le",
        "eq",
        "ge",
        "gt",
        "approx"
      ],
      "title": "ScalarOperator",
      "type": "string"
    }
  },
  "$id": "urn:sindri:contracts:1.0.0:engineering-statement",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "applies_to": {
      "items": {
        "$ref": "#/$defs/ApplicabilityReference"
      },
      "minItems": 1,
      "title": "Applies To",
      "type": "array"
    },
    "authority": {
      "anyOf": [
        {
          "maxLength": 200,
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Authority"
    },
    "criterion": {
      "discriminator": {
        "mapping": {
          "allowed_values": "#/$defs/AllowedValuesCriterion",
          "boolean": "#/$defs/BooleanCriterion",
          "range": "#/$defs/RangeCriterion",
          "scalar": "#/$defs/ScalarCriterion"
        },
        "propertyName": "criterion_type"
      },
      "oneOf": [
        {
          "$ref": "#/$defs/ScalarCriterion"
        },
        {
          "$ref": "#/$defs/RangeCriterion"
        },
        {
          "$ref": "#/$defs/BooleanCriterion"
        },
        {
          "$ref": "#/$defs/AllowedValuesCriterion"
        }
      ],
      "title": "Criterion"
    },
    "domain": {
      "$ref": "#/$defs/EngineeringDomain"
    },
    "evidence_source_ids": {
      "default": [],
      "items": {
        "maxLength": 128,
        "minLength": 1,
        "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
        "type": "string"
      },
      "title": "Evidence Source Ids",
      "type": "array"
    },
    "kind": {
      "$ref": "#/$defs/EngineeringStatementKind"
    },
    "metric_id": {
      "maxLength": 128,
      "minLength": 1,
      "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
      "title": "Metric Id",
      "type": "string"
    },
    "rationale": {
      "anyOf": [
        {
          "maxLength": 1000,
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Rationale"
    },
    "statement_id": {
      "maxLength": 128,
      "minLength": 1,
      "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$",
      "title": "Statement Id",
      "type": "string"
    }
  },
  "required": [
    "statement_id",
    "kind",
    "domain",
    "metric_id",
    "criterion",
    "applies_to"
  ],
  "title": "EngineeringStatement",
  "type": "object",
  "x-sindri-contract-suite": "sindri.contracts",
  "x-sindri-contract-version": "1.0.0"
}
