{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/medianfi-com/json-schema/medianfi-com-quick-books-chart-push-preview-schema.json",
  "title": "QuickBooksChartPushPreview",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/medianfi-com-openapi.json#/components/schemas/QuickBooksChartPushPreview",
  "type": "object",
  "required": [
    "state",
    "cutoffDate",
    "sourceRunId",
    "unverifiedInventory",
    "transactionCount",
    "transactions",
    "entries"
  ],
  "properties": {
    "state": {
      "type": "string",
      "enum": [
        "new",
        "established",
        "unclassified",
        "inventory_unverified",
        "no_inventory"
      ]
    },
    "cutoffDate": {
      "type": [
        "string",
        "null"
      ],
      "format": "date",
      "description": "The posting cutoff; null before one is set (#2883)"
    },
    "sourceRunId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "The latest completed QuickBooks read the state is judged from"
    },
    "unverifiedInventory": {
      "type": "array",
      "description": "The failed prerequisite of `inventory_unverified` (#2883), one item per transaction type whose census does not match the rows the read stored. Empty in every other state.",
      "items": {
        "type": "object",
        "required": [
          "objectType",
          "reason",
          "expectedCount",
          "storedCount"
        ],
        "properties": {
          "objectType": {
            "type": "string",
            "enum": [
              "JournalEntry",
              "Purchase",
              "Deposit",
              "Transfer",
              "SalesReceipt",
              "RefundReceipt",
              "Invoice",
              "Bill",
              "Payment",
              "BillPayment",
              "CreditMemo",
              "VendorCredit"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "census_missing",
              "count_mismatch"
            ],
            "description": "`census_missing`: the read recorded no QuickBooks count for the type; `count_mismatch`: it stored a different number of rows"
          },
          "expectedCount": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "QuickBooks' count of the type during the read; null when missing"
          },
          "storedCount": {
            "type": "integer",
            "minimum": 0
          }
        }
      }
    },
    "transactionCount": {
      "type": "integer",
      "minimum": 0,
      "description": "Every QuickBooks transaction Median has read (latest completed read plus newer read attempts)"
    },
    "transactions": {
      "type": "array",
      "maxItems": 50,
      "description": "Those transactions, undated first and then by date, capped at 50. The warning list of an `unclassified` file (#2883).",
      "items": {
        "type": "object",
        "required": [
          "objectType",
          "txnDate",
          "amountCents",
          "currency"
        ],
        "properties": {
          "objectType": {
            "type": "string",
            "enum": [
              "JournalEntry",
              "Purchase",
              "Deposit",
              "Transfer",
              "SalesReceipt",
              "RefundReceipt",
              "Invoice",
              "Bill",
              "Payment",
              "BillPayment",
              "CreditMemo",
              "VendorCredit"
            ]
          },
          "txnDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "QuickBooks TxnDate; null when the object has none"
          },
          "amountCents": {
            "type": [
              "integer",
              "null"
            ],
            "description": "QuickBooks TotalAmt (Amount for a transfer) in integer minor units of `currency`; null when absent or not exactly representable"
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "The object's CurrencyRef, or the entity's functional currency when QuickBooks omits it"
          }
        }
      }
    },
    "entries": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "glAccountId",
          "code",
          "name",
          "action",
          "reason",
          "detail",
          "qboAccountId",
          "sourceObjectId",
          "accountType",
          "accountSubType",
          "parentGlAccountId",
          "parentQboAccountId",
          "depth"
        ],
        "properties": {
          "glAccountId": {
            "type": "string",
            "format": "uuid"
          },
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "map",
              "skip"
            ]
          },
          "reason": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "qboAccountId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The QuickBooks account a map entry maps to"
          },
          "sourceObjectId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "accountType": {
            "type": "string",
            "description": "QuickBooks AccountType Median would create it with"
          },
          "accountSubType": {
            "type": "string"
          },
          "parentGlAccountId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Parent created by the same chart push"
          },
          "parentQboAccountId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Parent already in QuickBooks"
          },
          "depth": {
            "type": "integer",
            "minimum": 0
          }
        }
      }
    }
  }
}