{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/oyster-hr/json-schema/oyster-hr-invoice-breakdown-schema.json",
  "title": "invoiceBreakdown",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/oyster-hr-invoices-api-openapi.yml#/components/schemas/invoiceBreakdown",
  "type": "array",
  "items": {
    "type": "object",
    "required": [
      "engagementId",
      "engagementName",
      "region",
      "startDate",
      "terminationDate",
      "serviceMonth",
      "cutoffDate",
      "fxRate",
      "total",
      "components"
    ],
    "properties": {
      "engagementId": {
        "type": "string"
      },
      "engagementName": {
        "type": "string"
      },
      "region": {
        "type": "string"
      },
      "startDate": {
        "type": "string",
        "format": "date"
      },
      "terminationDate": {
        "type": [
          "string",
          "null"
        ],
        "format": "date"
      },
      "serviceMonth": {
        "type": "string",
        "format": "date"
      },
      "cutoffDate": {
        "type": [
          "string",
          "null"
        ],
        "format": "date"
      },
      "fxRate": {
        "type": "object",
        "required": [
          "from",
          "to",
          "rate"
        ],
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "rate": {
            "type": "string"
          }
        }
      },
      "total": {
        "$ref": "#/$defs/invoiceAmount"
      },
      "components": {
        "$ref": "#/$defs/invoiceBreakdownComponents"
      }
    }
  },
  "$defs": {
    "invoiceAmount": {
      "type": "object",
      "properties": {
        "decimal": {
          "type": "string",
          "pattern": "^-?\\d+([.]\\d+)?$"
        },
        "currencyCode": {
          "type": "string",
          "minLength": 3,
          "maxLength": 3
        }
      },
      "required": [
        "decimal",
        "currencyCode"
      ]
    },
    "invoiceBreakdownComponentAmounts": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "type",
          "amount"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "amount": {
            "$ref": "#/$defs/invoiceAmount"
          }
        }
      }
    },
    "invoiceBreakdownComponents": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "type",
          "amounts"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "amounts": {
            "$ref": "#/$defs/invoiceBreakdownComponentAmounts"
          }
        }
      }
    }
  }
}