{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/immix/json-schema/immix-algo-config-row-schema.json",
  "title": "AlgoConfigRow",
  "description": "One config document of an instance as the API serves it: the text verbatim as submitted (JSON with `//` and `/* * /` comments), who submitted it and when, the accounts and instruments it references — the platform's own reading of the document, so a client needs no strategy schema to show them — and its outcome: `STAGED` until the engine answers, then `APPLIED` or `REFUSED` with the engine's reason in `detail`. Documents carry no version and no `ETag`: only the outcome ever moves.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/immix-algos-api-openapi.yml#/components/schemas/AlgoConfigRow",
  "type": "object",
  "properties": {
    "globalSequence": {
      "$ref": "#/$defs/GlobalSequenceValue"
    },
    "unscaled": {
      "type": "boolean",
      "description": "Never present since 0.3.3: every money value on this API states its own scale on the wire — a policy amount or cap since 0.3.3, an order's and an execution's since 0.3.2, a balance's since 0.3.1 — so a row is never served raw, whether or not this member holds the asset or instrument it references. Kept, deprecated, so a client generated from 0.3.2 still compiles; it goes at the next major.",
      "deprecated": true
    },
    "instanceId": {
      "type": "integer",
      "description": "The instance the document belongs to."
    },
    "configSeq": {
      "type": "integer",
      "description": "The document's sequence number on its instance: 1 for the document the instance was created with, one more for every accepted write."
    },
    "orgId": {
      "type": "integer",
      "description": "The organisation that owns the instance."
    },
    "userId": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The user who submitted it."
    },
    "submittedAtNs": {
      "type": "string",
      "pattern": "^-?[0-9]+$",
      "description": "When it was submitted — epoch nanoseconds as a decimal string."
    },
    "accountIds": {
      "type": "array",
      "items": {
        "type": "integer"
      },
      "description": "Every account the document references, once each, ascending — the accounts the instance may trade."
    },
    "instrumentIds": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Every instrument the document references, once each, ascending — 64-bit ids as decimal strings."
    },
    "outcome": {
      "$ref": "#/$defs/AlgoConfigRowOutcome",
      "description": "`STAGED` until the engine answers, then `APPLIED` or `REFUSED`; `PENDING_APPROVAL` is reserved and never served today. The value set is append-only: read an unknown name as `UNKNOWN`."
    },
    "outcomeAtNs": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^-?[0-9]+$",
      "description": "When the engine's verdict landed — epoch nanoseconds as a decimal string; null while staged."
    },
    "pendingByUserId": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Reserved; always null."
    },
    "remark": {
      "type": "string",
      "description": "The submitter's remark; empty when none was given."
    },
    "commandKey": {
      "type": "string",
      "description": "The write's `Idempotency-Key`, as sent."
    },
    "detail": {
      "type": "string",
      "description": "The engine's reason where it refused the document; empty otherwise."
    },
    "document": {
      "type": "string",
      "description": "The document as authored, comments included — at most 6144 bytes of UTF-8."
    }
  },
  "required": [
    "globalSequence",
    "instanceId",
    "configSeq",
    "orgId",
    "submittedAtNs",
    "accountIds",
    "instrumentIds",
    "outcome",
    "remark",
    "commandKey",
    "detail",
    "document"
  ],
  "$defs": {
    "AlgoConfigRowOutcome": {
      "type": "string",
      "enum": [
        "UNKNOWN",
        "STAGED",
        "APPLIED",
        "REFUSED",
        "PENDING_APPROVAL"
      ],
      "description": "`STAGED` until the engine answers, then `APPLIED` or `REFUSED`; `PENDING_APPROVAL` is reserved and never served today. The value set is append-only: read an unknown name as `UNKNOWN`.",
      "title": "AlgoConfigRowOutcome"
    },
    "GlobalSequenceValue": {
      "type": "string",
      "pattern": "^[0-9]+$",
      "description": "The position as a decimal string — the last change this member had applied, orders, balance readings and algo instances included.",
      "title": "GlobalSequenceValue"
    }
  }
}