{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/blackbaud/main/json-schema/blackbaud-line-item-detail-schema.json",
  "title": "LineItemDetail",
  "description": "Line item detail",
  "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/LineItemDetail",
  "type": "object",
  "properties": {
    "purchase_order_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The purchase order identifier of the line item.",
      "format": "int32"
    },
    "order_number": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The purchase order number of the line item.",
      "format": "int64"
    },
    "vendor_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The vendor identifier of the line item.",
      "format": "int32"
    },
    "vendor_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "The vendor name of the line item."
    },
    "distributions": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/Distribution"
      },
      "description": "The distributions of the line item."
    },
    "line_item_id": {
      "type": "integer",
      "description": "The identifier of the line item.",
      "format": "int32"
    },
    "line_number": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The number of the line item.",
      "format": "int32"
    },
    "type": {
      "$ref": "#/$defs/LineItemType"
    },
    "product_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The prodcut identifier of the line item.",
      "format": "int32"
    },
    "vendor_part_number": {
      "type": [
        "string",
        "null"
      ],
      "description": "The vendor part number of the line item."
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "The description of the line item."
    },
    "product_code": {
      "type": [
        "string",
        "null"
      ],
      "description": "The product code of the line item."
    },
    "quantity_ordered": {
      "type": [
        "number",
        "null"
      ],
      "description": "The quantity ordered of the line item.",
      "format": "decimal"
    },
    "quantity_received": {
      "type": [
        "number",
        "null"
      ],
      "description": "The quantity received of the line item.",
      "format": "decimal"
    },
    "quantity_cancelled": {
      "type": [
        "number",
        "null"
      ],
      "description": "The quantity cancelled of the line item.",
      "format": "decimal"
    },
    "quantity_rejected": {
      "type": [
        "number",
        "null"
      ],
      "description": "The quantity rejected of the line item.",
      "format": "decimal"
    },
    "unit_of_measure": {
      "type": [
        "string",
        "null"
      ],
      "description": "The unit of measure of the line item."
    },
    "unit_cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "The unit of cost of the line item.",
      "format": "decimal"
    },
    "extended_cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "The extended cost of the line item.",
      "format": "decimal"
    },
    "post_status": {
      "$ref": "#/$defs/PostStatus"
    },
    "post_date": {
      "type": [
        "string",
        "null"
      ],
      "description": "The post date of the line item.",
      "format": "date-time"
    },
    "comments": {
      "type": [
        "string",
        "null"
      ],
      "description": "The comments of the line item."
    },
    "status": {
      "$ref": "#/$defs/LineItemStatus"
    },
    "deliver_to": {
      "type": [
        "string",
        "null"
      ],
      "description": "The staff member to deliver to for the line item."
    },
    "department": {
      "type": [
        "string",
        "null"
      ],
      "description": "The department of the line item."
    },
    "date_added": {
      "type": [
        "string",
        "null"
      ],
      "description": "The date the line item was added.",
      "format": "date-time"
    },
    "added_by": {
      "type": [
        "string",
        "null"
      ],
      "description": "The creator of the line item."
    },
    "date_modified": {
      "type": [
        "string",
        "null"
      ],
      "description": "The date the line item was modified.",
      "format": "date-time"
    },
    "modified_by": {
      "type": [
        "string",
        "null"
      ],
      "description": "The modifier of the line item."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "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"
    },
    "LineItemStatus": {
      "title": "LineItemStatus",
      "enum": [
        "NotReceipted",
        "PartiallyReceipted",
        "FullyReceipted"
      ],
      "type": "string",
      "description": "The status of a line item."
    },
    "LineItemType": {
      "title": "LineItemType",
      "enum": [
        "Regular",
        "Miscellaneous",
        "Comment"
      ],
      "type": "string",
      "description": "Line item possible enummarated types."
    },
    "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"
    }
  }
}