{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://safr.vc/schema/quarterly-update/v0.06.json",
  "title": "SAFR Reporting Standard: Quarterly Update",
  "description": "Canonical quarterly payload for the SAFR Reporting Standard, schema version 0.06 (major version 0). One coherent schema: attestation is a conditional layer within it, not a separate document. When meta.attestation_grade is 2, the attestation object is required; at grade 1 it is absent. Field-level x-tier marks distribution: 'visible' fields flow to the Visibility tier (invitational, need-to-know; never a public listing); 'holder' fields flow to the Holder tier only. The raw ledger never leaves the venture; only this schema-shaped output does, by the venture's standing grant. Calculations are defined in the SAFR Reporting Standard spec; x-canonical-constants below mirrors the controlling numbers for machine use.",
  "type": "object",
  "required": ["meta", "balance", "development", "revenue_streams", "cashflow_ttm", "computed", "quarter"],
  "properties": {
    "meta": {
      "type": "object",
      "x-tier": "visible",
      "required": ["schema_version", "venture_id", "fiscal_quarter_end", "issued_at", "attestation_grade", "currency"],
      "properties": {
        "schema_version": { "type": "string", "const": "0.06" },
        "major_version": { "type": "integer", "const": 0 },
        "venture_id": { "type": "string" },
        "legal_name": { "type": "string", "x-tier": "visible" },
        "fiscal_quarter_end": { "type": "string", "format": "date", "description": "The fiscal quarter-end this update covers (Mar 31, Jun 30, Sep 30, or Dec 31). The reference data period is the trailing twelve months ending on this date." },
        "issued_at": { "type": "string", "format": "date-time", "description": "Issuance timestamp; must fall within 45 days after fiscal_quarter_end." },
        "attestation_grade": { "type": "integer", "enum": [1, 2], "description": "1 = self-attested conforming feed; 2 = independent third-party attestation of the Ledger Base computation. Grade 2 is required for all graduations." },
        "currency": { "type": "string", "default": "USD" },
        "reporting_lapse_cured": { "type": "boolean", "default": false, "description": "True if this update cures or follows a Reporting Lapse; details in quarter.commentary." }
      }
    },
    "balance": {
      "type": "object",
      "x-tier": "holder",
      "description": "Balance inputs at fiscal_quarter_end. Aggregates only; no counterparty identities.",
      "required": ["cash", "accounts_receivable", "inventory", "equipment_net", "total_liabilities"],
      "properties": {
        "cash": { "type": "number", "minimum": 0 },
        "accounts_receivable": { "type": "number", "minimum": 0 },
        "inventory": { "type": "number", "minimum": 0 },
        "equipment_net": { "type": "number", "minimum": 0, "description": "Equipment at depreciated cost." },
        "other_tangible": { "type": "number", "minimum": 0, "default": 0 },
        "total_liabilities": { "type": "number", "minimum": 0 }
      }
    },
    "development": {
      "type": "object",
      "x-tier": "holder",
      "required": ["monthly_qualified_dev_spend"],
      "properties": {
        "monthly_qualified_dev_spend": {
          "type": "array",
          "description": "Qualifying product development spend at cost, per Reporting Standard category rules, given as a per-month series sufficient to compute the vintaged Qualified Development Asset. Each month of spend amortizes straight-line over its own 36 months, so the asset equals the sum over entries of amount times max(0, 1 - month_offset/36). At least the trailing 36 months must be supplied; spend with a month_offset of 36 or more contributes nothing.",
          "minItems": 36,
          "items": {
            "type": "object",
            "required": ["month_offset", "amount"],
            "properties": {
              "month_offset": { "type": "integer", "minimum": 0, "description": "Months before the reference period end; 0 is the most recent month. The amortization weight for this month is max(0, 1 - month_offset/36)." },
              "amount": { "type": "number", "minimum": 0, "description": "Qualifying development spend recorded in that month, at cost." }
            }
          }
        }
      }
    },
    "revenue_streams": {
      "type": "array",
      "x-tier": "visible",
      "description": "Revenue valued stream by stream for Forward Revenue Value, each stream by exactly one method fixed by a mechanical test. Quality mix is Visible; no customer identities ever. A stream takes the present-value method if, and only if, it is a signed contract whose term at signing is at least contract_term_threshold_months (12); otherwise it takes a quality multiple on its trailing-twelve-month revenue.",
      "items": {
        "type": "object",
        "required": ["quality", "is_signed_contract", "term_at_signing_months", "annual_contracted_amount", "ttm_amount"],
        "properties": {
          "quality": { "type": "string", "enum": ["recurring", "repeat", "one_time"], "description": "Quality tag for the multiple method: recurring 2.0, repeat 1.0, one_time 0.25. Not used when the present-value method applies." },
          "is_signed_contract": { "type": "boolean", "description": "True if the stream is under a signed contract. A signed contract whose term_at_signing_months is at least contract_term_threshold_months (12) takes the present-value method." },
          "term_at_signing_months": { "type": "integer", "minimum": 0, "description": "Contract term in months as of signing. Compared once against contract_term_threshold_months (12) to fix the method; the method does not change quarter to quarter." },
          "annual_contracted_amount": { "type": "number", "minimum": 0, "description": "Annual contracted amount C for the present-value method. The stream's value equals C times (1 minus 1.10 to the power of negative n), divided by 0.10, with n the remaining contract term in years; it glides to zero as the remaining term runs off. Zero when the multiple method applies." },
          "ttm_amount": { "type": "number", "minimum": 0, "description": "Trailing-twelve-month revenue for the multiple method, valued at the stream's quality multiple. Zero when the present-value method applies." }
        }
      }
    },
    "cashflow_ttm": {
      "type": "object",
      "x-tier": "holder",
      "required": ["free_cash_flow", "operating_expenses_monthly_avg"],
      "properties": {
        "free_cash_flow": { "type": "number", "description": "Trailing-twelve-month free cash flow; may be negative." },
        "operating_expenses_monthly_avg": { "type": "number", "minimum": 0, "description": "Trailing average monthly operating expenses; drives the 6-month working-capital floor." }
      }
    },
    "computed": {
      "type": "object",
      "x-tier": "visible",
      "description": "Outputs of the canonical formulas, recomputable by any party from Holder-tier inputs. The analyst is the formula.",
      "required": ["ledger_base", "expected_capacity", "working_capital_floor"],
      "properties": {
        "ledger_base": {
          "type": "object",
          "required": ["total"],
          "properties": {
            "tangible_net_assets": { "type": "number" },
            "qualified_development_asset": { "type": "number", "minimum": 0 },
            "forward_revenue_value": { "type": "number", "minimum": 0 },
            "total": { "type": "number" }
          }
        },
        "ledger_base_per_fd_share": { "type": "number", "minimum": 0, "x-tier": "holder", "description": "Conversion price input: Ledger Base divided by fully diluted shares." },
        "fully_diluted_shares": { "type": "integer", "minimum": 0, "x-tier": "holder" },
        "expected_capacity": { "type": "number", "minimum": 0, "description": "min(0.25 x max(0, TTM FCF), max(0, cash minus working_capital_floor)), floored at zero." },
        "working_capital_floor": { "type": "number", "minimum": 0, "description": "6 x operating_expenses_monthly_avg." }
      }
    },
    "quarter": {
      "type": "object",
      "x-tier": "visible",
      "required": ["declared_budget"],
      "properties": {
        "declared_budget": { "type": "number", "minimum": 0, "description": "The venture's decision for this quarter's settlement. Zero is valid and is not default." },
        "variance_note": { "type": ["string", "null"], "description": "Required when declared_budget < expected_capacity; states why capital is being retained." },
        "queue": {
          "type": "object",
          "properties": {
            "requests_outstanding_amount": { "type": "number", "minimum": 0 },
            "paid_this_quarter": { "type": "number", "minimum": 0 },
            "amount_retired": { "type": "number", "minimum": 0 },
            "insider_positions_present": { "type": "boolean", "description": "Insider-held positions participate pro rata and are flagged." }
          }
        },
        "buyout_notice": {
          "type": ["object", "null"],
          "properties": {
            "noticed_amount": { "type": "number", "minimum": 0 },
            "convert_instead_amount": { "type": "number", "minimum": 0 }
          }
        },
        "conversions": {
          "type": "object",
          "properties": {
            "amount_converted": { "type": "number", "minimum": 0 },
            "shares_or_units_issued": { "type": "number", "minimum": 0 }
          }
        },
        "headcount_band": { "type": "string", "enum": ["1-5", "6-10", "11-25", "26-50", "51-100", "100+"] },
        "commentary": { "type": "string", "maxLength": 2000, "description": "Brief management commentary. No PII, no customer or counterparty identities, no partner names, no pipeline detail." }
      }
    },
    "holder_lines": {
      "type": "object",
      "x-tier": "holder",
      "description": "Holder-tier exclusive lines.",
      "required": ["owners_and_leaders_total_ttm"],
      "properties": {
        "owners_and_leaders_total_ttm": { "type": "number", "minimum": 0, "description": "A single total of trailing-twelve-month compensation paid to owners and leaders (related parties and control persons) in aggregate. Aggregate only; never an individual breakdown. The one channel that can move value out of Expected Capacity unseen, kept visible." }
      }
    },
    "attestation": {
      "type": "object",
      "description": "Required only when meta.attestation_grade is 2 (enforced by the conditional rule below). The same Quarterly Update with an independent assurance wrapper; this is why the Standard is one schema, not two.",
      "x-tier": "holder",
      "properties": {
        "attestor": { "type": "string", "description": "Identity of the independent third party attesting the Ledger Base computation." },
        "attestation_date": { "type": "string", "format": "date" },
        "procedures": { "type": "string", "description": "Reference to the agreed-upon procedures or equivalent standard applied." },
        "attestation_artifact_hash": { "type": "string", "description": "Content hash of the signed attestation artifact, for provenance." }
      },
      "required": ["attestor", "attestation_date", "procedures", "attestation_artifact_hash"]
    }
  },
  "allOf": [
    {
      "if": {
        "properties": { "meta": { "properties": { "attestation_grade": { "const": 2 } } } },
        "required": ["meta"]
      },
      "then": { "required": ["attestation"] },
      "else": { "not": { "required": ["attestation"] } }
    }
  ],
  "x-canonical-constants": {
    "description": "The controlling numbers, mirrored here for machine use. The SAFR Reporting Standard spec is authoritative.",
    "multiple_schedule": [
      { "month": 0, "multiple": 1.00 },
      { "month": 36, "multiple": 1.50 },
      { "month": 60, "multiple": 2.00 },
      { "month": 90, "multiple": 2.50 }
    ],
    "multiple_interpolation": "linear between anchors; never exceeds 2.50; never decreases",
    "revenue_quality_multiples": { "recurring": 2.0, "repeat": 1.0, "one_time": 0.25 },
    "qda_amortization_months": 36,
    "qda_amortization_basis": "per vintage: each month of qualifying development spend amortizes straight-line over its own 36 months; the asset is the sum over the trailing 36 months of each month's spend times max(0, 1 - age_in_months/36)",
    "pv_discount_rate": 0.10,
    "contract_term_threshold_months": 12,
    "expected_capacity_rate": 0.25,
    "working_capital_floor_months": 6,
    "conversion_fraction_per_quarter": 0.125,
    "max_conversion_ownership": 0.25,
    "qualified_financing_fundability_multiple": 1.0,
    "qualified_financing_aggregation_window_quarters": 4,
    "qualified_financing_antipadding_exclusion_months": 6,
    "qualified_financing_discount": 0.20,
    "graduation_lookback_quarters": 4,
    "graduation_eligibility_quarters": 4,
    "graduation_equal_access_quarters": 2,
    "report_deadline_days_after_quarter_close": 45,
    "election_days_before_quarter_close": 10,
    "settlement_business_days_after_update": 10,
    "insider_equity_threshold": 0.10,
    "major_version_materiality_threshold_pct": 3.0
  },
  "x-versioning": {
    "scheme": "semantic, MAJOR.MINOR within the pinned major version",
    "minor": "Refinements, calibration, added revenue-quality tags, and data-mapping improvements ship as minor versions and apply automatically to outstanding instruments.",
    "major": "A new major version is any change that would alter a previously issued position's computed Ledger Base or Expected Capacity for any quarter by more than major_version_materiality_threshold_pct (3.0%). A new major version applies to an outstanding instrument only with the Holder's and the Company's consent.",
    "pinning": "Each executed SAFR pins the major version and records the content hash of the Reporting Standard spec in effect at issuance."
  },
  "x-conformance": {
    "calibration": "Initial conformance is set by a human Certified Business Analyst who calibrates each venture's data mapping to this Standard.",
    "automation": "SmartTrustee then applies the same weights to the same data, conforming to this Standard, so the automated computation matches the calibrated baseline.",
    "maturation": "The conformance method is expected to refine with volume; refinements ship as minor versions."
  },
  "x-exclusions": [
    "personally_identifiable_information",
    "customer_identities",
    "counterparty_identities",
    "partner_names",
    "pipeline_detail",
    "raw_ledger_records"
  ],
  "x-vocabulary": {
    "visibility": "The term 'public' is not used. Visibility is invitational, need-to-know transparency by the venture's standing grant; Venture Visibility is an invitation, not a listing.",
    "quarterly_cycle": "The instrument runs on fiscal quarters ending Mar 31, Jun 30, Sep 30, Dec 31. Holders elect at least 10 days before the quarter closes; the venture issues its Quarterly Update within 45 days after; settlement follows within 10 business days after the Update."
  }
}
