{
  "$defs": {
    "EquityTxStatus": {
      "description": "Lifecycle status of a posted transaction.",
      "enum": [
        "draft",
        "posted",
        "reversed"
      ],
      "type": "string"
    },
    "EquityTxType": {
      "description": "The 23-variant taxonomy of cap-table mutations. Wire names align with\nOCF v1.2 `objects.transactions[].object_type` where they map directly.",
      "oneOf": [
        {
          "enum": [
            "stock_issuance",
            "stock_transfer",
            "stock_cancellation",
            "stock_repurchase",
            "stock_split",
            "stock_reclassification",
            "option_grant",
            "option_exercise",
            "option_cancellation",
            "option_expiration",
            "option_forfeiture",
            "warrant_issuance",
            "warrant_exercise",
            "warrant_cancellation",
            "warrant_expiration",
            "convertible_issuance",
            "convertible_conversion",
            "convertible_cancellation",
            "plan_pool_increase",
            "plan_pool_decrease",
            "anti_dilution_adjustment"
          ],
          "type": "string"
        },
        {
          "const": "stock_class_conversion",
          "description": "Preferred → common at exit / conversion event.",
          "type": "string"
        },
        {
          "const": "option_vesting",
          "description": "Per-period vesting event or computed snapshot.",
          "type": "string"
        },
        {
          "const": "convertible_repayment",
          "description": "Debt-flavoured convertibles can be repaid pre-conversion (rare).",
          "type": "string"
        },
        {
          "const": "plan_pool_return",
          "description": "Cancelled grants return to pool.",
          "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"
    }
  },
  "$id": "https://corpospec.com/schemas/v0.16.0/equity-transaction.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "An append-only cap-table mutation event.\n\nFile layout:\n`.corpospec/entity/equity/transactions/<YYYY>/<MM>/<entity>-<seq>.yaml`.\nNever overwrite once `status: posted`.",
  "properties": {
    "certificate_no": {
      "description": "Certificate number (US C-Corp / DE AG).",
      "type": [
        "string",
        "null"
      ]
    },
    "content_hash": {
      "description": "SHA-256 of canonicalised payload (excluding this field).",
      "type": "string"
    },
    "cost_basis": {
      "anyOf": [
        {
          "$ref": "#/$defs/MonetaryAmount"
        },
        {
          "type": "null"
        }
      ],
      "description": "Per-share cost basis for tax purposes."
    },
    "effective_date": {
      "$ref": "#/$defs/IsoDate",
      "description": "Legal-effective date (Handelsregister entry for share issuance,\nplan-effective date for grants)."
    },
    "eg_19a_election": {
      "description": "DE-specific §19a EStG election flag (employee-equity deferred\ntaxation).",
      "type": [
        "boolean",
        "null"
      ]
    },
    "entity": {
      "$ref": "#/$defs/PathRef",
      "description": "Issuing entity."
    },
    "from_stakeholder": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "Source stakeholder for transfer events."
    },
    "git_commit_sha": {
      "description": "Git commit SHA captured by pre-commit hook.",
      "type": [
        "string",
        "null"
      ]
    },
    "governing_resolution": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into the governing Gesellschafterbeschluss / shareholder\nresolution."
    },
    "id": {
      "$ref": "#/$defs/PathRef",
      "description": "PathRef identifier, conventionally\n`entity/equity/transactions/<entity>-<seq>`."
    },
    "instrument_ref": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into a ConvertibleInstrumentDocument or warrant for\nconvertible / warrant events."
    },
    "journal_entry": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into the BDR 0066 JournalEntry that booked the cash\n/equity impact — links cap-table events to the general ledger."
    },
    "note": {
      "description": "Free-form note.",
      "type": [
        "string",
        "null"
      ]
    },
    "option_plan_ref": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into an OptionPlan for option events."
    },
    "posted_by": {
      "$ref": "#/$defs/PathRef",
      "description": "PathRef into the person who posted."
    },
    "price_per_share": {
      "anyOf": [
        {
          "$ref": "#/$defs/MonetaryAmount"
        },
        {
          "type": "null"
        }
      ],
      "description": "Price per share."
    },
    "quantity": {
      "description": "Number of shares / options / warrants. Decimal allowed for\nfractional shares (LP units).",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "related_round": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into the parent Round record when applicable."
    },
    "reversal_of": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "When this event reverses a prior one."
    },
    "source_document": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into the legal contract / SPA / option-grant agreement."
    },
    "stakeholder_ref": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into the holder / counterparty for stakeholder-bound\nevents."
    },
    "status": {
      "$ref": "#/$defs/EquityTxStatus",
      "description": "Status."
    },
    "stock_class_ref": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "PathRef into the StockClass for stock issuance / transfer /\ncancellation events."
    },
    "tax_election_83b": {
      "description": "US-specific 83(b) election flag.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "to_stakeholder": {
      "anyOf": [
        {
          "$ref": "#/$defs/PathRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "Destination stakeholder for transfer events."
    },
    "total_consideration": {
      "anyOf": [
        {
          "$ref": "#/$defs/MonetaryAmount"
        },
        {
          "type": "null"
        }
      ],
      "description": "Total consideration."
    },
    "tx_date": {
      "$ref": "#/$defs/IsoDate",
      "description": "Resolution / signing date."
    },
    "tx_type": {
      "$ref": "#/$defs/EquityTxType",
      "description": "Type of event."
    }
  },
  "required": [
    "id",
    "entity",
    "tx_type",
    "tx_date",
    "effective_date",
    "content_hash",
    "posted_by",
    "status"
  ],
  "title": "EquityTransaction",
  "type": "object",
  "x-corpospec-pillar": "entity"
}