{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.demiton.io/registers/rate_card_verdict/v1.json",
  "title": "rate_card_verdict contract v1",
  "type": "object",
  "required": [
    "currency",
    "detail",
    "evidence_fact_ids",
    "formula_version",
    "run_on",
    "status",
    "subject_kind"
  ],
  "properties": {
    "asset": {
      "type": "string",
      "description": "the machine, when `subject_kind` is `plant`",
      "x-demiton-requiredness": "optional",
      "x-demiton-reference": true
    },
    "detail": {
      "type": "string",
      "description": "a one-line explanation for display",
      "x-demiton-requiredness": "required"
    },
    "reason": {
      "type": "string",
      "description": "why no rate can be proposed; required when `status` is `blocked`",
      "enum": [
        "no_item_master_row",
        "no_currency_or_tax_basis",
        "no_target_margin",
        "no_purchase_price",
        "stale_price_no_series",
        "no_charge_rate",
        "no_burn_rate",
        "no_fuel_price"
      ],
      "x-demiton-requiredness": "optional"
    },
    "run_on": {
      "type": "string",
      "description": "the date of the run that measured it",
      "x-demiton-requiredness": "required",
      "format": "date",
      "x-demiton-type": "date"
    },
    "status": {
      "type": "string",
      "description": "`ready`: a new rate is proposed. `holds`: the current rate meets its target at replacement cost, so nothing is proposed. `approved`: a person approved the proposed rate and the register does not yet carry it. `applied`: a person approved a rate and the register now carries it or more. `blocked`: something is missing, named in `reason`.",
      "enum": [
        "ready",
        "holds",
        "approved",
        "applied",
        "blocked"
      ],
      "x-demiton-requiredness": "required"
    },
    "item_no": {
      "type": "string",
      "description": "the item, when `subject_kind` is `item`",
      "x-demiton-requiredness": "optional",
      "x-demiton-reference": true
    },
    "burn_lph": {
      "type": "number",
      "description": "for a machine: litres per hour, from its fuel usage",
      "x-demiton-requiredness": "optional",
      "x-demiton-unit": "L/h"
    },
    "currency": {
      "type": "currency",
      "description": "the currency of every amount on this record (`current_rate`, `replacement_cost`, `proposed_rate`, `restocking_gap`, `fuel_pass_through`), an ISO 4217 alpha-3 code. A record with no currency has no usable amount.",
      "x-demiton-requiredness": "required"
    },
    "margin_now": {
      "type": "number",
      "description": "(sell less book cost) over sell, as a fraction; absent when no book cost is held",
      "x-demiton-requiredness": "optional",
      "x-demiton-unit": "dimensionless"
    },
    "current_rate": {
      "type": "number",
      "description": "the sell price or charge rate in force",
      "x-demiton-requiredness": "optional"
    },
    "subject_kind": {
      "type": "string",
      "description": "whether this record is about an item or a machine",
      "enum": [
        "item",
        "plant"
      ],
      "x-demiton-requiredness": "required"
    },
    "approved_rate": {
      "type": "number",
      "description": "the rate a person approved; present when `status` is `approved` or `applied`",
      "x-demiton-requiredness": "optional"
    },
    "proposed_rate": {
      "type": "number",
      "description": "the rate that restores the target; absent unless `status` is `ready`",
      "x-demiton-requiredness": "optional"
    },
    "aged_to_period": {
      "type": "string",
      "description": "the index period it was aged to",
      "x-demiton-requiredness": "optional"
    },
    "restocking_gap": {
      "type": "number",
      "description": "(proposed less current) times the quantity on hand; 0 when nothing is held",
      "x-demiton-requiredness": "optional"
    },
    "formula_version": {
      "type": "string",
      "description": "the version of the rate-card formula that computed this record",
      "x-demiton-requiredness": "required"
    },
    "aged_from_period": {
      "type": "string",
      "description": "the index period of that purchase, when it was aged",
      "x-demiton-requiredness": "optional"
    },
    "replacement_cost": {
      "type": "number",
      "description": "for an item: the last price paid, aged by its series when the series is newer",
      "x-demiton-requiredness": "optional"
    },
    "evidence_fact_ids": {
      "type": "array",
      "description": "the facts the measurement read: the item or rate, the purchase, the fuel usage and every price observation",
      "x-demiton-requiredness": "required"
    },
    "fuel_pass_through": {
      "type": "number",
      "description": "for a machine: the change in fuel cost per `rate_unit`, net of GST and fuel tax credits",
      "x-demiton-requiredness": "optional"
    },
    "target_margin_pct": {
      "type": "number",
      "description": "the item's target margin, 0 to 100",
      "x-demiton-requiredness": "optional",
      "x-demiton-unit": "percent"
    },
    "replacement_source": {
      "type": "string",
      "description": "where the replacement cost came from",
      "enum": [
        "purchase_line",
        "last_direct_cost",
        "aged_by_index"
      ],
      "x-demiton-requiredness": "optional"
    },
    "margin_at_replacement": {
      "type": "number",
      "description": "(sell less replacement cost) over sell, as a fraction",
      "x-demiton-requiredness": "optional",
      "x-demiton-unit": "dimensionless"
    },
    "replacement_observed_on": {
      "type": "string",
      "description": "the date of the purchase the replacement cost starts from",
      "x-demiton-requiredness": "optional",
      "format": "date",
      "x-demiton-type": "date"
    }
  },
  "x-demiton-register-type": "rate_card_verdict",
  "x-demiton-contract-version": "1.1.0",
  "x-demiton-store": "tenant",
  "x-demiton-axes": [],
  "x-demiton-measures": [],
  "x-demiton-provenance": {
    "standards": []
  },
  "description": "The Rate card 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/rate_card_verdict/",
  "x-demiton-register-catalog": "https://docs.demiton.io/concepts/register-catalog"
}