{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://askvouch.com/schemas/deal-package-readiness/borrowing-base-certificate/v0.1.0/borrowing-base-certificate.schema.json",
  "title": "Lending Deal-Package Readiness — borrowing-base certificate",
  "description": "The recurring evidence artifact of continuous readiness (readiness_mode: continuous — invoice finance, ABL, trade finance): eligible collateral, advance rate and availability, certified at a date by a named person. Completes the certificate MESSAGE format previously declared roadmap. Arithmetic coherence (eligible <= gross; availability <= eligible x advance_rate) is enforced by the reference validator (validate_bbc). See spec/borrowing-base.md. ABL borrowing bases carry MORE THAN ONE asset class: a receivables line and an inventory line, each with its own advance rate. The inventory fields are optional — a receivables-only facility omits them.",
  "type": "object",
  "required": [
    "standard",
    "certificate_version",
    "facility_ref",
    "period_start",
    "period_end",
    "gross_receivables",
    "eligible_receivables",
    "advance_rate",
    "availability",
    "certified_by",
    "certified_at"
  ],
  "properties": {
    "standard": {
      "const": "lending-deal-package-readiness/borrowing-base-certificate"
    },
    "certificate_version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    },
    "facility_ref": {
      "type": "string",
      "minLength": 1,
      "description": "The funder's or producer's reference for the live facility this certificate feeds."
    },
    "pack_ref": {
      "type": "string",
      "minLength": 1,
      "description": "Optional: the onboarding pack this facility was opened against (sha256:… identity)."
    },
    "period_start": {
      "type": "string",
      "description": "ISO date — start of the certified period."
    },
    "period_end": {
      "type": "string",
      "description": "ISO date — end of the certified period (the as-at date of the ledger positions)."
    },
    "gross_receivables": {
      "type": "number",
      "minimum": 0,
      "description": "Total sales-ledger receivables at period end, before exclusions."
    },
    "ineligible": {
      "type": "object",
      "additionalProperties": false,
      "description": "The exclusions, itemised — mirrors the receivables section's evidence fields.",
      "properties": {
        "aged_over_limit": {
          "type": "number",
          "minimum": 0
        },
        "concentration_excess": {
          "type": "number",
          "minimum": 0
        },
        "contra": {
          "type": "number",
          "minimum": 0
        },
        "export_excess": {
          "type": "number",
          "minimum": 0
        },
        "credit_notes_dilution": {
          "type": "number",
          "minimum": 0
        },
        "other": {
          "type": "number",
          "minimum": 0
        }
      }
    },
    "eligible_receivables": {
      "type": "number",
      "minimum": 0,
      "description": "Gross minus exclusions. MUST NOT exceed gross_receivables (validator-enforced)."
    },
    "advance_rate": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "The agreed advance rate as a 0–1 decimal fraction (0.85, never 85)."
    },
    "availability": {
      "type": "number",
      "minimum": 0,
      "description": "The borrowing base: MUST NOT exceed eligible_receivables x advance_rate (validator-enforced)."
    },
    "drawn_balance": {
      "type": "number",
      "minimum": 0
    },
    "headroom": {
      "type": "number",
      "description": "availability - drawn_balance (may be negative when over-advanced — an honest state, not an error)."
    },
    "certified_by": {
      "type": "string",
      "minLength": 1,
      "description": "Who certifies (name + capacity, e.g. 'B. Keeper, finance director of the applicant')."
    },
    "certified_at": {
      "type": "string",
      "description": "ISO date of certification."
    },
    "truth_statement": {
      "type": "string",
      "description": "Optional certification wording carried verbatim."
    },
    "gross_inventory": {
      "type": "number",
      "minimum": 0,
      "description": "Stock on hand at cost at the period end. OPTIONAL — a receivables-only facility omits the inventory line entirely."
    },
    "ineligible_inventory": {
      "type": "object",
      "additionalProperties": {
        "type": "number",
        "minimum": 0
      },
      "description": "Named deductions from gross inventory (aged/slow-moving, work in progress, stock at unwaived third-party sites, consignment)."
    },
    "eligible_inventory": {
      "type": "number",
      "minimum": 0,
      "description": "Gross inventory less the ineligible buckets."
    },
    "inventory_advance_rate": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Advance rate against ELIGIBLE INVENTORY as a decimal fraction in [0,1]. Ordinarily struck against appraised NOLV, so it is materially lower than the receivables rate."
    },
    "inventory_nolv_rate": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Appraised net orderly liquidation value as a decimal fraction of cost, in [0,1]."
    },
    "inventory_availability": {
      "type": "number",
      "minimum": 0,
      "description": "Availability contributed by the inventory line. Total facility availability is the receivables line plus this."
    }
  },
  "additionalProperties": false
}
