{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:coos:schema:Fund",
  "title": "Fund",
  "description": "A fund held by the strata corporation, such as the operating fund or the contingency reserve fund (CRF).",
  "type": "object",
  "x-domain": "financial",
  "x-status": "proposed",
  "x-since": "0.1.0-draft",
  "x-relationships": [
    {
      "field": "strataCorporationId",
      "target": "StrataCorporation",
      "cardinality": "one",
      "required": true
    }
  ],
  "x-validationRules": [
    "balanceDate is required when balance is present.",
    "A strata corporation should have exactly one operating fund and one contingency reserve fund."
  ],
  "x-legalReviewNotes": [
    "Fund definitions summarise the Strata Property Act; legal review required before marking stable."
  ],
  "required": [
    "id",
    "strataCorporationId",
    "fundType",
    "name"
  ],
  "additionalProperties": false,
  "properties": {
    "id": {
      "$ref": "urn:coos:schema:common#/$defs/Identifier",
      "description": "Stable identifier of this Fund record."
    },
    "strataCorporationId": {
      "$ref": "urn:coos:schema:common#/$defs/Identifier",
      "description": "The strata corporation this record belongs to.",
      "x-references": "StrataCorporation"
    },
    "fundType": {
      "type": "string",
      "description": "Kind of fund.",
      "enum": [
        "operating",
        "contingencyReserve",
        "specialLevy",
        "other"
      ],
      "x-enumDescriptions": {
        "operating": "Operating fund, for common expenses that usually occur once a year or more often.",
        "contingencyReserve": "Contingency reserve fund (CRF), for common expenses that usually occur less often than once a year or that do not usually occur.",
        "specialLevy": "Money raised by a special levy and held for its approved purpose.",
        "other": "Any other fund."
      }
    },
    "name": {
      "type": "string",
      "description": "Name used by the corporation.",
      "maxLength": 120
    },
    "balance": {
      "$ref": "urn:coos:schema:common#/$defs/Money",
      "description": "Balance as of balanceDate."
    },
    "balanceDate": {
      "$ref": "urn:coos:schema:common#/$defs/Date",
      "description": "Date the balance applies to."
    },
    "extensions": {
      "$ref": "urn:coos:schema:common#/$defs/Extensions",
      "description": "Implementation-specific data, namespaced by reverse domain."
    }
  }
}
