{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/blackbaud/main/json-schema/blackbaud-credit-memo-detail-schema.json",
  "title": "CreditMemoDetail",
  "description": "Class for credit memo summary contract",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blackbaud-accounts-payable-api-openapi.yml#/components/schemas/CreditMemoDetail",
  "required": [
    "amount"
  ],
  "type": "object",
  "properties": {
    "credit_memo_id": {
      "type": "integer",
      "description": "The credit memo identifier.",
      "format": "int32"
    },
    "vendor_id": {
      "type": "integer",
      "description": "The id of the vendor for this credit memo.",
      "format": "int32"
    },
    "vendor_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "The name of the vendor for this credit memo."
    },
    "date": {
      "type": [
        "string",
        "null"
      ],
      "description": "The date for the credit memo.",
      "format": "date-time"
    },
    "reversal_date": {
      "type": [
        "string",
        "null"
      ],
      "description": "The reversal date for the credit memo.",
      "format": "date-time"
    },
    "amount": {
      "type": "number",
      "description": "The amount of this credit memo.",
      "format": "decimal"
    },
    "credit_applied": {
      "type": [
        "number",
        "null"
      ],
      "description": "The credit amount applied from this credit memo.",
      "format": "decimal"
    },
    "credit_remaining": {
      "type": [
        "number",
        "null"
      ],
      "description": "The credit amount remaining from this credit memo.",
      "format": "decimal"
    },
    "credit_memo_number": {
      "type": [
        "string",
        "null"
      ],
      "description": "The credit memo number."
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "The description for this credit memo."
    },
    "status": {
      "$ref": "#/$defs/CreditMemoStatus"
    },
    "post_status": {
      "$ref": "#/$defs/PostStatus"
    },
    "post_date": {
      "type": [
        "string",
        "null"
      ],
      "description": "The post date for this credit memo.",
      "format": "date-time"
    },
    "distributions": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/Distribution"
      },
      "description": "The distributions of this credit memo."
    },
    "custom_fields": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/CustomField"
      },
      "description": "The custom fields on this credit memo."
    },
    "invoice_applications": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/CreditMemoInvoiceApplicationDetail"
      },
      "description": "The invoice applications for this credit memo."
    },
    "form_1099_box_numbers": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/InvoiceBoxNumber"
      },
      "description": "The form 1099 box numbers credit memo."
    },
    "date_added": {
      "type": [
        "string",
        "null"
      ],
      "description": "The created date of the credit memo.",
      "format": "date-time"
    },
    "date_modified": {
      "type": [
        "string",
        "null"
      ],
      "description": "The modified date of the credit memo.",
      "format": "date-time"
    },
    "added_by": {
      "type": [
        "string",
        "null"
      ],
      "description": "The creator of the credit memo."
    },
    "modified_by": {
      "type": [
        "string",
        "null"
      ],
      "description": "The modifier of the credit memo."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "CreditMemoInvoiceApplicationDetail": {
      "type": "object",
      "properties": {
        "invoice_id": {
          "type": "integer",
          "description": "The invoice identifier for this application.",
          "format": "int32"
        },
        "invoice_number": {
          "type": [
            "string",
            "null"
          ],
          "description": "The number of this invoice."
        },
        "invoice_amount": {
          "type": "number",
          "description": "The total amount for this invoice.",
          "format": "decimal"
        },
        "invoice_balance": {
          "type": "number",
          "description": "The remaining balance of this invoice.",
          "format": "decimal"
        },
        "credit_memo_amount_applied": {
          "type": "number",
          "description": "The credit memo amount applied to this invoice.",
          "format": "decimal"
        },
        "post_date": {
          "type": [
            "string",
            "null"
          ],
          "description": "The post date of this invoice application.",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    },
    "CreditMemoStatus": {
      "title": "CreditMemoStatus",
      "enum": [
        "Applied",
        "Unapplied",
        "PartiallyApplied",
        "Deleted"
      ],
      "type": "string"
    },
    "CustomField": {
      "type": "object",
      "properties": {
        "field_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "The name of the custom field."
        },
        "value": {
          "type": [
            "string",
            "null"
          ],
          "description": "The value of the custom field."
        },
        "comments": {
          "type": [
            "string",
            "null"
          ],
          "description": "The description of the custom field."
        },
        "type": {
          "$ref": "#/$defs/CustomFieldDataType"
        },
        "is_required": {
          "type": "boolean",
          "description": "Required status of the custom field."
        },
        "date": {
          "type": [
            "string",
            "null"
          ],
          "description": "The date on this custom field.",
          "format": "date-time"
        }
      },
      "additionalProperties": false,
      "description": "Custom field definition."
    },
    "CustomFieldDataType": {
      "title": "CustomFieldDataType",
      "enum": [
        "Text",
        "Number",
        "DateTime",
        "Currency",
        "Boolean",
        "Table",
        "FuzzyDate"
      ],
      "type": "string"
    },
    "Distribution": {
      "required": [
        "distribution_splits"
      ],
      "type": "object",
      "properties": {
        "distribution_id": {
          "type": "integer",
          "description": "The distribution identifier.",
          "format": "int32"
        },
        "distribution_splits": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DistributionSplit"
          },
          "description": "The distribution split."
        },
        "amount": {
          "type": "number",
          "description": "The distribution amount.",
          "format": "decimal"
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "The description for this distribution."
        },
        "account_number": {
          "type": [
            "string",
            "null"
          ],
          "description": "The account number for this distribution."
        },
        "type_code": {
          "$ref": "#/$defs/DistributionTypeCode"
        },
        "custom_fields": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/CustomField"
          },
          "description": "The custom fields of the distribution."
        }
      },
      "additionalProperties": false,
      "description": "Distribution."
    },
    "DistributionSplit": {
      "required": [
        "transaction_code_values"
      ],
      "type": "object",
      "properties": {
        "distribution_split_id": {
          "type": "integer",
          "description": "The distribution split identifier.",
          "format": "int32"
        },
        "ui_project_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The user-visible identifier of the project."
        },
        "transaction_code_values": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TransactionCodeValue"
          },
          "description": "The distribution transaction code values. The values should be in the same order as the codes defined in the database."
        },
        "amount": {
          "type": [
            "number",
            "null"
          ],
          "description": "The distribution journal entry amount. Only one of Amount or Percent can be specified.",
          "format": "decimal"
        },
        "percent": {
          "type": [
            "number",
            "null"
          ],
          "description": "The distribution journal entry amount percentage. Only one of Amount or Percent can be specified.",
          "format": "decimal"
        },
        "account_class": {
          "type": [
            "string",
            "null"
          ],
          "description": "The account class for this distribution split."
        }
      },
      "additionalProperties": false,
      "description": "Journal Entry Distribution."
    },
    "DistributionTypeCode": {
      "title": "DistributionTypeCode",
      "enum": [
        "Debit",
        "Credit"
      ],
      "type": "string",
      "description": "The type code for the distribution, debit or credit"
    },
    "InvoiceBoxNumber": {
      "type": "object",
      "properties": {
        "number": {
          "type": [
            "string",
            "null"
          ],
          "description": "The number for the box number."
        },
        "state": {
          "type": [
            "string",
            "null"
          ],
          "description": "The reporting state for the box number."
        },
        "amount": {
          "type": [
            "number",
            "null"
          ],
          "description": "The amount for the box number.",
          "format": "decimal"
        }
      },
      "additionalProperties": false,
      "description": "The contract for invoice box number."
    },
    "PostStatus": {
      "title": "PostStatus",
      "enum": [
        "DoNotPost",
        "NotYetPosted",
        "Posted"
      ],
      "type": "string"
    },
    "TransactionCodeValue": {
      "required": [
        "id",
        "value"
      ],
      "type": "object",
      "properties": {
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "The transaction code name."
        },
        "value": {
          "type": "string",
          "description": "The transaction code value."
        },
        "id": {
          "type": "integer",
          "description": "The transaction code value id.",
          "format": "int32"
        },
        "inactive": {
          "type": "boolean",
          "description": "Indicate if record is inactive or not."
        }
      },
      "additionalProperties": false,
      "description": "Transaction code value"
    }
  }
}