{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/saturation-io/json-schema/saturation-io-budget-phase-schema.json",
  "title": "BudgetPhase",
  "description": "A phase column in the budget.",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/saturation-io-openapi.yml#/components/schemas/BudgetPhase",
  "type": "object",
  "required": [
    "id",
    "type",
    "name",
    "sort",
    "isHidden"
  ],
  "additionalProperties": false,
  "properties": {
    "id": {
      "$ref": "#/$defs/Id"
    },
    "type": {
      "$ref": "#/$defs/PhaseType"
    },
    "name": {
      "type": "string",
      "description": "The phase name."
    },
    "alias": {
      "type": [
        "string",
        "null"
      ],
      "description": "A short name for the phase column."
    },
    "color": {
      "type": [
        "string",
        "null"
      ],
      "description": "The phase color."
    },
    "sort": {
      "type": "integer",
      "description": "The phase's display order."
    },
    "isHidden": {
      "type": "boolean",
      "description": "Whether the phase is hidden."
    },
    "displayDecimals": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "maximum": 4,
      "description": "Decimal places shown for phase amounts. Null uses the currency default."
    },
    "baseCurrencyId": {
      "description": "The phase currency. Used by estimate, actual, and rollup phases.",
      "oneOf": [
        {
          "$ref": "#/$defs/Id"
        },
        {
          "type": "null"
        }
      ]
    },
    "actualDateStart": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "actualDateEnd": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "actualStatuses": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "actualSourceTypes": {
      "type": [
        "array",
        "null"
      ],
      "description": "Sources included in an actual phase. Manual transactions use `manual`.",
      "items": {
        "type": "string"
      }
    },
    "actualCurrencies": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string",
        "minLength": 3,
        "maxLength": 3
      }
    },
    "actualContactId": {
      "oneOf": [
        {
          "$ref": "#/$defs/Id"
        },
        {
          "type": "null"
        }
      ]
    },
    "actualTagIds": {
      "type": "array",
      "maxItems": 10000,
      "items": {
        "$ref": "#/$defs/Id"
      }
    },
    "actualBudgetLineIds": {
      "type": [
        "array",
        "null"
      ],
      "maxItems": 10000,
      "items": {
        "$ref": "#/$defs/Id"
      }
    },
    "estimateTagIds": {
      "type": "array",
      "maxItems": 10000,
      "items": {
        "$ref": "#/$defs/Id"
      }
    },
    "overtimeFactors": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "qty",
          "x"
        ]
      }
    },
    "committedDateStart": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "committedDateEnd": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "committedContactId": {
      "oneOf": [
        {
          "$ref": "#/$defs/Id"
        },
        {
          "type": "null"
        }
      ]
    },
    "committedPhaseIds": {
      "type": "array",
      "maxItems": 10000,
      "items": {
        "$ref": "#/$defs/Id"
      }
    },
    "committedTagIds": {
      "type": "array",
      "maxItems": 10000,
      "items": {
        "type": "string"
      }
    },
    "committedPoStatuses": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "approved",
          "paymentRequested",
          "paymentRejected",
          "paymentProcessing"
        ]
      }
    },
    "rollupFormula": {
      "type": [
        "string",
        "null"
      ],
      "description": "The formula for a rollup phase."
    },
    "rollupDisplayMode": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "value",
        "percent",
        "bars",
        "margin",
        null
      ]
    }
  },
  "$defs": {
    "Id": {
      "type": "string",
      "description": "A stable resource ID, such as `prj_…`, `txn_…`, or `doc_…`."
    },
    "PhaseType": {
      "type": "string",
      "description": "The phase type. `payments` is the Payments phase: payments not yet sent, on their coded lines, as its filters in the app pick them. It is read-only in the API. More types may be added, so handle an unknown type.",
      "enum": [
        "estimate",
        "actual",
        "rollup",
        "committed",
        "payments"
      ]
    }
  }
}