{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://uwmd.org/schemas/expense-targeted-capex.schema.json",
  "title": "expense-targeted-capex",
  "description": "RFC 0057 / format 4.8. Capital spend bought to reduce a named operating expense. The saving is STATED, never applied: nothing subtracts annual_savings from an expense line, from EGI or from NOI. in_noi_model records whether the author already did (CAPX-07). Shape only; the target check and the payback verification are semantic (CAPX-06, CAPX-08).",
  "type": "object",
  "additionalProperties": false,
  "required": ["label", "amount", "targets", "annual_savings", "savings_begin", "in_noi_model"],
  "properties": {
    "label": {
      "type": "string",
      "minLength": 1
    },
    "amount": {
      "description": "The capital spend.",
      "type": "number",
      "minimum": 0
    },
    "targets": {
      "description": "The noi_model.expenses key this project reduces. Checked against the keys actually present, not a closed list, so module expense lines keep working.",
      "type": "string",
      "minLength": 1
    },
    "annual_savings": {
      "description": "Stated by the author. Never modeled and never applied.",
      "type": "number",
      "minimum": 0
    },
    "savings_begin": {
      "description": "An RFC 0041 period selector: Y1+, YYYY-Qn, YYYY-MM or YYYY-MM-DD.",
      "type": "string",
      "pattern": "^(Y[1-9][0-9]*|[0-9]{4}-Q[1-4]|[0-9]{4}-(0[1-9]|1[0-2])|[0-9]{4}-[0-9]{2}-[0-9]{2})$"
    },
    "in_noi_model": {
      "description": "Whether this saving is already reflected in noi_model. Required: a stated saving with no such flag is how a document gets double-counted.",
      "type": "boolean"
    },
    "simple_payback_years": {
      "description": "Stated and verified as amount / annual_savings. Refused against zero savings (CAPX-08).",
      "type": ["number", "null"],
      "minimum": 0
    }
  }
}
