{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.demiton.io/registers/price_adjustment_verdict/v1.json",
  "title": "price_adjustment_verdict contract v1",
  "type": "object",
  "required": [
    "contract_terms_fact_id",
    "currency",
    "detail",
    "evidence_fact_ids",
    "financial_period",
    "formula_version",
    "progress_claim_fact_id",
    "project_entity_id",
    "status"
  ],
  "properties": {
    "lines": {
      "type": "array",
      "description": "one entry per basket line: the series read, its weight, and the base and current values with the count of observations each was taken from",
      "items": {
        "type": "object",
        "properties": {
          "base_value": {
            "type": [
              "number",
              "null"
            ]
          },
          "index_name": {
            "type": "string"
          },
          "series_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "weight_pct": {
            "type": "number"
          },
          "current_value": {
            "type": [
              "number",
              "null"
            ]
          },
          "base_observations": {
            "type": [
              "integer",
              "null"
            ]
          },
          "current_observations": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "index_name",
          "weight_pct"
        ]
      },
      "x-demiton-requiredness": "optional"
    },
    "detail": {
      "type": "string",
      "description": "a one-line explanation for display, naming the series, quarter or field concerned",
      "x-demiton-requiredness": "required"
    },
    "reason": {
      "type": "string",
      "description": "why the claim is waiting or blocked; required unless `status` is `ready`",
      "enum": [
        "clause_not_captured",
        "invoice_basis_not_built",
        "no_index",
        "index_not_published",
        "index_incomplete",
        "no_certified_amount",
        "no_currency"
      ],
      "x-demiton-requiredness": "optional"
    },
    "status": {
      "type": "string",
      "description": "`ready`: the adjustment is computed. `waiting`: an index the clause needs is not yet published. `blocked`: something the tenant can fix is missing, named in `reason`.",
      "enum": [
        "ready",
        "waiting",
        "blocked"
      ],
      "x-demiton-requiredness": "required"
    },
    "cap_used": {
      "type": "number",
      "description": "the running total of adjustments on this contract, this claim included",
      "x-demiton-requiredness": "optional"
    },
    "currency": {
      "type": "currency",
      "description": "the currency of every amount on this record (`certified_amount`, `adjustment`, `cap_amount`, `cap_used`), an ISO 4217 alpha-3 code. A record with no currency has no usable amount.",
      "x-demiton-requiredness": "required"
    },
    "direction": {
      "type": "string",
      "description": "`rise` when the adjustment is owed to the contractor, `fall` when the principal may deduct it, `nil` when the threshold zeroes it",
      "enum": [
        "rise",
        "fall",
        "nil"
      ],
      "x-demiton-requiredness": "optional"
    },
    "adjustment": {
      "type": "number",
      "description": "`certified_amount` times `adjusted_move`, rounded half up to the minor unit; negative on a fall",
      "x-demiton-requiredness": "optional"
    },
    "cap_amount": {
      "type": "number",
      "description": "the cap in money, when `escalation_cap_scope` is `cumulative`",
      "x-demiton-requiredness": "optional"
    },
    "base_period": {
      "type": "string",
      "description": "the clause's base index period",
      "x-demiton-requiredness": "optional"
    },
    "index_period": {
      "type": "string",
      "description": "the index period this claim reads: its work quarter moved back by the clause's lag",
      "x-demiton-requiredness": "optional"
    },
    "adjusted_move": {
      "type": "number",
      "description": "the weighted move over the adjustable share, after the threshold, as a fraction",
      "x-demiton-requiredness": "optional",
      "x-demiton-unit": "dimensionless"
    },
    "notice_due_on": {
      "type": "string",
      "description": "the last day the adjustment can be claimed, from `escalation_notice_days`",
      "x-demiton-requiredness": "optional",
      "format": "date",
      "x-demiton-type": "date"
    },
    "weighted_move": {
      "type": "number",
      "description": "the basket's weighted move, as a fraction (0.047 is 4.7%)",
      "x-demiton-requiredness": "optional",
      "x-demiton-unit": "dimensionless"
    },
    "formula_version": {
      "type": "string",
      "description": "the version of the adjustment formula that computed this record",
      "x-demiton-requiredness": "required"
    },
    "certified_amount": {
      "type": "number",
      "description": "the claim's certified amount the adjustment is made on",
      "x-demiton-requiredness": "optional"
    },
    "financial_period": {
      "type": "string",
      "description": "the claim's period, as `progress_claim.financial_period` states it",
      "x-demiton-requiredness": "required"
    },
    "evidence_fact_ids": {
      "type": "array",
      "description": "the facts the measurement read: the contract terms, the claim and every index observation",
      "x-demiton-requiredness": "required"
    },
    "project_entity_id": {
      "type": "integer",
      "description": "the project the contract is for",
      "x-demiton-requiredness": "required"
    },
    "contract_terms_fact_id": {
      "type": "integer",
      "description": "the contract_terms fact whose clause was read",
      "x-demiton-requiredness": "required"
    },
    "progress_claim_fact_id": {
      "type": "integer",
      "description": "the progress_claim fact measured",
      "x-demiton-requiredness": "required"
    }
  },
  "x-demiton-register-type": "price_adjustment_verdict",
  "x-demiton-contract-version": "1.0.0",
  "x-demiton-store": "tenant",
  "x-demiton-axes": [],
  "x-demiton-measures": [],
  "x-demiton-provenance": {
    "standards": []
  },
  "description": "The Price adjustment verdict 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/price_adjustment_verdict/",
  "x-demiton-register-catalog": "https://docs.demiton.io/concepts/register-catalog"
}