{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.demiton.io/registers/tender_lesson/v1.json",
  "title": "tender_lesson contract v1",
  "type": "object",
  "required": [
    "cause",
    "currency",
    "evidence_fact_ids",
    "from_value",
    "input_kind",
    "jobs_counted",
    "overrun_amount",
    "project_entity_id",
    "proposal",
    "status",
    "to_value",
    "unit",
    "weeks_in_breach",
    "work_activity"
  ],
  "properties": {
    "unit": {
      "type": "string",
      "description": "the unit of `from_value` and `to_value`",
      "x-demiton-requiredness": "required"
    },
    "cause": {
      "type": "string",
      "description": "the largest positive cost effect, or `bought` for a price set below the margin floor at decision time",
      "enum": [
        "rate",
        "norm",
        "quantity",
        "preliminaries",
        "escalation",
        "bought"
      ],
      "x-demiton-requiredness": "required"
    },
    "reason": {
      "type": "string",
      "description": "why it was declined; required when `status` is `declined`",
      "x-demiton-requiredness": "optional"
    },
    "status": {
      "type": "string",
      "description": "where the lesson stands",
      "enum": [
        "proposed",
        "accepted",
        "declined",
        "proven"
      ],
      "x-demiton-requiredness": "required"
    },
    "currency": {
      "type": "currency",
      "description": "the currency of every amount on this record (`overrun_amount`), an ISO 4217 alpha-3 code. A record with no currency has no usable amount.",
      "x-demiton-requiredness": "required"
    },
    "proposal": {
      "type": "string",
      "description": "the change in one line, as the estimating manager reads it",
      "x-demiton-requiredness": "required"
    },
    "to_value": {
      "type": "number",
      "description": "the proposed value: the median achieved across the jobs counted",
      "x-demiton-requiredness": "required"
    },
    "decided_at": {
      "type": "string",
      "description": "when it was accepted or declined; required once `status` is not `proposed`",
      "x-demiton-requiredness": "optional",
      "format": "date-time",
      "x-demiton-type": "datetime"
    },
    "from_value": {
      "type": "number",
      "description": "the input's value the jobs were priced on",
      "x-demiton-requiredness": "required"
    },
    "input_kind": {
      "type": "string",
      "description": "the kind of input the change touches",
      "enum": [
        "rate",
        "norm",
        "allowance"
      ],
      "x-demiton-requiredness": "required"
    },
    "jobs_counted": {
      "type": "integer",
      "description": "how many jobs priced on the input the median was taken over",
      "x-demiton-requiredness": "required"
    },
    "input_version": {
      "type": "integer",
      "description": "the `tender_input` version accepting it wrote",
      "x-demiton-requiredness": "optional"
    },
    "work_activity": {
      "type": "string",
      "description": "the work activity whose input the lesson would change",
      "x-demiton-requiredness": "required"
    },
    "overrun_amount": {
      "type": "number",
      "description": "the overrun on the activity the lesson came from, in `currency`",
      "x-demiton-requiredness": "required"
    },
    "at_stake_amount": {
      "type": "number",
      "description": "the priced value of open work still on `from_value`, the money the change would move",
      "x-demiton-requiredness": "optional"
    },
    "weeks_in_breach": {
      "type": "integer",
      "description": "consecutive weekly runs the input has been outside the band",
      "x-demiton-requiredness": "required"
    },
    "at_stake_currency": {
      "type": "currency",
      "description": "the currency of every amount on this record (`at_stake_amount`), an ISO 4217 alpha-3 code. A record with no currency has no usable amount. Present exactly when `at_stake_amount` is.",
      "x-demiton-requiredness": "optional"
    },
    "evidence_fact_ids": {
      "type": "array",
      "description": "the verdict facts the lesson rests on",
      "x-demiton-requiredness": "required"
    },
    "project_entity_id": {
      "type": "integer",
      "description": "the project the lesson was raised from",
      "x-demiton-requiredness": "required"
    },
    "decided_by_user_id": {
      "type": "integer",
      "description": "who accepted or declined it; required once `status` is not `proposed`",
      "x-demiton-requiredness": "optional"
    }
  },
  "x-demiton-register-type": "tender_lesson",
  "x-demiton-contract-version": "1.0.0",
  "x-demiton-store": "tenant",
  "x-demiton-axes": [],
  "x-demiton-measures": [],
  "x-demiton-provenance": {
    "standards": []
  },
  "description": "The Tender lesson register contract, version 1. JSON Schema (draft 2020-12); x-demiton-* keywords carry Demiton's own meaning and standard validators ignore them.",
  "x-demiton-contract-url": "https://docs.demiton.io/registers/tender_lesson/",
  "x-demiton-register-catalog": "https://docs.demiton.io/concepts/register-catalog"
}