{
  "$defs": {
    "InstrumentAllocation": {
      "description": "Allocation of a convertible instrument to a single investor.",
      "properties": {
        "certificate_no": {
          "description": "Certificate number when issued (DE typically uses notarial\nreference; US uses certificate numbers).",
          "type": [
            "string",
            "null"
          ]
        },
        "equity_transaction": {
          "anyOf": [
            {
              "$ref": "#/$defs/PathRef"
            },
            {
              "type": "null"
            }
          ],
          "description": "PathRef into the EquityTransaction that recorded the issuance."
        },
        "investor": {
          "$ref": "#/$defs/PathRef",
          "description": "PathRef into the investor record (entity / people / legal/parties)."
        },
        "principal": {
          "$ref": "#/$defs/MonetaryAmount",
          "description": "Principal subscribed."
        },
        "signed_date": {
          "$ref": "#/$defs/IsoDate",
          "description": "Date the allocation was signed (subscription document)."
        },
        "wired_date": {
          "anyOf": [
            {
              "$ref": "#/$defs/IsoDate"
            },
            {
              "type": "null"
            }
          ],
          "description": "Date funds wired to the issuer."
        }
      },
      "required": [
        "investor",
        "principal",
        "signed_date"
      ],
      "type": "object"
    },
    "InstrumentStatus": {
      "description": "Lifecycle status of a convertible instrument document.",
      "enum": [
        "draft",
        "signed",
        "funded",
        "converted",
        "repaid",
        "defaulted",
        "cancelled"
      ],
      "type": "string"
    },
    "InterestRateRange": {
      "description": "Interest-rate range for debt-flavoured instruments (Wandeldarlehen, Note).",
      "properties": {
        "max": {
          "description": "Maximum rate.",
          "format": "double",
          "type": "number"
        },
        "min": {
          "description": "Minimum rate (e.g. 0.04 = 4%).",
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "min",
        "max"
      ],
      "type": "object"
    },
    "IsoCountry": {
      "description": "ISO 3166-1 alpha-2 country code.",
      "pattern": "^[A-Z]{2}$",
      "type": "string"
    },
    "IsoCurrency": {
      "description": "ISO 4217 currency code.",
      "pattern": "^[A-Z]{3}$",
      "type": "string"
    },
    "IsoDate": {
      "description": "ISO 8601 date (YYYY-MM-DD).",
      "format": "date",
      "type": "string"
    },
    "MonetaryAmount": {
      "description": "A monetary value with currency.",
      "properties": {
        "amount": {
          "format": "double",
          "type": "number"
        },
        "currency": {
          "$ref": "#/$defs/IsoCurrency"
        }
      },
      "required": [
        "amount",
        "currency"
      ],
      "type": "object"
    },
    "PathRef": {
      "description": "Path-based cross-reference relative to .corpospec/ root.\nPattern: `^[a-z0-9_-]+(/[a-z0-9_.-]+)+$`",
      "pattern": "^[a-z0-9_-]+(/[a-z0-9_.-]+)+$",
      "type": "string"
    },
    "ValuationBasis": {
      "description": "Valuation basis for cap mechanics.",
      "oneOf": [
        {
          "const": "pre_money",
          "description": "Pre-money cap (older SAFE convention; founder-friendlier).",
          "type": "string"
        },
        {
          "const": "post_money",
          "description": "Post-money cap (YC 2018+ SAFE convention; investor-clearer).",
          "type": "string"
        }
      ]
    },
    "ValuationRange": {
      "description": "Valuation range with low / anchor / high triple.",
      "properties": {
        "anchor": {
          "$ref": "#/$defs/MonetaryAmount"
        },
        "high": {
          "$ref": "#/$defs/MonetaryAmount"
        },
        "low": {
          "$ref": "#/$defs/MonetaryAmount"
        }
      },
      "required": [
        "low",
        "anchor",
        "high"
      ],
      "type": "object"
    }
  },
  "$id": "https://corpospec.com/schemas/v0.16.0/convertible-instrument-doc.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Convertible-instrument document master record.",
  "properties": {
    "allocations": {
      "description": "Per-investor allocations.",
      "items": {
        "$ref": "#/$defs/InstrumentAllocation"
      },
      "type": "array"
    },
    "conversion_trigger": {
      "description": "Free-form conversion-trigger description (qualified financing,\nacquisition, IPO).",
      "type": "string"
    },
    "currency": {
      "$ref": "#/$defs/IsoCurrency"
    },
    "discount_rate": {
      "description": "Discount rate (e.g. 0.20 = 20% off the priced round).",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "entity": {
      "$ref": "#/$defs/PathRef"
    },
    "governing_law": {
      "$ref": "#/$defs/IsoCountry"
    },
    "governing_resolution": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into the governing Gesellschafterbeschluss / shareholder\nresolution."
    },
    "id": {
      "$ref": "#/$defs/PathRef"
    },
    "instrument_type": {
      "description": "Instrument family: `\"safe\"`, `\"wandeldarlehen\"`, `\"convertible_note\"`,\n`\"kiss\"`, `\"warrant\"`, etc. Free-form to allow rare variants.",
      "type": "string"
    },
    "interest_rate_range": {
      "anyOf": [
        {
          "$ref": "#/$defs/InterestRateRange"
        },
        {
          "type": "null"
        }
      ],
      "description": "Interest rate range for debt-flavoured instruments\n(Wandeldarlehen, Note)."
    },
    "jurisdiction": {
      "$ref": "#/$defs/IsoCountry"
    },
    "maturity_months": {
      "description": "Maturity months for debt-flavoured instruments.",
      "format": "int32",
      "type": [
        "integer",
        "null"
      ]
    },
    "mfn": {
      "description": "Most-Favoured-Nation clause (rare for SAFE; common for Notes).",
      "type": [
        "boolean",
        "null"
      ]
    },
    "name": {
      "type": "string"
    },
    "notary_required_at_conversion": {
      "description": "Notary required at conversion event.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "notary_required_at_signing": {
      "description": "Notary required at instrument signing (`true` for DE Wandeldarlehen\nwith conversion to GmbH equity).",
      "type": [
        "boolean",
        "null"
      ]
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    },
    "pro_rata_rights": {
      "description": "Pro-rata rights in the next priced round.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "round_ref": {
      "$ref": "#/$defs/PathRef",
      "description": "Parent Round."
    },
    "status": {
      "$ref": "#/$defs/InstrumentStatus"
    },
    "target_amount": {
      "$ref": "#/$defs/MonetaryAmount",
      "description": "Target total raise across all allocations."
    },
    "template_ref": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into a `legal/templates/<slug>` template the instrument was\ndrafted from."
    },
    "valuation_basis": {
      "$ref": "#/$defs/ValuationBasis",
      "description": "Pre-money vs post-money cap basis."
    },
    "valuation_cap_range": {
      "anyOf": [
        {
          "$ref": "#/$defs/ValuationRange"
        },
        {
          "type": "null"
        }
      ],
      "description": "Valuation cap range (low/anchor/high triple)."
    }
  },
  "required": [
    "id",
    "entity",
    "name",
    "instrument_type",
    "target_amount",
    "currency",
    "valuation_basis",
    "conversion_trigger",
    "governing_law",
    "jurisdiction",
    "round_ref",
    "status"
  ],
  "title": "ConvertibleInstrumentDocument",
  "type": "object",
  "x-corpospec-pillar": "entity"
}