{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/acculynx/json-schema/acculynx-financials-schema.json",
  "title": "financials",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/acculynx-financials-api-openapi.yml#/components/schemas/financials",
  "allOf": [
    {
      "$ref": "#/$defs/financialsLink"
    },
    {
      "type": "object",
      "properties": {
        "jobId": {
          "type": "string",
          "format": "uuid",
          "description": "The unique identifier of the Job these financials are for."
        },
        "approvedJobValue": {
          "type": "number",
          "description": "The current approved Job Value."
        },
        "balanceDue": {
          "type": "number",
          "description": "The current amount still owed on the job."
        },
        "worksheetSectionTotals": {
          "type": "object",
          "description": "The totals of the Worksheet Sections on the Worksheet including all Amendment(s).",
          "$ref": "#/$defs/worksheetSectionTotals"
        },
        "worksheet": {
          "description": "The Worksheet of the Job these financials are for.",
          "items": {
            "$ref": "#/$defs/worksheetLink"
          }
        },
        "amendments": {
          "type": "array",
          "description": "The Amendments of the Job these financials are for.",
          "items": {
            "$ref": "#/$defs/worksheetAmendmentLink"
          }
        }
      }
    }
  ],
  "$defs": {
    "financialsLink": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "The unique identifier of the Financials."
        },
        "_link": {
          "type": "string",
          "description": "The unique URI of the Financials for the specified Job."
        }
      }
    },
    "worksheetAmendmentLink": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "The unique identifier of the Amendment."
        },
        "_link": {
          "type": "string",
          "description": "The unique URI of the Amendment."
        }
      }
    },
    "worksheetLink": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "The unique identifier of the Worksheet."
        },
        "_link": {
          "type": "string",
          "description": "The unique URI of the Worksheet for the specified Job."
        }
      }
    },
    "worksheetSectionTotals": {
      "type": "object",
      "properties": {
        "worksheetTotal": {
          "type": "number",
          "description": "The total of all worksheet sections across both the Worksheet and any Amendment(s)."
        },
        "changeOrderTotal": {
          "type": "number",
          "description": "The total of all change order sections across both the Worksheet and any Amendment(s)."
        },
        "insuranceClaimTotal": {
          "type": "number",
          "description": "The total of all insurance claim sections across both the Worksheet and any Amendment(s)."
        },
        "upgradeTotal": {
          "type": "number",
          "description": "The total of all upgrade sections across both the Worksheet and any Amendment(s)."
        },
        "discountTotal": {
          "type": "number",
          "description": "The total of all discount sections across both the Worksheet and any Amendment(s)."
        },
        "supplementTotal": {
          "type": "number",
          "description": "The total of all supplement sections across both the Worksheet and any Amendment(s)."
        },
        "workNotDoingTotal": {
          "type": "number",
          "description": "The total of all work not doing sections across both the Worksheet and any Amendment(s)."
        }
      }
    }
  }
}