{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://capp.local/schemas/capp.solana-rail.v1.schema.json",
  "title": "capp.solana-rail.v1",
  "type": "object",
  "required": [
    "protocol",
    "railId",
    "allocationKey",
    "clientPositionId",
    "offChainAllocation",
    "state",
    "fundsMoved",
    "privateKeyIncluded",
    "lifecycle"
  ],
  "properties": {
    "protocol": {
      "const": "capp.solana-rail.v1"
    },
    "railId": {
      "type": "string"
    },
    "allocationKey": {
      "type": "string"
    },
    "profileId": {
      "type": "string"
    },
    "vaultId": {
      "type": "string"
    },
    "clientPositionId": {
      "type": "string"
    },
    "market": {
      "type": "string"
    },
    "side": {
      "type": "string"
    },
    "executionWallet": {
      "type": [
        "string",
        "null"
      ]
    },
    "offChainAllocation": {
      "const": true
    },
    "state": {
      "enum": [
        "allocated",
        "rail_wallet_needs_funding",
        "rail_wallet_funded",
        "position_request_created",
        "position_open_pending",
        "position_open",
        "position_close_pending",
        "position_closed",
        "sweep_requested",
        "rail_bucket_reusable"
      ]
    },
    "fundsMoved": {
      "type": "boolean"
    },
    "privateKeyIncluded": {
      "const": false
    },
    "lifecycle": {
      "type": "array",
      "maxItems": 512,
      "items": {
        "type": "object"
      }
    },
    "createdAt": {
      "type": "number"
    },
    "updatedAt": {
      "type": "number"
    },
    "releasedAt": {
      "type": "number"
    },
    "idempotent": {
      "type": "boolean"
    }
  },
  "additionalProperties": false
}
