{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/immix/json-schema/immix-portfolio-row-schema.json",
  "title": "PortfolioRow",
  "description": "A portfolio as the API serves it: the `PortfolioUpdated` record plus the row extras (`globalSequence`; the deprecated `unscaled`, never present since 0.3.3) — the one shape its reads and its commands answer.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/immix-portfolios-api-openapi.yml#/components/schemas/PortfolioRow",
  "type": "object",
  "properties": {
    "portfolioId": {
      "type": "integer",
      "description": "Sticky entity key."
    },
    "version": {
      "type": "string",
      "pattern": "^-?[0-9]+$",
      "description": "The row's version: monotonic per record, bumped on every change — served as the ETag and taken by If-Match. int64 as a decimal JSON string"
    },
    "orgId": {
      "type": "integer",
      "description": "Owner-stamped."
    },
    "status": {
      "$ref": "#/$defs/PortfolioUpdatedStatus",
      "description": "UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict"
    },
    "name": {
      "type": "string",
      "description": "Natural key — per-org unique among live portfolios."
    },
    "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
    }
  },
  "required": [
    "portfolioId",
    "version",
    "orgId",
    "status",
    "name",
    "globalSequence"
  ],
  "$defs": {
    "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"
    },
    "PortfolioUpdatedStatus": {
      "type": "string",
      "enum": [
        "UNKNOWN",
        "ACTIVE",
        "RETIRED"
      ],
      "description": "UNKNOWN is the unset sentinel: outputs only — as input, omit the field instead; explicit UNKNOWN refuses 400. The value set is append-only: a consumer READING this field treats an unknown name as UNKNOWN, never as an error; as input an unknown name refuses 400 — the parse is strict",
      "title": "PortfolioUpdatedStatus"
    }
  }
}