{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://capp.local/schemas/capp.solana-intent.v2.schema.json",
  "title": "capp.solana-intent.v2",
  "type": "object",
  "required": [
    "protocol",
    "network",
    "kind",
    "sendIntent",
    "positionEffect",
    "actionClass",
    "intentDigest",
    "authority",
    "asset",
    "amountAtomic"
  ],
  "properties": {
    "protocol": {
      "const": "capp.solana-intent.v2"
    },
    "operationId": {
      "type": [
        "string",
        "null"
      ]
    },
    "network": {
      "type": "string"
    },
    "asset": {
      "allOf": [
        {
          "$ref": "https://capp.local/schemas/capp.solana-asset.v1.schema.json"
        },
        {
          "properties": {
            "kind": {
              "const": "spl-token"
            }
          }
        }
      ]
    },
    "kind": {
      "type": "string"
    },
    "source": {
      "type": "string"
    },
    "subscriberId": {
      "type": "string"
    },
    "clientPositionId": {
      "type": "string"
    },
    "positionId": {
      "type": "string"
    },
    "positionSlot": {
      "type": "string"
    },
    "positionKey": {
      "type": "string"
    },
    "marketPair": {
      "type": "string"
    },
    "positionSide": {
      "type": "string"
    },
    "recipient": {
      "type": "string"
    },
    "sendIntent": {
      "type": "string"
    },
    "positionEffect": {
      "type": "string"
    },
    "exitReason": {
      "type": [
        "string",
        "null"
      ]
    },
    "actionClass": {
      "type": "string"
    },
    "executable": {
      "type": "boolean"
    },
    "nonExecutablePreview": {
      "type": "boolean"
    },
    "intentDigest": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "authority": {
      "type": "object",
      "required": [
        "authoritative",
        "requiresWalletAuthority"
      ],
      "properties": {
        "selectedBy": {
          "type": "string"
        },
        "authoritative": {
          "const": false
        },
        "requiresWalletAuthority": {
          "type": "boolean"
        },
        "requiresRailAuthority": {
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "createdAt": {
      "type": "number"
    },
    "amountAtomic": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]{0,19})$",
      "description": "Exact unsigned u64 atomic units. Runtime also enforces <= 18446744073709551615."
    }
  },
  "additionalProperties": false
}
