{
  "openapi": "3.1.0",
  "info": {
    "title": "GlemO Shared SIMULATED Pilot API",
    "version": "0.6.7",
    "description": "SIMULATED pilot0.6.7. Seller detailed history/references require this buyer's recorded nonbinding request on this offer and current sharing opt-in; basic seller identity remains in the factsheet. Generated catalogue examples expose no detailed history. See SELLER_HISTORY_en.html; no verified reputation is asserted. No real assets, KYC, custody, transfers, billing, live AI or public deployment. Earlier requirement reports retain their historical scope."
  },
  "servers": [
    {
      "url": "http://127.0.0.1:8816",
      "description": "Local default only; this is not a hosted participant endpoint"
    }
  ],
  "security": [
    {
      "HttpsCookie": []
    },
    {
      "LocalCookie": []
    }
  ],
  "paths": {
    "/api/discovery-tools": {
      "get": {
        "operationId": "getOwnDiscoveryTools",
        "summary": "Own account favorites and saved searches only, without an administrator override",
        "responses": {
          "200": {
            "description": "Own record; default version 0 has empty lists and updatedAt:null",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscoveryTools"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "saveOwnDiscoveryTools",
        "summary": "Version-checked own metadata. New participant offer IDs must be currently public and accessible; retained unavailable IDs remain removable. Does not execute trades.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscoveryToolsInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Full updated own record with incremented version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscoveryTools"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/asset-requests": {
      "get": {
        "operationId": "listOwnAssetRequests",
        "summary": "Own private simulated sourcing briefs only, never a participant directory",
        "responses": {
          "200": {
            "description": "simulation:true and requests[]",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "simulation": {
                      "const": true
                    },
                    "requests": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssetRequest"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createAssetRequest",
        "summary": "Buyer/holder/admin only; 50 records per owner including withdrawn; same-key retry replays, different payload returns 409; global pause blocks new requests",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssetRequestInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created or idempotently replayed record; replay adds replayed:true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetRequestCreated"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/asset-requests/{requestId}": {
      "parameters": [
        {
          "name": "requestId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^REQUEST-[A-F0-9-]+$"
          }
        }
      ],
      "get": {
        "operationId": "getAssetRequest",
        "summary": "Owner or internal administrator; other accounts receive 404",
        "responses": {
          "200": {
            "description": "Private sourcing record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetRequest"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/asset-requests/{requestId}/withdraw": {
      "parameters": [
        {
          "name": "requestId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^REQUEST-[A-F0-9-]+$"
          }
        }
      ],
      "post": {
        "operationId": "withdrawAssetRequest",
        "summary": "Owner/admin withdrawal; expectedVersion required, stale version 409; no deletion or deal mutation",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedVersion"
                ],
                "properties": {
                  "expectedVersion": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Withdrawn record; current-version repeat is unchanged",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetRequest"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/admin/asset-requests": {
      "get": {
        "operationId": "listAdminAssetRequests",
        "summary": "Internal administrator only; queue with internal ownerId; no external outreach or commercial commitment",
        "responses": {
          "200": {
            "description": "simulation:true and requests[]; each record includes ownerId",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "simulation": {
                      "const": true
                    },
                    "requests": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AdminAssetRequest"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/rehearsals": {
      "get": {
        "operationId": "listPersonalRehearsals",
        "summary": "List only the authenticated owner's isolated rehearsals; administrators have no override",
        "responses": {
          "200": {
            "description": "simulation:true, mode:individual-rehearsal, sessions[]"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "startPersonalRehearsal",
        "summary": "Create one fictional buyer/holder rehearsal without changing the account role or shared cases",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "offerId",
                  "role",
                  "scenario"
                ],
                "properties": {
                  "offerId": {
                    "type": "string",
                    "pattern": "^DEMO-OFFER-[0-9]{3}$"
                  },
                  "role": {
                    "enum": [
                      "buyer",
                      "holder"
                    ]
                  },
                  "scenario": {
                    "enum": [
                      "standard",
                      "counter_refused",
                      "missing_documents",
                      "ineligible_buyer",
                      "expired_quote",
                      "settlement_mismatch"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Private rehearsal projection; generated bot steps explicitly attributed"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/rehearsals/{rehearsalId}": {
      "parameters": [
        {
          "name": "rehearsalId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^REHEARSAL-[A-F0-9-]+$"
          }
        }
      ],
      "get": {
        "operationId": "getPersonalRehearsal",
        "summary": "Owner-only filtered view using the chosen synthetic role; no actual administrator disclosure override",
        "responses": {
          "200": {
            "description": "Private projection, pending actions, positions, economics, steps and blocked attempts; no retry fingerprints. Synthetic buyer hidden from seller until its successful proposal; not the full internal snapshot."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/rehearsals/{rehearsalId}/commands": {
      "parameters": [
        {
          "name": "rehearsalId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^REHEARSAL-[A-F0-9-]+$"
          }
        }
      ],
      "post": {
        "operationId": "commandPersonalRehearsal",
        "summary": "Idempotent, revision-checked fictional step; expected process blocks return 200 with commandError and an unchanged financial state",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "action",
                  "payload",
                  "expectedRevision",
                  "idempotencyKey"
                ],
                "properties": {
                  "action": {
                    "enum": [
                      "offer",
                      "propose",
                      "accept",
                      "acknowledge",
                      "settle",
                      "reconcile",
                      "restore_documents",
                      "correct_eligibility",
                      "renew_quote",
                      "resolve_mismatch",
                      "abandon"
                    ]
                  },
                  "payload": {
                    "type": "object",
                    "description": "Action-specific strict fields in server/rehearsal.cjs FIELDS. Decimal values are ungrouped strings. Offer:quantity,price,agent,acknowledged. Propose:price. Abandon:confirmed. Others:acknowledged. No state, actor or real evidence accepted."
                  },
                  "expectedRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9_-]{12,90}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated projection with commandError:null or a recorded block; same-key same-payload retry is not repeated"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/rehearsals/{rehearsalId}/feedback": {
      "parameters": [
        {
          "name": "rehearsalId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^REHEARSAL-[A-F0-9-]+$"
          }
        }
      ],
      "post": {
        "operationId": "savePersonalRehearsalFeedback",
        "summary": "Owner-only editable process feedback, never commercial demand evidence",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "score",
                  "body",
                  "expectedRevision"
                ],
                "properties": {
                  "score": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "body": {
                    "type": "string",
                    "maxLength": 1200
                  },
                  "expectedRevision": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated private rehearsal projection"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/rehearsals/{rehearsalId}/export": {
      "parameters": [
        {
          "name": "rehearsalId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^REHEARSAL-[A-F0-9-]+$"
          }
        }
      ],
      "get": {
        "operationId": "exportPersonalRehearsal",
        "summary": "Owner-only role-filtered JSON report; process counters, synthetic versus wall time and zero real revenue",
        "responses": {
          "200": {
            "description": "glemo.individual-rehearsal-report/1; same synthetic-role disclosure as the session, not a full internal snapshot; client may render a standalone localized HTML report"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "health",
        "security": [],
        "summary": "Transport-checked liveness, not an integrity scan",
        "responses": {
          "200": {
            "description": "Alive; instance ID is a non-secret launcher process match, not authentication",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "ok"
                    },
                    "simulation": {
                      "const": true
                    },
                    "instanceId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/auth/login": {
      "post": {
        "operationId": "login",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/Login"
        },
        "responses": {
          "200": {
            "description": "Sets session cookie",
            "headers": {
              "Set-Cookie": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResult"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/auth/invite": {
      "post": {
        "operationId": "inspectInvite",
        "security": [],
        "summary": "Inspect a private unexpired, unused, unrevoked join/reset token",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "$ref": "#/components/schemas/Token"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Invitation metadata; no raw token returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InviteInfo"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/auth/accept": {
      "post": {
        "operationId": "acceptInvite",
        "security": [],
        "summary": "Register or reset password using a single-use private invitation",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "token",
                  "password",
                  "consent"
                ],
                "properties": {
                  "token": {
                    "$ref": "#/components/schemas/Token"
                  },
                  "password": {
                    "$ref": "#/components/schemas/Password"
                  },
                  "consent": {
                    "const": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sets fresh cookie; accepted reset revokes old sessions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResult"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/auth/session": {
      "get": {
        "operationId": "session",
        "security": [],
        "summary": "Optional cookie; nullable session/profile when logged out",
        "parameters": [
          {
            "$ref": "#/components/parameters/Activity"
          }
        ],
        "responses": {
          "200": {
            "description": "Session snapshot; no expiresAt field",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/User"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "csrf": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "profile": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Profile"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "globalPaused": {
                      "type": "boolean"
                    },
                    "serverTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/auth/logout": {
      "post": {
        "operationId": "logout",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/Empty"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/auth/password": {
      "post": {
        "operationId": "changePassword",
        "summary": "Revoke all own sessions and pending resets, then rotate current cookie",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "currentPassword",
                  "newPassword"
                ],
                "properties": {
                  "currentPassword": {
                    "type": "string",
                    "maxLength": 512
                  },
                  "newPassword": {
                    "$ref": "#/components/schemas/Password"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rotated session cookie; no expiresAt field",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "$ref": "#/components/schemas/User"
                    },
                    "csrf": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/profile": {
      "get": {
        "operationId": "ownProfile",
        "responses": {
          "200": {
            "description": "Own profile",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Profile"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "saveProfile",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProfileInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated profile/version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Profile"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/templates": {
      "get": {
        "operationId": "templates",
        "responses": {
          "200": {
            "description": "Four independent fictional resale templates",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "templates": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Template"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/cases": {
      "get": {
        "operationId": "listCases",
        "summary": "Administrator: all cases; others: explicit memberships only",
        "responses": {
          "200": {
            "description": "Visible summaries",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cases": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "globalPaused": {
                      "type": "boolean"
                    },
                    "serverTime": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createCase",
        "x-roles": [
          "admin"
        ],
        "summary": "Assign one active distinct account of each of five fixed participant roles",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/Projection"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/cases/{caseId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/CaseId"
        }
      ],
      "get": {
        "operationId": "getCase",
        "summary": "Case member or administrator; absent/inaccessible returns 404",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Projection"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/cases/{caseId}/commands": {
      "parameters": [
        {
          "$ref": "#/components/parameters/CaseId"
        }
      ],
      "post": {
        "operationId": "command",
        "x-roles": [
          "holder",
          "buyer",
          "compliance",
          "rails",
          "auditor"
        ],
        "summary": "Fixed-role member command; administrator cannot execute",
        "description": "Completed profile required. All members active; writes blocked by global/case pause/archive except exact prior replay. Supply latest case revision and deal version (null before request exists). Retry identical body/key as same account for no reapplication; result is current projection plus replayed:true. Changed same-key payload/account conflicts. See action payload schemas and transition contract. Decimal money/quantity inputs are strings.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Command"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Projection"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/cases/{caseId}/control": {
      "parameters": [
        {
          "$ref": "#/components/parameters/CaseId"
        }
      ],
      "post": {
        "operationId": "controlCase",
        "x-roles": [
          "admin"
        ],
        "summary": "Pause/archive flags; reversible, no deletion or workflow revision increment",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "reason"
                ],
                "properties": {
                  "paused": {
                    "type": "boolean"
                  },
                  "archived": {
                    "type": "boolean"
                  },
                  "reason": {
                    "$ref": "#/components/schemas/ControlReason"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Projection"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/cases/{caseId}/audit": {
      "parameters": [
        {
          "$ref": "#/components/parameters/CaseId"
        }
      ],
      "get": {
        "operationId": "caseAudit",
        "summary": "Assigned member/admin; filtered audit view, not independently certified or a verifiable full chain",
        "responses": {
          "200": {
            "description": "Context/feedback-filtered case audit. Non-admin actor identifiers may be replaced with role labels. Stored append-only records/hashes are unchanged; full internal chain verification requires the administrator record.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Audit"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/cases/{caseId}/export": {
      "parameters": [
        {
          "$ref": "#/components/parameters/CaseId"
        }
      ],
      "get": {
        "operationId": "exportCase",
        "summary": "Assigned member/admin filtered report; contextual counterpart/reference/feedback gates also apply to nested state and audit; records export event",
        "responses": {
          "200": {
            "description": "Simulated filtered JSON process report, not a full database dump or independently verifiable full-chain export",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Projection"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "format": {
                          "const": "glemo.shared-pilot-report/1"
                        },
                        "simulation": {
                          "const": true
                        },
                        "generatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "evidenceScope": {
                          "type": "string"
                        },
                        "feeCollectionStatus": {
                          "const": "NOT_INVOICED_NOT_COLLECTED_SIMULATION"
                        },
                        "audit": {
                          "$ref": "#/components/schemas/Audit"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/notifications": {
      "get": {
        "operationId": "notifications",
        "summary": "Own newest 100 persistent in-app notifications; no email/push delivery",
        "responses": {
          "200": {
            "description": "Notifications",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "notifications": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "caseId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "action": {
                            "type": "string"
                          },
                          "read": {
                            "type": "integer",
                            "enum": [
                              0,
                              1
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/notifications/{id}/read": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "readNotification",
        "summary": "Own notification only; others return 404",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/Empty"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/admin/users": {
      "get": {
        "operationId": "users",
        "x-roles": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Users, no password hashes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "users": {
                      "type": "array",
                      "items": {
                        "allOf": [
                          {
                            "$ref": "#/components/schemas/User"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "profileComplete": {
                                "type": "boolean"
                              }
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/admin/users/{id}/control": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "controlUser",
        "x-roles": [
          "admin"
        ],
        "summary": "Non-admin target; disable revokes sessions and pauses cases; enable does not resume cases",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "active"
                ],
                "properties": {
                  "active": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Target user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/admin/users/{id}/reset": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "resetUser",
        "x-roles": [
          "admin"
        ],
        "summary": "Private reset link for active non-admin; sessions revoked on acceptance",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/Empty"
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/PrivateInvite"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/admin/invites": {
      "get": {
        "operationId": "invites",
        "x-roles": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Metadata only, no raw tokens/links",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invites": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "enum": [
                              "join",
                              "reset"
                            ]
                          },
                          "alias": {
                            "type": "string"
                          },
                          "role": {
                            "$ref": "#/components/schemas/Role"
                          },
                          "orgAlias": {
                            "type": "string"
                          },
                          "targetUser": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "expiresAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "usedAt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "revoked": {
                            "type": "integer",
                            "enum": [
                              0,
                              1
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "inviteUser",
        "x-roles": [
          "admin"
        ],
        "summary": "Invite fixed participant role; no additional administrator through HTTP",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "alias",
                  "role",
                  "orgAlias"
                ],
                "properties": {
                  "alias": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9._-]{2,39}$"
                  },
                  "role": {
                    "$ref": "#/components/schemas/ParticipantRole"
                  },
                  "orgAlias": {
                    "type": "string",
                    "maxLength": 100,
                    "pattern": "^DEMO[ -]"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/PrivateInvite"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/admin/invites/{id}/revoke": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "revokeInvite",
        "x-roles": [
          "admin"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/Empty"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/admin/control": {
      "post": {
        "operationId": "globalControl",
        "x-roles": [
          "admin"
        ],
        "summary": "Pause participant commands; reads/admin/auth operations remain available",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "paused",
                  "reason"
                ],
                "properties": {
                  "paused": {
                    "type": "boolean"
                  },
                  "reason": {
                    "$ref": "#/components/schemas/ControlReason"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current global pause flag",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "paused": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/admin/metrics": {
      "get": {
        "operationId": "metrics",
        "x-roles": [
          "admin"
        ],
        "summary": "Illustrative metrics; realRevenueCents is zero, not proof of demand",
        "responses": {
          "200": {
            "description": "Simulation counts and cents",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "simulation": {
                      "const": true
                    },
                    "globalPaused": {
                      "type": "boolean"
                    },
                    "cases": {
                      "type": "integer"
                    },
                    "reconciled": {
                      "type": "integer"
                    },
                    "blocked": {
                      "type": "integer"
                    },
                    "illustrativeVolumeCents": {
                      "type": "string",
                      "pattern": "^[0-9]+$"
                    },
                    "users": {
                      "type": "integer"
                    },
                    "feedback": {
                      "type": "integer"
                    },
                    "realRevenueCents": {
                      "const": 0
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/admin/security": {
      "get": {
        "operationId": "securityEvents",
        "x-roles": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Newest 200 security events; detail is canonical JSON text",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/admin/backup": {
      "post": {
        "operationId": "backup",
        "x-roles": [
          "admin"
        ],
        "summary": "Create private server-side SQLite backup, metadata only; 3 per hour/user",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/Empty"
        },
        "responses": {
          "201": {
            "description": "Snapshot remains under private PILOT_DATA_DIR/backups",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "bytes": {
                      "type": "integer"
                    },
                    "sha256": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/admin/fixtures": {
      "get": {
        "operationId": "internalFictionalFixtureSelector",
        "summary": "Administrator-only minimal fictional company selector; never a participant directory",
        "responses": {
          "200": {
            "description": "Internal selection fields only; authenticated non-admin requests fail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "companies"
                  ],
                  "properties": {
                    "companies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "id",
                          "name",
                          "role",
                          "country"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "enum": [
                              "seller",
                              "buyer"
                            ]
                          },
                          "country": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/catalog": {
      "get": {
        "operationId": "fictionalCatalog",
        "summary": "24 fictional offers only; no company array, company IDs/profiles or participant directory",
        "responses": {
          "200": {
            "description": "Read-only offer summaries. sellerId, referenceBuyerId and issuer identity are not serialized; source company fixtures remain internal.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "simulation",
                    "version",
                    "offers"
                  ],
                  "properties": {
                    "simulation": {
                      "const": true
                    },
                    "version": {
                      "type": "string"
                    },
                    "offers": {
                      "type": "array",
                      "minItems": 24,
                      "maxItems": 24,
                      "items": {
                        "type": "object",
                        "not": {
                          "anyOf": [
                            {
                              "required": [
                                "sellerId"
                              ]
                            },
                            {
                              "required": [
                                "referenceBuyerId"
                              ]
                            },
                            {
                              "required": [
                                "issuer"
                              ]
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/catalog/offers/{offerId}/example": {
      "get": {
        "operationId": "fictionalOfferExample",
        "summary": "Generated offer factsheet: role-filtered seller, buyer always null, four public artifacts; not a received proposal or private-case evidence",
        "parameters": [
          {
            "name": "offerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^DEMO-OFFER-[0-9]{3}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Limited synthetic factsheet. Seller commercial profile only for buyer/admin, otherwise null. Sample buyer is null for every role. Four public artifacts only; no mandate, private negotiation, settlement dossier or external-account/token rows. Missing evidence remains pending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "simulation",
                    "generatedExample",
                    "readOnly",
                    "version",
                    "offer",
                    "seller",
                    "buyer",
                    "state",
                    "artifacts"
                  ],
                  "properties": {
                    "simulation": {
                      "const": true
                    },
                    "generatedExample": {
                      "const": true
                    },
                    "readOnly": {
                      "const": true
                    },
                    "version": {
                      "type": "string"
                    },
                    "offer": {
                      "type": "object",
                      "description": "Fictional asset terms including original issuer; no sellerId or referenceBuyerId",
                      "not": {
                        "anyOf": [
                          {
                            "required": [
                              "sellerId"
                            ]
                          },
                          {
                            "required": [
                              "referenceBuyerId"
                            ]
                          }
                        ]
                      }
                    },
                    "seller": {
                      "description": "Limited seller commercial context for buyer/admin only; no login/contact/registration or counterparty-history links",
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/FictionalCommercialProfile"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "buyer": {
                      "const": null,
                      "description": "Never disclosed by a catalog illustration, including for administrators"
                    },
                    "state": {
                      "type": "object",
                      "description": "Limited illustrative state with positions/request terms and event action/role/time; not a full internal snapshot, buyer mandate or private dossier"
                    },
                    "artifacts": {
                      "type": "array",
                      "minItems": 4,
                      "maxItems": 4,
                      "items": {
                        "type": "object",
                        "required": [
                          "type"
                        ],
                        "properties": {
                          "type": {
                            "enum": [
                              "factsheet",
                              "ownership",
                              "checklist",
                              "costs"
                            ]
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/marketplace/offers": {
      "get": {
        "operationId": "listParticipantOffers",
        "summary": "Published offers, plus own drafts for seller; all for administrator. No directory.",
        "responses": {
          "200": {
            "description": "Published offers, plus own drafts for seller; all for administrator. No directory."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createOwnOffer",
        "summary": "Holder-owned draft with bounded fictional source.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketCreateOffer"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Holder-owned draft with bounded fictional source."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/marketplace/offers/{id}": {
      "get": {
        "operationId": "readParticipantOffer",
        "summary": "Seller basics; detailed references only after this buyer's recorded request on this offer and current seller sharing opt-in.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Basic identity stays visible. referencesAvailable=false omits history/referrals/historyKind before the viewer's successful request or without current sharing opt-in. With both gates, historyKind=self_declared; no contacts or private registration. A request on another offer does not unlock this offer."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "editOwnOffer",
        "summary": "Holder draft only, version checked; published data immutable.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketUpdateOffer"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Holder draft only, version checked; published data immutable."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/marketplace/offers/{id}/submit": {
      "post": {
        "operationId": "submitOwnOffer",
        "summary": "Explicit holder submission.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketVersion"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Explicit holder submission."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/marketplace/offers/{id}/review": {
      "post": {
        "operationId": "curateParticipantOffer",
        "summary": "Admin-only curation, distinct support accounts; not buyer legal approval.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketReview"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Admin-only curation, distinct support accounts; not buyer legal approval."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/marketplace/offers/{id}/withdraw": {
      "post": {
        "operationId": "withdrawOwnOffer",
        "summary": "No active allocation may be bypassed; consumed source capacity remains consumed.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketVersion"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "No active allocation may be bypassed; consumed source capacity remains consumed."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/marketplace/interests": {
      "get": {
        "operationId": "listScopedInterests",
        "summary": "Buyer own, seller received, admin internal; contextual disclosure only.",
        "responses": {
          "200": {
            "description": "Buyer own, seller received, admin internal; contextual disclosure only."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "requestSharedNegotiation",
        "summary": "Nonbinding buyer request. Exact decimal, eligibility declaration and transactional allocation checks.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Nonbinding buyer request. Exact decimal, eligibility declaration and transactional allocation checks."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/marketplace/interests/{id}": {
      "get": {
        "operationId": "readScopedInterest",
        "summary": "Owner participants only; no private registration or preferences.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Owner participants only; no private registration or preferences."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/marketplace/interests/{id}/messages": {
      "post": {
        "operationId": "appendInterestMessage",
        "summary": "Append-only, nonbinding participant conversation.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketMessage"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Append-only, nonbinding participant conversation."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/marketplace/interests/{id}/withdraw": {
      "post": {
        "operationId": "withdrawOwnInterest",
        "summary": "Buyer-only, unlinked request.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketVersion"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Buyer-only, unlinked request."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/marketplace/interests/{id}/decline": {
      "post": {
        "operationId": "declineUnlinkedInterest",
        "summary": "Owner seller/admin, including inactive buyer cleanup; never a linked settlement bypass.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketDecline"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Owner seller/admin, including inactive buyer cleanup; never a linked settlement bypass."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/marketplace/interests/{id}/open-deal": {
      "post": {
        "operationId": "openLinkedSharedCase",
        "summary": "Holder-only. Actual five-role membership; buyer mandate remains explicit and absent until buyer acts.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarketOpenDeal"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Holder-only. Actual five-role membership; buyer mandate remains explicit and absent until buyer acts."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/portfolio": {
      "get": {
        "operationId": "readOwnReconciledPositions",
        "summary": "Own reconciled buyer cases only. Valuation/P&L/source remain null.",
        "responses": {
          "200": {
            "description": "Own reconciled buyer cases only. Valuation/P&L/source remain null."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/exit-requests": {
      "get": {
        "operationId": "listOwnResaleReviews",
        "summary": "Owner buyer or internal administrator; other roles receive empty list.",
        "responses": {
          "200": {
            "description": "Owner buyer or internal administrator; other roles receive empty list."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "requestOwnResaleReview",
        "summary": "Owner reconciled position. Nonbinding review, not listing/order/guaranteed liquidity.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssistedResaleReview"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Owner reconciled position. Nonbinding review, not listing/order/guaranteed liquidity."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/rehearsals/{id}/archive": {
      "post": {
        "operationId": "archiveOwnPersonalRehearsal",
        "summary": "Owner-only archive/restore metadata with current revision. Only terminal rehearsals may be archived; no history deletion or quota reset.",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^REHEARSAL-[A-F0-9-]+$"
            }
          },
          {
            "$ref": "#/components/parameters/Origin"
          },
          {
            "$ref": "#/components/parameters/Csrf"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "expectedRevision",
                  "archived"
                ],
                "properties": {
                  "expectedRevision": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "archived": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current owner projection, archived flag, revision and retained evidence. Matching-state current-revision request is read-only."
          },
          "404": {
            "description": "No accessible rehearsal, including another account or administrator reading a non-owned rehearsal."
          },
          "409": {
            "description": "Stale revision."
          },
          "422": {
            "description": "Invalid input or nonterminal archive attempt."
          },
          "423": {
            "description": "State change blocked during global pause."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "HttpsCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "__Host-glemo_shared",
        "description": "HTTPS deployment: HttpOnly, Secure, SameSite=Strict, Path=/"
      },
      "LocalCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "glemo_shared_local",
        "description": "Loopback HTTP only: HttpOnly, SameSite=Strict, Path=/"
      }
    },
    "parameters": {
      "Origin": {
        "name": "Origin",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Exact configured origin, required on every POST, including pre-authentication"
      },
      "Csrf": {
        "name": "X-CSRF-Token",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Current session CSRF token returned by login/accept/session/password"
      },
      "Activity": {
        "name": "X-User-Activity",
        "in": "header",
        "schema": {
          "type": "string",
          "enum": [
            "1"
          ]
        },
        "description": "GET with 1 updates idle activity; background GET without it does not"
      },
      "CaseId": {
        "name": "caseId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^PILOT-[A-Z0-9-]+$"
        }
      },
      "Id": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[a-f0-9-]+$"
        },
        "description": "Existing UUID-format database record identifier"
      }
    },
    "requestBodies": {
      "Empty": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false
            }
          }
        }
      },
      "Login": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "alias",
                "password"
              ],
              "properties": {
                "alias": {
                  "type": "string",
                  "description": "Login normalizes to lowercase"
                },
                "password": {
                  "type": "string",
                  "maxLength": 512
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Error envelope. 400 JSON; 401 credentials/session; 403 transport/role/CSRF; 404 missing/inaccessible/invite; 409 conflict/quote/alias/bootstrap; 413 size; 415 content type; 422 validation/transition; 423 pause/archive/member; 429 rate; 503 corruption; otherwise 500. No Retry-After promised.",
        "headers": {
          "X-Request-ID": {
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error"
              ],
              "properties": {
                "error": {
                  "type": "object",
                  "required": [
                    "code",
                    "requestId"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "Ok": {
        "description": "Success",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "ok": {
                  "const": true
                }
              }
            }
          }
        }
      },
      "Projection": {
        "description": "Viewer-filtered case snapshot; replay may add replayed:true",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Projection"
            }
          }
        }
      },
      "PrivateInvite": {
        "description": "PRIVATE bearer setup/reset material: never package, log or include in shared reports",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/InviteInfo"
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "token": {
                      "$ref": "#/components/schemas/Token"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              ]
            }
          }
        }
      }
    },
    "schemas": {
      "SavedDiscoverySearch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "query",
          "country",
          "category",
          "benefit",
          "sort",
          "favoritesOnly"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{12,90}$"
          },
          "name": {
            "type": "string",
            "description": "Trimmed nonempty name of at most 60 characters"
          },
          "query": {
            "type": "string",
            "description": "Trimmed query of at most 200 characters"
          },
          "country": {
            "enum": [
              "",
              "AE",
              "SG",
              "US",
              "HK",
              "GB"
            ]
          },
          "category": {
            "enum": [
              "",
              "Real estate",
              "Private credit",
              "Treasury",
              "Commodities"
            ]
          },
          "benefit": {
            "enum": [
              "",
              "discount",
              "time",
              "volume",
              "points"
            ]
          },
          "sort": {
            "enum": [
              "featured",
              "minTicketAsc",
              "minTicketDesc",
              "closing"
            ]
          },
          "favoritesOnly": {
            "type": "boolean"
          }
        }
      },
      "DiscoveryFavorites": {
        "type": "array",
        "maxItems": 32,
        "uniqueItems": true,
        "items": {
          "type": "string",
          "pattern": "^DEMO-OFFER-[0-9]{3}$"
        },
        "description": "Every ID must exist in the current catalog"
      },
      "DiscoverySearches": {
        "type": "array",
        "maxItems": 10,
        "items": {
          "$ref": "#/components/schemas/SavedDiscoverySearch"
        },
        "description": "Search IDs must be unique"
      },
      "DiscoveryTools": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "favorites",
          "savedSearches",
          "updatedAt",
          "simulation"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "favorites": {
            "$ref": "#/components/schemas/DiscoveryFavorites"
          },
          "savedSearches": {
            "$ref": "#/components/schemas/DiscoverySearches"
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "simulation": {
            "const": true
          }
        }
      },
      "DiscoveryToolsInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expectedVersion",
          "favorites",
          "savedSearches"
        ],
        "properties": {
          "expectedVersion": {
            "type": "integer",
            "minimum": 0
          },
          "favorites": {
            "$ref": "#/components/schemas/DiscoveryFavorites"
          },
          "savedSearches": {
            "$ref": "#/components/schemas/DiscoverySearches"
          }
        }
      },
      "AssetRequestCreated": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "query",
          "category",
          "country",
          "minimumTicketCents",
          "maximumTicketCents",
          "timeframe",
          "description",
          "status",
          "version",
          "createdAt",
          "updatedAt",
          "simulation"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "query": {
            "type": "string",
            "maxLength": 200
          },
          "category": {
            "enum": [
              "Real estate",
              "Private credit",
              "Treasury",
              "Commodities",
              "Other"
            ]
          },
          "country": {
            "enum": [
              "AE",
              "SG",
              "US",
              "HK",
              "GB",
              "Other"
            ]
          },
          "minimumTicketCents": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "maximumTicketCents": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "timeframe": {
            "enum": [
              "now",
              "30d",
              "90d",
              "flexible"
            ]
          },
          "description": {
            "type": "string",
            "minLength": 20,
            "maxLength": 2000
          },
          "status": {
            "enum": [
              "submitted",
              "withdrawn"
            ]
          },
          "version": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "simulation": {
            "const": true
          },
          "replayed": {
            "const": true
          }
        }
      },
      "AdminAssetRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "query",
          "category",
          "country",
          "minimumTicketCents",
          "maximumTicketCents",
          "timeframe",
          "description",
          "status",
          "version",
          "createdAt",
          "updatedAt",
          "simulation",
          "ownerId"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "query": {
            "type": "string",
            "maxLength": 200
          },
          "category": {
            "enum": [
              "Real estate",
              "Private credit",
              "Treasury",
              "Commodities",
              "Other"
            ]
          },
          "country": {
            "enum": [
              "AE",
              "SG",
              "US",
              "HK",
              "GB",
              "Other"
            ]
          },
          "minimumTicketCents": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "maximumTicketCents": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "timeframe": {
            "enum": [
              "now",
              "30d",
              "90d",
              "flexible"
            ]
          },
          "description": {
            "type": "string",
            "minLength": 20,
            "maxLength": 2000
          },
          "status": {
            "enum": [
              "submitted",
              "withdrawn"
            ]
          },
          "version": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "simulation": {
            "const": true
          },
          "ownerId": {
            "type": "string"
          }
        }
      },
      "AssetRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "query",
          "category",
          "country",
          "minimumTicketCents",
          "maximumTicketCents",
          "timeframe",
          "description",
          "status",
          "version",
          "createdAt",
          "updatedAt",
          "simulation"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "query": {
            "type": "string",
            "maxLength": 200
          },
          "category": {
            "enum": [
              "Real estate",
              "Private credit",
              "Treasury",
              "Commodities",
              "Other"
            ]
          },
          "country": {
            "enum": [
              "AE",
              "SG",
              "US",
              "HK",
              "GB",
              "Other"
            ]
          },
          "minimumTicketCents": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "maximumTicketCents": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "timeframe": {
            "enum": [
              "now",
              "30d",
              "90d",
              "flexible"
            ]
          },
          "description": {
            "type": "string",
            "minLength": 20,
            "maxLength": 2000
          },
          "status": {
            "enum": [
              "submitted",
              "withdrawn"
            ]
          },
          "version": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "simulation": {
            "const": true
          }
        }
      },
      "AssetRequestInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "query",
          "category",
          "country",
          "minimumTicket",
          "maximumTicket",
          "timeframe",
          "description",
          "consent",
          "idempotencyKey"
        ],
        "properties": {
          "query": {
            "type": "string",
            "maxLength": 200
          },
          "category": {
            "enum": [
              "Real estate",
              "Private credit",
              "Treasury",
              "Commodities",
              "Other"
            ]
          },
          "country": {
            "enum": [
              "AE",
              "SG",
              "US",
              "HK",
              "GB",
              "Other"
            ]
          },
          "minimumTicket": {
            "type": "string",
            "description": "Empty for unknown, otherwise positive ungrouped USD decimal; at most two decimal places"
          },
          "maximumTicket": {
            "type": "string",
            "description": "Empty for unknown; positive USD decimal, >= minimum when both supplied"
          },
          "timeframe": {
            "enum": [
              "now",
              "30d",
              "90d",
              "flexible"
            ]
          },
          "description": {
            "type": "string",
            "minLength": 20,
            "maxLength": 2000
          },
          "consent": {
            "const": true
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{12,90}$"
          }
        }
      },
      "FictionalCommercialProfile": {
        "type": "object",
        "additionalProperties": false,
        "description": "Allowlisted synthetic commercial projection, not a registration or verified reputation. Catalogue factsheets omit detailed history. A selected-buyer private rehearsal exposes synthetic history only after its successful buyer proposal. No company ID, login, contact field, mandate, private preferences or counterparty-history links. Free text is not automatically classified/redacted.",
        "required": [
          "name",
          "role",
          "country",
          "city",
          "categories",
          "descriptionKey",
          "fictional",
          "realIdentityVerified",
          "referencesAvailable"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "role": {
            "enum": [
              "seller",
              "buyer"
            ]
          },
          "country": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "descriptionKey": {
            "type": "string"
          },
          "fictional": {
            "const": true
          },
          "realIdentityVerified": {
            "const": false
          },
          "referencesAvailable": {
            "type": "boolean",
            "description": "Detailed synthetic history is omitted when false. This is not a verification or trading permission flag."
          },
          "historyKind": {
            "const": "simulated"
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "category",
                "country",
                "principalCents",
                "at",
                "fictional",
                "verified"
              ],
              "properties": {
                "category": {
                  "type": "string"
                },
                "country": {
                  "type": "string"
                },
                "principalCents": {
                  "type": "integer"
                },
                "at": {
                  "type": "string"
                },
                "fictional": {
                  "const": true
                },
                "verified": {
                  "const": false
                }
              }
            }
          }
        }
      },
      "Role": {
        "type": "string",
        "enum": [
          "admin",
          "holder",
          "buyer",
          "compliance",
          "rails",
          "auditor"
        ]
      },
      "ParticipantRole": {
        "type": "string",
        "enum": [
          "holder",
          "buyer",
          "compliance",
          "rails",
          "auditor"
        ]
      },
      "Token": {
        "type": "string",
        "pattern": "^[A-Za-z0-9_-]{43}$",
        "description": "PRIVATE bearer secret; returned only at issuance; never log/package/share in reports"
      },
      "Password": {
        "type": "string",
        "minLength": 14,
        "maxLength": 128,
        "writeOnly": true,
        "description": "Unicode code points; server also rejects simple repetitions and a short obvious-password list"
      },
      "Reference": {
        "type": "string",
        "pattern": "^DEMO-[A-Z0-9-]{1,100}$"
      },
      "Money": {
        "type": "string",
        "maxLength": 64,
        "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,2})?$",
        "description": "Unsigned USD decimal, at most two fractional digits; semantic positive/safe-integer checks apply"
      },
      "Quantity": {
        "type": "string",
        "maxLength": 64,
        "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,6})?$",
        "description": "Unsigned decimal, at most six fractional digits; must match available/frozen case units"
      },
      "Reason": {
        "type": "string",
        "minLength": 1,
        "maxLength": 1000,
        "pattern": "\\S"
      },
      "ControlReason": {
        "type": "string",
        "minLength": 1,
        "maxLength": 1200,
        "pattern": "\\S"
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "alias": {
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/Role"
          },
          "orgId": {
            "type": "string"
          },
          "orgAlias": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "LoginResult": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "csrf": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InviteInfo": {
        "type": "object",
        "properties": {
          "alias": {
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/Role"
          },
          "kind": {
            "enum": [
              "join",
              "reset"
            ]
          },
          "orgAlias": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Preferences": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "inApp",
          "email",
          "push"
        ],
        "properties": {
          "inApp": {
            "type": "boolean"
          },
          "email": {
            "type": "boolean",
            "description": "Stored only; no email sent"
          },
          "push": {
            "type": "boolean",
            "description": "Stored only; no push sent"
          }
        }
      },
      "ProfileInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "country",
          "qualified",
          "categories",
          "history",
          "referrals",
          "shareReferences",
          "preferences",
          "consent",
          "expectedVersion"
        ],
        "properties": {
          "country": {
            "enum": [
              "AE",
              "SG",
              "US",
              "BR",
              "HK",
              "GB"
            ]
          },
          "qualified": {
            "type": "boolean"
          },
          "categories": {
            "type": "array",
            "maxItems": 4,
            "items": {
              "enum": [
                "Real estate",
                "Private credit",
                "Treasury",
                "Commodities"
              ]
            }
          },
          "history": {
            "type": "string",
            "maxLength": 1200
          },
          "referrals": {
            "type": "string",
            "maxLength": 1200
          },
          "shareReferences": {
            "type": "boolean"
          },
          "preferences": {
            "$ref": "#/components/schemas/Preferences"
          },
          "consent": {
            "const": true
          },
          "expectedVersion": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "Profile": {
        "type": "object",
        "description": "Own private profile, not a counterpart response or global lookup. Reference text is fictional/self-declared by policy, not automatically validated as DEMO-only. Seller references require this buyer's recorded marketplace request on this exact offer (or a successful buyer proposal in a directly assigned case) and current seller shareReferences opt-in. Private preferences/registration are never counterpart fields; no verified reputation is asserted.",
        "properties": {
          "completed": {
            "type": "boolean"
          },
          "country": {
            "type": "string"
          },
          "qualified": {
            "type": "boolean"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "history": {
            "type": "string"
          },
          "referrals": {
            "type": "string"
          },
          "shareReferences": {
            "type": "boolean"
          },
          "preferences": {
            "$ref": "#/components/schemas/Preferences"
          },
          "consentVersion": {
            "const": "fictional-data-v1"
          },
          "version": {
            "type": "integer"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TemplateId": {
        "enum": [
          "ae-property",
          "ae-credit",
          "sg-treasury",
          "ae-gold"
        ]
      },
      "Template": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/TemplateId"
          },
          "asset": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "country": {
            "enum": [
              "AE",
              "SG"
            ]
          },
          "city": {
            "type": "string"
          },
          "buyers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "image": {
            "type": "string"
          }
        }
      },
      "CaseInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "title",
          "template",
          "members"
        ],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "\\S"
          },
          "template": {
            "$ref": "#/components/schemas/TemplateId"
          },
          "members": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "holder",
              "buyer",
              "compliance",
              "rails",
              "auditor"
            ],
            "properties": {
              "holder": {
                "type": "string"
              },
              "buyer": {
                "type": "string"
              },
              "compliance": {
                "type": "string"
              },
              "rails": {
                "type": "string"
              },
              "auditor": {
                "type": "string"
              }
            }
          },
          "offerId": {
            "type": "string",
            "pattern": "^DEMO-OFFER-[0-9]{3}$",
            "description": "Optional fictional offer source. Must match template; context is server-owned. No participant commands are auto-created."
          }
        }
      },
      "Projection": {
        "type": "object",
        "properties": {
          "meta": {
            "type": "object"
          },
          "state": {
            "type": "object",
            "description": "SIMULATED filtered projection, not the full stored snapshot. Context gates apply to nested seller/buyer data and buyer mandate/review; feedback is filtered by role and fingerprints removed. Seller sees buyer commercial context only after successful buyer proposal. Integer unit strings, USD cents; not a public asset ledger or independently verifiable full-chain dump."
          },
          "participants": {
            "type": "array",
            "description": "Viewer/context-filtered. Own holder/internal admin seller-reference access is distinct from buyer contextual access. Seller references require the current buyer's linked marketplace request or successful buyer proposal in this case, plus current shareReferences. Assigned compliance/rails/auditor get seller basics but no detailed seller references. Before a buyer's successful proposal, a directly assigned case sends no buyer profile to the seller. Counterpart rows omit login alias, activation/completion flags, credentials, dedicated contact fields and private preferences; arbitrary history text is not automatically classified/redacted.",
            "items": {
              "type": "object"
            }
          },
          "globalPaused": {
            "type": "boolean"
          },
          "serverTime": {
            "type": "string",
            "format": "date-time"
          },
          "replayed": {
            "const": true
          }
        }
      },
      "Audit": {
        "type": "object",
        "description": "Filtered projection of stored append-only audit; full internal chain verification requires the administrator record. Non-admin feedback/actor filtering means response hashes do not independently verify the complete original chain. Stored snapshot/hash/audit remain unchanged; no external certification or anchor.",
        "properties": {
          "simulation": {
            "const": true
          },
          "caseId": {
            "type": "string"
          },
          "integrity": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "case_id": {
                  "type": "string"
                },
                "sequence": {
                  "type": "integer"
                },
                "at": {
                  "type": "string"
                },
                "actor_id": {
                  "type": "string",
                  "description": "May be a role label replacing another actor's internal ID for a non-admin viewer; not a company-profile lookup key"
                },
                "role": {
                  "type": "string"
                },
                "action": {
                  "type": "string"
                },
                "revision": {
                  "type": "integer"
                },
                "state_hash": {
                  "type": "string"
                },
                "previous_hash": {
                  "type": "string"
                },
                "event_hash": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Command": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action",
          "payload",
          "expectedRevision",
          "expectedDealVersion",
          "idempotencyKey"
        ],
        "properties": {
          "action": {
            "type": "string"
          },
          "payload": {
            "type": "object"
          },
          "expectedRevision": {
            "type": "integer",
            "minimum": 0
          },
          "expectedDealVersion": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{12,90}$"
          }
        },
        "oneOf": [
          {
            "properties": {
              "action": {
                "const": "offer"
              },
              "payload": {
                "$ref": "#/components/schemas/Offer"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "mandate"
              },
              "payload": {
                "$ref": "#/components/schemas/Mandate"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "verify"
              },
              "payload": {
                "$ref": "#/components/schemas/Verify"
              }
            }
          },
          {
            "properties": {
              "action": {
                "enum": [
                  "publish",
                  "expire"
                ]
              },
              "payload": {
                "$ref": "#/components/schemas/Empty"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "propose"
              },
              "payload": {
                "$ref": "#/components/schemas/Propose"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "accept"
              },
              "payload": {
                "$ref": "#/components/schemas/Accept"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "instructions"
              },
              "payload": {
                "$ref": "#/components/schemas/Instructions"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "sign"
              },
              "payload": {
                "$ref": "#/components/schemas/Sign"
              }
            }
          },
          {
            "properties": {
              "action": {
                "enum": [
                  "begin",
                  "reconcile"
                ]
              },
              "payload": {
                "$ref": "#/components/schemas/ReferenceOnly"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "cash"
              },
              "payload": {
                "$ref": "#/components/schemas/Cash"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "delivery"
              },
              "payload": {
                "$ref": "#/components/schemas/Delivery"
              }
            }
          },
          {
            "properties": {
              "action": {
                "enum": [
                  "cancel",
                  "reject",
                  "issue"
                ]
              },
              "payload": {
                "$ref": "#/components/schemas/ReasonOnly"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "resolve"
              },
              "payload": {
                "$ref": "#/components/schemas/Resolve"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "closeAgreement"
              },
              "payload": {
                "$ref": "#/components/schemas/CloseAgreement"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "message"
              },
              "payload": {
                "$ref": "#/components/schemas/Message"
              }
            }
          },
          {
            "properties": {
              "action": {
                "const": "feedback"
              },
              "payload": {
                "$ref": "#/components/schemas/Feedback"
              }
            }
          }
        ]
      },
      "Empty": {
        "type": "object",
        "additionalProperties": false
      },
      "Offer": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "quantity",
          "price",
          "acknowledged"
        ],
        "properties": {
          "quantity": {
            "$ref": "#/components/schemas/Quantity"
          },
          "price": {
            "$ref": "#/components/schemas/Money"
          },
          "agent": {
            "type": "boolean"
          },
          "thirdParty": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "const": ""
              }
            ]
          },
          "acknowledged": {
            "const": true
          }
        }
      },
      "Mandate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "country",
          "qualified",
          "min",
          "max"
        ],
        "properties": {
          "country": {
            "enum": [
              "AE",
              "SG",
              "US",
              "BR",
              "HK",
              "GB"
            ]
          },
          "qualified": {
            "type": "boolean"
          },
          "min": {
            "$ref": "#/components/schemas/Money"
          },
          "max": {
            "$ref": "#/components/schemas/Money"
          }
        }
      },
      "Verify": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "ownership",
          "transfer",
          "issuer",
          "jurisdiction",
          "unencumbered",
          "gateway",
          "documents",
          "buyerReview",
          "reference"
        ],
        "properties": {
          "ownership": {
            "const": true
          },
          "transfer": {
            "const": true
          },
          "issuer": {
            "const": true
          },
          "jurisdiction": {
            "const": true
          },
          "unencumbered": {
            "const": true
          },
          "gateway": {
            "const": true
          },
          "documents": {
            "const": true
          },
          "buyerReview": {
            "const": true
          },
          "reference": {
            "$ref": "#/components/schemas/Reference"
          }
        }
      },
      "Propose": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "price"
        ],
        "properties": {
          "price": {
            "$ref": "#/components/schemas/Money"
          }
        }
      },
      "Accept": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "proposalVersion",
          "acknowledged"
        ],
        "properties": {
          "proposalVersion": {
            "type": "integer",
            "minimum": 1
          },
          "acknowledged": {
            "const": true
          }
        }
      },
      "Instructions": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "destination",
          "beneficiary",
          "controlRef",
          "gatewayRef",
          "reference"
        ],
        "properties": {
          "destination": {
            "$ref": "#/components/schemas/Reference"
          },
          "beneficiary": {
            "$ref": "#/components/schemas/Reference"
          },
          "controlRef": {
            "$ref": "#/components/schemas/Reference"
          },
          "gatewayRef": {
            "$ref": "#/components/schemas/Reference"
          },
          "reference": {
            "$ref": "#/components/schemas/Reference"
          }
        }
      },
      "Sign": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "proposalVersion",
          "acknowledged",
          "reference"
        ],
        "properties": {
          "proposalVersion": {
            "type": "integer",
            "minimum": 1
          },
          "acknowledged": {
            "const": true
          },
          "reference": {
            "$ref": "#/components/schemas/Reference"
          }
        }
      },
      "ReferenceOnly": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reference"
        ],
        "properties": {
          "reference": {
            "$ref": "#/components/schemas/Reference"
          }
        }
      },
      "Cash": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reference",
          "amount",
          "beneficiary",
          "currency"
        ],
        "properties": {
          "reference": {
            "$ref": "#/components/schemas/Reference"
          },
          "amount": {
            "$ref": "#/components/schemas/Money"
          },
          "beneficiary": {
            "type": "string",
            "description": "Exact frozen beneficiary"
          },
          "currency": {
            "const": "USD"
          }
        }
      },
      "Delivery": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reference",
          "quantity",
          "network",
          "tokenRef",
          "destination",
          "sourceAccount"
        ],
        "properties": {
          "reference": {
            "$ref": "#/components/schemas/Reference"
          },
          "quantity": {
            "$ref": "#/components/schemas/Quantity"
          },
          "network": {
            "type": "string"
          },
          "tokenRef": {
            "type": "string"
          },
          "destination": {
            "type": "string"
          },
          "sourceAccount": {
            "type": "string"
          }
        },
        "description": "All delivery values must equal the frozen simulated settlement"
      },
      "ReasonOnly": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reason"
        ],
        "properties": {
          "reason": {
            "$ref": "#/components/schemas/Reason"
          }
        }
      },
      "Resolve": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reason",
          "reference"
        ],
        "properties": {
          "reason": {
            "$ref": "#/components/schemas/Reason"
          },
          "reference": {
            "$ref": "#/components/schemas/Reference"
          }
        }
      },
      "CloseAgreement": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "reference",
          "holderReleaseRef",
          "buyerReleaseRef",
          "providerClosureRef",
          "reason",
          "noMovement"
        ],
        "properties": {
          "reference": {
            "$ref": "#/components/schemas/Reference"
          },
          "holderReleaseRef": {
            "$ref": "#/components/schemas/Reference"
          },
          "buyerReleaseRef": {
            "$ref": "#/components/schemas/Reference"
          },
          "providerClosureRef": {
            "$ref": "#/components/schemas/Reference"
          },
          "reason": {
            "$ref": "#/components/schemas/Reason"
          },
          "noMovement": {
            "const": true
          }
        }
      },
      "Message": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "body"
        ],
        "properties": {
          "body": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1200,
            "pattern": "\\S"
          }
        }
      },
      "Feedback": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "score",
          "body"
        ],
        "properties": {
          "score": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          "body": {
            "type": "string",
            "maxLength": 1200
          }
        }
      },
      "MarketCreateOffer": {
        "type": "object",
        "properties": {
          "sourceOfferId": {
            "type": "string",
            "pattern": "^DEMO-OFFER-[0-9]{3}$"
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "minLength": 20,
            "maxLength": 1200
          },
          "inventoryUnits": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,6})?$",
            "maxLength": 64
          },
          "offerUnits": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,6})?$",
            "maxLength": 64
          },
          "price": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,2})?$",
            "maxLength": 64
          },
          "minimumTicket": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,2})?$",
            "maxLength": 64
          },
          "maximumTicket": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,2})?$",
            "maxLength": 64
          },
          "sourceReference": {
            "type": "string",
            "pattern": "^DEMO-[A-Z0-9-]{1,100}$"
          },
          "acknowledged": {
            "const": true
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{12,90}$"
          }
        },
        "required": [
          "sourceOfferId",
          "name",
          "description",
          "inventoryUnits",
          "offerUnits",
          "price",
          "minimumTicket",
          "maximumTicket",
          "sourceReference",
          "acknowledged",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "MarketUpdateOffer": {
        "type": "object",
        "properties": {
          "expectedVersion": {
            "type": "integer",
            "minimum": 0
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "minLength": 20,
            "maxLength": 1200
          },
          "inventoryUnits": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,6})?$",
            "maxLength": 64
          },
          "offerUnits": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,6})?$",
            "maxLength": 64
          },
          "price": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,2})?$",
            "maxLength": 64
          },
          "minimumTicket": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,2})?$",
            "maxLength": 64
          },
          "maximumTicket": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,2})?$",
            "maxLength": 64
          },
          "sourceReference": {
            "type": "string",
            "pattern": "^DEMO-[A-Z0-9-]{1,100}$"
          },
          "acknowledged": {
            "const": true
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{12,90}$"
          }
        },
        "required": [
          "expectedVersion",
          "acknowledged"
        ],
        "additionalProperties": false
      },
      "MarketVersion": {
        "type": "object",
        "properties": {
          "expectedVersion": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "expectedVersion"
        ],
        "additionalProperties": false
      },
      "MarketReview": {
        "type": "object",
        "properties": {
          "expectedVersion": {
            "type": "integer",
            "minimum": 0
          },
          "decision": {
            "enum": [
              "publish",
              "return"
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1200
          },
          "complianceId": {
            "type": "string"
          },
          "railsId": {
            "type": "string"
          },
          "auditorId": {
            "type": "string"
          }
        },
        "required": [
          "expectedVersion",
          "decision",
          "reason"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "properties": {
                "decision": {
                  "const": "publish"
                }
              }
            },
            "then": {
              "required": [
                "complianceId",
                "railsId",
                "auditorId"
              ]
            }
          }
        ]
      },
      "MarketRequest": {
        "type": "object",
        "properties": {
          "offerId": {
            "type": "string"
          },
          "quantity": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,6})?$",
            "maxLength": 64
          },
          "price": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,2})?$",
            "maxLength": 64
          },
          "message": {
            "type": "string",
            "maxLength": 1200
          },
          "acknowledged": {
            "const": true
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{12,90}$"
          }
        },
        "required": [
          "offerId",
          "quantity",
          "price",
          "acknowledged",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "MarketMessage": {
        "type": "object",
        "properties": {
          "body": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1200
          },
          "expectedVersion": {
            "type": "integer",
            "minimum": 0
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{12,90}$"
          }
        },
        "required": [
          "body",
          "expectedVersion",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "MarketOpenDeal": {
        "type": "object",
        "properties": {
          "expectedVersion": {
            "type": "integer",
            "minimum": 0
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{12,90}$"
          }
        },
        "required": [
          "expectedVersion",
          "idempotencyKey"
        ],
        "additionalProperties": false
      },
      "MarketDecline": {
        "type": "object",
        "properties": {
          "expectedVersion": {
            "type": "integer",
            "minimum": 0
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1200
          }
        },
        "required": [
          "expectedVersion",
          "reason"
        ],
        "additionalProperties": false
      },
      "AssistedResaleReview": {
        "type": "object",
        "properties": {
          "caseId": {
            "type": "string",
            "pattern": "^PILOT-[A-Z0-9-]+$"
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 1200
          },
          "idempotencyKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{12,90}$"
          }
        },
        "required": [
          "caseId",
          "reason",
          "idempotencyKey"
        ],
        "additionalProperties": false
      }
    }
  }
}
