{
  "openapi": "3.1.0",
  "info": {
    "title": "Tallylane API",
    "version": "0.1.0",
    "description": "Tallylane TEST API for business records, customers, invoice drafts, human review, verified payments and accounting outcomes. Use an account-scoped API credential for machine routes and a current user session for workspace routes. Each operation documents its authentication, permissions, request and response. TEST and Sandbox capabilities depend on the deployed release and enabled business access. Saving a draft, issuing an invoice, confirming payment and verifying accounting are separate outcomes."
  },
  "servers": [
    {
      "url": "https://tallylane-api.vercel.app"
    }
  ],
  "security": [],
  "paths": {
    "/": {
      "get": {
        "operationId": "getServiceMetadata",
        "summary": "Service metadata",
        "responses": {
          "200": {
            "description": "Service identity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": {
                      "type": "string",
                      "const": "tallylane-api"
                    },
                    "version": {
                      "type": "string",
                      "const": "0.1.0"
                    },
                    "health": {
                      "type": "string",
                      "const": "/health"
                    }
                  },
                  "required": [
                    "service",
                    "version",
                    "health"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "getLiveness",
        "summary": "API process liveness; no database or provider checks",
        "responses": {
          "200": {
            "description": "Running API process",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "unhealthy"
                      ]
                    },
                    "service": {
                      "type": "string",
                      "const": "tallylane-api"
                    },
                    "version": {
                      "type": "string",
                      "const": "0.1.0"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "status",
                    "service",
                    "version",
                    "timestamp"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/health/db": {
      "get": {
        "operationId": "getDatabaseReadiness",
        "summary": "PostgreSQL connection and pending migration check",
        "responses": {
          "200": {
            "description": "Connected, no pending migration",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "ok"
                    },
                    "canConnect": {
                      "type": "boolean",
                      "const": true
                    },
                    "schemaReady": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "status",
                    "canConnect",
                    "schemaReady"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Unconfigured, unavailable, or pending migration",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "unconfigured"
                        },
                        "canConnect": {
                          "type": "boolean",
                          "const": false
                        },
                        "schemaReady": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "status",
                        "canConnect",
                        "schemaReady"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "unavailable"
                        },
                        "canConnect": {
                          "type": "boolean",
                          "const": false
                        },
                        "schemaReady": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "status",
                        "canConnect",
                        "schemaReady"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "migration_required"
                        },
                        "canConnect": {
                          "type": "boolean",
                          "const": true
                        },
                        "schemaReady": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "status",
                        "canConnect",
                        "schemaReady"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "getIdentity",
        "summary": "Current provisioned user identity",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Current permitted metadata",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "userId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "enum": [
                        "test",
                        "live"
                      ]
                    }
                  },
                  "required": [
                    "userId",
                    "environment"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "access_denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "identity_unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "identity_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses": {
      "get": {
        "operationId": "listBusinesses",
        "summary": "Active direct business memberships in the server environment",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Keyset cursor from nextCursor. The server applies current permissions before pagination."
          }
        ],
        "responses": {
          "200": {
            "description": "Current permitted metadata",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businesses": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "businessId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "legalName": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "finance_admin",
                              "finance_operator",
                              "approver",
                              "bookkeeper",
                              "viewer"
                            ]
                          },
                          "environment": {
                            "type": "string",
                            "enum": [
                              "test",
                              "live"
                            ]
                          }
                        },
                        "required": [
                          "businessId",
                          "legalName",
                          "role",
                          "environment"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 100
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "accountContext": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "accountMode",
                            "bindingId",
                            "assignedBusinessId",
                            "canCreateBusiness",
                            "adminAccess"
                          ],
                          "properties": {
                            "accountMode": {
                              "const": "managed_customer",
                              "type": "string"
                            },
                            "bindingId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "assignedBusinessId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "canCreateBusiness": {
                              "const": false,
                              "type": "boolean"
                            },
                            "adminAccess": {
                              "const": false,
                              "type": "boolean"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "accountMode",
                            "bindingId",
                            "assignedBusinessId",
                            "canCreateBusiness",
                            "adminAccess"
                          ],
                          "properties": {
                            "accountMode": {
                              "const": "platform_admin",
                              "type": "string"
                            },
                            "bindingId": {
                              "type": "null"
                            },
                            "assignedBusinessId": {
                              "type": "null"
                            },
                            "canCreateBusiness": {
                              "const": false,
                              "type": "boolean"
                            },
                            "adminAccess": {
                              "const": true,
                              "type": "boolean"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "accountMode",
                            "bindingId",
                            "assignedBusinessId",
                            "canCreateBusiness",
                            "adminAccess"
                          ],
                          "properties": {
                            "accountMode": {
                              "const": "legacy",
                              "type": "string"
                            },
                            "bindingId": {
                              "type": "null"
                            },
                            "assignedBusinessId": {
                              "type": "null"
                            },
                            "canCreateBusiness": {
                              "const": false,
                              "type": "boolean"
                            },
                            "adminAccess": {
                              "const": false,
                              "type": "boolean"
                            }
                          }
                        }
                      ]
                    }
                  },
                  "required": [
                    "businesses",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "access_denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "identity_unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "identity_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "invalid_cursor",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_cursor"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createBusinessSetup",
        "summary": "Self-service business creation is closed",
        "description": "Customers receive an admin-created account and one assigned business. This retained legacy route denies authenticated clients with 403 business_provisioning_required and performs no setup write. It never replays or creates a business.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [],
        "responses": {
          "401": {
            "description": "Invalid or missing signed user session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Business must be provisioned through platform administration",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "business_provisioning_required"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}": {
      "get": {
        "operationId": "getBusiness",
        "summary": "Business metadata for a current direct membership",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current permitted metadata",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "legalName": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "approver",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "environment": {
                      "type": "string",
                      "enum": [
                        "test",
                        "live"
                      ]
                    }
                  },
                  "required": [
                    "businessId",
                    "legalName",
                    "role",
                    "environment"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "access_denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "identity_unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "identity_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "not_found",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/profile": {
      "get": {
        "operationId": "readBusinessProfile",
        "summary": "Read self-declared legal details under current membership and RLS",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Permitted self-declared business details",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessForm": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "tradingName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "addressLine1": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "addressLine2": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "town": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "county": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "postcode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "companyNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "vatNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "legalName": {
                      "type": "string"
                    },
                    "vatRegistrationStatus": {
                      "type": "string",
                      "enum": [
                        "registered",
                        "not_registered",
                        "unknown"
                      ]
                    },
                    "country": {
                      "type": "string",
                      "const": "GB"
                    },
                    "invoiceCurrency": {
                      "type": "string",
                      "const": "GBP"
                    },
                    "locale": {
                      "type": "string",
                      "const": "en-GB"
                    },
                    "timeZone": {
                      "type": "string",
                      "const": "Europe/London"
                    },
                    "onboardingState": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "ready"
                      ]
                    },
                    "environment": {
                      "type": "string",
                      "enum": [
                        "test",
                        "live"
                      ]
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "approver",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "identityVerified": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "businessForm",
                    "tradingName",
                    "addressLine1",
                    "addressLine2",
                    "town",
                    "county",
                    "postcode",
                    "companyNumber",
                    "vatNumber",
                    "businessId",
                    "legalName",
                    "vatRegistrationStatus",
                    "country",
                    "invoiceCurrency",
                    "locale",
                    "timeZone",
                    "onboardingState",
                    "environment",
                    "role",
                    "identityVerified"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Unknown, foreign, revoked or suspended business/user access",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency or authorization configuration unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "setup_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/customers": {
      "get": {
        "operationId": "listCustomers",
        "summary": "Current authorised customer directory, bounded keyset pages",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "archived",
                "all"
              ],
              "default": "active"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Permitted current data or minimal command acknowledgement",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "enum": [
                        "test",
                        "live"
                      ]
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "customers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "customerId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "customerType": {
                            "type": "string",
                            "enum": [
                              "company",
                              "individual"
                            ]
                          },
                          "legalName": {
                            "type": "string"
                          },
                          "contactName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "email": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paymentTermsDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 365
                          },
                          "deliveryPreference": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "email"
                            ]
                          },
                          "collectionsPaused": {
                            "type": "boolean"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "archived"
                            ]
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          }
                        },
                        "required": [
                          "customerId",
                          "customerType",
                          "legalName",
                          "contactName",
                          "email",
                          "paymentTermsDays",
                          "deliveryPreference",
                          "collectionsPaused",
                          "status",
                          "version"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 100
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "customers",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "invalid request/query/key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "current identity/role denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "absent or inaccessible business/customer",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "dependency/runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "customers_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createCustomer",
        "summary": "Create a self-declared customer contact once",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Permitted current data or minimal command acknowledgement",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "customerId",
                    "businessId",
                    "version",
                    "created",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "New customer; Location identifies current profile",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "customerId",
                    "businessId",
                    "version",
                    "created",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "invalid request/query/key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "current identity/role denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "absent or inaccessible business/customer",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "dependency/runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "customers_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "canonical key conflict or invalid customer state",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Maximum16KiB; exact camelCase keys, no duplicate properties. Customer capture does not verify tax or communication consent. A command replay acknowledgement may name a historical version; GET current profile before editing.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerType": {
                    "type": "string",
                    "enum": [
                      "company",
                      "individual"
                    ]
                  },
                  "legalName": {
                    "type": "string"
                  },
                  "contactName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "paymentTermsDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  },
                  "deliveryPreference": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "email"
                    ]
                  },
                  "collectionsPaused": {
                    "type": "boolean"
                  },
                  "addressLine1": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "addressLine2": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "town": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "county": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "postcode": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "vatNumber": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "country": {
                    "type": "string",
                    "const": "GB"
                  }
                },
                "required": [
                  "customerType",
                  "legalName"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/customers/{customerId}": {
      "get": {
        "operationId": "getCustomer",
        "summary": "Current customer contact and domain row version",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Permitted current data or minimal command acknowledgement",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Representation tag; a hosting edge may transform this to a weak tag. Do not use it for hosted mutations."
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Canonical quoted positive Int32 row version, matching body.version. Copy this into Tallylane-If-Version for the next command."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerType": {
                      "type": "string",
                      "enum": [
                        "company",
                        "individual"
                      ]
                    },
                    "legalName": {
                      "type": "string"
                    },
                    "contactName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paymentTermsDays": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 365
                    },
                    "deliveryPreference": {
                      "type": "string",
                      "enum": [
                        "manual",
                        "email"
                      ]
                    },
                    "collectionsPaused": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "archived"
                      ]
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "enum": [
                        "test",
                        "live"
                      ]
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "addressLine1": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "addressLine2": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "town": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "county": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "postcode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "vatNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "country": {
                      "type": "string",
                      "const": "GB"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "archivedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "customerId",
                    "customerType",
                    "legalName",
                    "contactName",
                    "email",
                    "paymentTermsDays",
                    "deliveryPreference",
                    "collectionsPaused",
                    "status",
                    "version",
                    "businessId",
                    "environment",
                    "role",
                    "addressLine1",
                    "addressLine2",
                    "town",
                    "county",
                    "postcode",
                    "vatNumber",
                    "country",
                    "createdAt",
                    "updatedAt",
                    "archivedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "invalid request/query/key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "current identity/role denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "absent or inaccessible business/customer",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "dependency/runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "customers_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "mutateCustomer",
        "summary": "Versioned full-profile update, archive or restore",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]*\"$"
            },
            "description": "Exact Tallylane-Version from the current profile, for example \"1\" (positive Int32). Weak, wildcard, multiple and leading-zero tokens are rejected. Do not send If-Match alongside this header. Direct-origin legacy If-Match compatibility is retained but hosting edges may intercept it; the web BFF accepts only Tallylane-If-Version."
          }
        ],
        "responses": {
          "200": {
            "description": "Permitted current data or minimal command acknowledgement",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "customerId",
                    "businessId",
                    "version",
                    "created",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "invalid request/query/key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "current identity/role denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "absent or inaccessible business/customer",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "dependency/runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "customers_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "canonical key conflict or invalid customer state",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "customer version changed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "One exact current domain version precondition required; competing legacy and domain headers are rejected",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Maximum16KiB; exact camelCase keys, no duplicate properties. Customer capture does not verify tax or communication consent. A command replay acknowledgement may name a historical version; GET current profile before editing. Update replaces the entire editable profile: omitted optional text fields become null; country defaults GB, terms 30 days, delivery manual and collectionsPaused false. Include every current value to preserve it.",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "update"
                      },
                      "profile": {
                        "type": "object",
                        "properties": {
                          "customerType": {
                            "type": "string",
                            "enum": [
                              "company",
                              "individual"
                            ]
                          },
                          "legalName": {
                            "type": "string"
                          },
                          "contactName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "email": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paymentTermsDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 365
                          },
                          "deliveryPreference": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "email"
                            ]
                          },
                          "collectionsPaused": {
                            "type": "boolean"
                          },
                          "addressLine1": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "addressLine2": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "town": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "county": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "postcode": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "vatNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "country": {
                            "type": "string",
                            "const": "GB"
                          }
                        },
                        "required": [
                          "customerType",
                          "legalName"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "action",
                      "profile"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "archive",
                          "restore"
                        ]
                      },
                      "profile": {
                        "type": "object",
                        "properties": {},
                        "required": [],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "action",
                      "profile"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices": {
      "get": {
        "operationId": "listInvoiceDrafts",
        "summary": "Scoped UUID-paginated TEST draft and issued invoice directory",
        "description": "Current provider session and scoped membership rechecked. At most 100 rows with UUID cursor. Closed documentState variants: only issued rows include the immutable allocated TEST number; drafts omit number. Directory returns no legal snapshots or provider execution.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "At most100 scoped draft summaries",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "invoices": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "customerId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "version": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 2147483647
                              },
                              "documentState": {
                                "type": "string",
                                "const": "draft"
                              },
                              "calculationState": {
                                "type": "string",
                                "enum": [
                                  "calculated",
                                  "unresolved"
                                ]
                              },
                              "net": {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "vat": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "gross": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "updatedAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            },
                            "required": [
                              "invoiceId",
                              "customerId",
                              "version",
                              "documentState",
                              "calculationState",
                              "net",
                              "vat",
                              "gross",
                              "createdAt",
                              "updatedAt"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "customerId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "version": {
                                "type": "integer",
                                "minimum": 2,
                                "maximum": 2147483647
                              },
                              "documentState": {
                                "type": "string",
                                "const": "issued"
                              },
                              "calculationState": {
                                "type": "string",
                                "const": "calculated"
                              },
                              "net": {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "vat": {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "gross": {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "updatedAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "number": {
                                "type": "string",
                                "pattern": "^TST-(?!000000$)(?:[0-9]{6}|[1-9][0-9]{6,8}|1000000000)$",
                                "maxLength": 14
                              }
                            },
                            "required": [
                              "invoiceId",
                              "customerId",
                              "version",
                              "documentState",
                              "calculationState",
                              "net",
                              "vat",
                              "gross",
                              "createdAt",
                              "updatedAt",
                              "number"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "maxItems": 100,
                      "minItems": 0
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "invoices",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency or privileged runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_drafts_unavailable",
                        "invoice_issuance_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createInvoiceDraft",
        "summary": "Save one scoped test invoice draft",
        "description": "Controlled test invoice drafts only. Current provider session, identity and business membership are independently rechecked. No legal issue, number allocation, delivery, payment, accounting or agent execution.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "First durable draft acknowledgement",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Quoted positive Int32 domain row version. A command replay may acknowledge a historical version; fetch detail before another edit."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Scoped draft detail path"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "invoiceId",
                    "businessId",
                    "version",
                    "created",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Original canonical command acknowledgement replay",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Quoted positive Int32 domain row version. A command replay may acknowledge a historical version; fetch detail before another edit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "invoiceId",
                    "businessId",
                    "version",
                    "created",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Canonical key conflict or archived customer/state conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Draft/source version changed; review current source before a new edit",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency or privileged runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_drafts_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Full editable draft replacement; maximum64KiB, exact unique camelCase keys. No caller totals, actor/environment, VAT registration/rate, issued number/state accepted. Dates optional; omitted optional text/dates/unit become null and scenario unknown. Decimal strings <=4places, quantity>0, price>=0, each<=1m; known net/gross<=GBP1bn. Tax derives from current scoped business/customer and controlled test policy; unknown/unsupported retains null VAT/gross. Saving never issues/sends.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "currency": {
                    "type": "string",
                    "const": "GBP"
                  },
                  "supplyDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "intendedIssueDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "dueDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "supplyScenario": {
                    "type": "string",
                    "enum": [
                      "domestic_b2b_services",
                      "unknown",
                      "unsupported"
                    ]
                  },
                  "purchaseOrderReference": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "unit": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 40
                        },
                        "quantity": {
                          "type": "string",
                          "maxLength": 12,
                          "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,4})?$"
                        },
                        "unitNetAmount": {
                          "type": "string",
                          "maxLength": 12,
                          "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,4})?$"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 64,
                          "pattern": "^[A-Z][A-Z0-9_]{0,63}$"
                        }
                      },
                      "required": [
                        "description",
                        "quantity",
                        "unitNetAmount",
                        "taxCode"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "minItems": 1
                  }
                },
                "required": [
                  "customerId",
                  "currency",
                  "lines"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}": {
      "get": {
        "operationId": "getInvoiceDraft",
        "summary": "Read current TEST draft or immutable issued invoice",
        "description": "Current session and scoped read membership required. documentState discriminates closed draft and issued variants. Draft returns current sourceChanged/customerArchived warnings and no legal number. Issued returns the retained legal seller/buyer, content and calculation with allocated number, snapshot identity/hash and issued time; it does not rejoin mutable customer/seller facts. Verified receipts/allocations independently project unpaid/partially_paid/paid, exact confirmedPaid/outstanding and safe current checkout capabilities without changing issued version/hash. Delivery, accounting and PDF remain not_sent/not_started/not_available.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Scoped current draft with known or explicitly unresolved amounts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Quoted positive Int32 domain row version. A command replay may acknowledge a historical version; fetch detail before another edit."
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "finance_admin",
                            "finance_operator",
                            "bookkeeper",
                            "viewer"
                          ]
                        },
                        "documentState": {
                          "type": "string",
                          "const": "draft"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "customerId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "customerVersion": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "sellerVatStatus": {
                          "type": "string",
                          "enum": [
                            "registered",
                            "not_registered",
                            "unknown"
                          ]
                        },
                        "sourceChanged": {
                          "type": "boolean"
                        },
                        "customerArchived": {
                          "type": "boolean"
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "customerId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "supplyDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "intendedIssueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "dueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "supplyScenario": {
                              "type": "string",
                              "enum": [
                                "domestic_b2b_services",
                                "unknown",
                                "unsupported"
                              ]
                            },
                            "purchaseOrderReference": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 200
                            },
                            "notes": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 2000
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "description": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 1000
                                  },
                                  "unit": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "maxLength": 40
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64,
                                    "pattern": "^[A-Z][A-Z0-9_]{0,63}$"
                                  }
                                },
                                "required": [
                                  "description",
                                  "unit",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            }
                          },
                          "required": [
                            "customerId",
                            "currency",
                            "supplyDate",
                            "intendedIssueDate",
                            "dueDate",
                            "supplyScenario",
                            "purchaseOrderReference",
                            "notes",
                            "lines"
                          ],
                          "additionalProperties": false
                        },
                        "calculation": {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "calculated",
                                "unresolved"
                              ]
                            },
                            "policyVersion": {
                              "type": "string",
                              "const": "UK_DOMESTIC_SERVICES_TEST_V1"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "totals": {
                              "type": "object",
                              "properties": {
                                "net": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "vat": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "gross": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "roundingAdjustment": {
                                  "type": "string",
                                  "const": "0.00"
                                }
                              },
                              "required": [
                                "net",
                                "vat",
                                "gross",
                                "roundingAdjustment"
                              ],
                              "additionalProperties": false
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "position": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  "unroundedNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{8}$"
                                  },
                                  "netAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "taxClassification": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "standard",
                                      "not_registered",
                                      null
                                    ]
                                  },
                                  "effectiveRate": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "0.20",
                                      "0.00",
                                      null
                                    ]
                                  },
                                  "vatAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "grossAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  }
                                },
                                "required": [
                                  "position",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode",
                                  "unroundedNetAmount",
                                  "netAmount",
                                  "taxClassification",
                                  "effectiveRate",
                                  "vatAmount",
                                  "grossAmount"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            },
                            "blockers": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "vat_registration_unknown",
                                  "unsupported_supply_scenario",
                                  "tax_point_unresolved",
                                  "tax_rule_date_unsupported",
                                  "unsupported_tax_code",
                                  "non_registered_cannot_charge_vat",
                                  "tax_code_registration_mismatch"
                                ]
                              },
                              "maxItems": 7,
                              "minItems": 0
                            },
                            "errors": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "lineIndex": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0,
                                    "maximum": 99
                                  },
                                  "field": {
                                    "type": "string"
                                  },
                                  "code": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "lineIndex",
                                  "field",
                                  "code"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 0,
                              "minItems": 0
                            },
                            "calculationResolved": {
                              "type": "boolean"
                            },
                            "liveIssueApproved": {
                              "type": "boolean",
                              "const": false
                            }
                          },
                          "required": [
                            "state",
                            "policyVersion",
                            "currency",
                            "totals",
                            "lines",
                            "blockers",
                            "errors",
                            "calculationResolved",
                            "liveIssueApproved"
                          ],
                          "additionalProperties": false
                        },
                        "issueAvailable": {
                          "type": "boolean",
                          "const": false
                        },
                        "deliveryState": {
                          "type": "string",
                          "const": "not_sent"
                        },
                        "accountingSyncState": {
                          "type": "string",
                          "const": "not_started"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "invoiceId",
                        "businessId",
                        "environment",
                        "role",
                        "documentState",
                        "version",
                        "customerId",
                        "customerVersion",
                        "sellerVatStatus",
                        "sourceChanged",
                        "customerArchived",
                        "content",
                        "calculation",
                        "issueAvailable",
                        "deliveryState",
                        "accountingSyncState",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "finance_admin",
                            "finance_operator",
                            "bookkeeper",
                            "viewer"
                          ]
                        },
                        "documentState": {
                          "type": "string",
                          "const": "issued"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 2,
                          "maximum": 2147483647
                        },
                        "customerId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "customerVersion": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "sellerVatStatus": {
                          "type": "string",
                          "enum": [
                            "registered",
                            "not_registered",
                            "unknown"
                          ]
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "customerId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "supplyDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "intendedIssueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "dueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "supplyScenario": {
                              "type": "string",
                              "enum": [
                                "domestic_b2b_services",
                                "unknown",
                                "unsupported"
                              ]
                            },
                            "purchaseOrderReference": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 200
                            },
                            "notes": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 2000
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "description": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 1000
                                  },
                                  "unit": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "maxLength": 40
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64,
                                    "pattern": "^[A-Z][A-Z0-9_]{0,63}$"
                                  }
                                },
                                "required": [
                                  "description",
                                  "unit",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            }
                          },
                          "required": [
                            "customerId",
                            "currency",
                            "supplyDate",
                            "intendedIssueDate",
                            "dueDate",
                            "supplyScenario",
                            "purchaseOrderReference",
                            "notes",
                            "lines"
                          ],
                          "additionalProperties": false
                        },
                        "calculation": {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "calculated"
                            },
                            "policyVersion": {
                              "type": "string",
                              "const": "UK_DOMESTIC_SERVICES_TEST_V1"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "totals": {
                              "type": "object",
                              "properties": {
                                "net": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "vat": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "gross": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "roundingAdjustment": {
                                  "type": "string",
                                  "const": "0.00"
                                }
                              },
                              "required": [
                                "net",
                                "vat",
                                "gross",
                                "roundingAdjustment"
                              ],
                              "additionalProperties": false
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "position": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  "unroundedNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{8}$"
                                  },
                                  "netAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "taxClassification": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "standard",
                                      "not_registered",
                                      null
                                    ]
                                  },
                                  "effectiveRate": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "0.20",
                                      "0.00",
                                      null
                                    ]
                                  },
                                  "vatAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "grossAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  }
                                },
                                "required": [
                                  "position",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode",
                                  "unroundedNetAmount",
                                  "netAmount",
                                  "taxClassification",
                                  "effectiveRate",
                                  "vatAmount",
                                  "grossAmount"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            },
                            "blockers": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "vat_registration_unknown",
                                  "unsupported_supply_scenario",
                                  "tax_point_unresolved",
                                  "tax_rule_date_unsupported",
                                  "unsupported_tax_code",
                                  "non_registered_cannot_charge_vat",
                                  "tax_code_registration_mismatch"
                                ]
                              },
                              "maxItems": 0,
                              "minItems": 0
                            },
                            "errors": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "lineIndex": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0,
                                    "maximum": 99
                                  },
                                  "field": {
                                    "type": "string"
                                  },
                                  "code": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "lineIndex",
                                  "field",
                                  "code"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 0,
                              "minItems": 0
                            },
                            "calculationResolved": {
                              "type": "boolean",
                              "const": true
                            },
                            "liveIssueApproved": {
                              "type": "boolean",
                              "const": false
                            }
                          },
                          "required": [
                            "state",
                            "policyVersion",
                            "currency",
                            "totals",
                            "lines",
                            "blockers",
                            "errors",
                            "calculationResolved",
                            "liveIssueApproved"
                          ],
                          "additionalProperties": false
                        },
                        "issueAvailable": {
                          "type": "boolean",
                          "const": false
                        },
                        "deliveryState": {
                          "type": "string",
                          "const": "not_sent"
                        },
                        "accountingSyncState": {
                          "type": "string",
                          "enum": [
                            "not_started",
                            "in_progress",
                            "needs_review",
                            "synced"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "number": {
                          "type": "string",
                          "pattern": "^TST-(?!000000$)(?:[0-9]{6}|[1-9][0-9]{6,8}|1000000000)$",
                          "maxLength": 14
                        },
                        "issuedSnapshotId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "snapshotHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "issuedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "sellerLegalName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "buyerLegalName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "pdfState": {
                          "type": "string",
                          "enum": [
                            "not_available",
                            "on_demand"
                          ],
                          "description": "On-demand generation capability; never a pending/ready storage or delivery job."
                        },
                        "paymentState": {
                          "type": "string",
                          "enum": [
                            "unpaid",
                            "partially_paid",
                            "paid"
                          ]
                        },
                        "outstanding": {
                          "type": "object",
                          "properties": {
                            "amount": {
                              "type": "string",
                              "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            }
                          },
                          "required": [
                            "amount",
                            "currency"
                          ],
                          "additionalProperties": false
                        },
                        "confirmedPaid": {
                          "type": "object",
                          "properties": {
                            "amount": {
                              "type": "string",
                              "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            }
                          },
                          "required": [
                            "amount",
                            "currency"
                          ],
                          "additionalProperties": false
                        },
                        "checkout": {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "not_started",
                                "reserved",
                                "unknown",
                                "ready",
                                "failed",
                                "manual_reconciliation"
                              ]
                            },
                            "canStart": {
                              "type": "boolean"
                            },
                            "canResume": {
                              "type": "boolean"
                            },
                            "commandId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "uuid"
                            },
                            "requestKey": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "uuid"
                            },
                            "hostedUrl": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 8192,
                              "pattern": "^https://checkout\\.stripe\\.com/c/pay/cs_test_[A-Za-z0-9]{1,240}([?#].*)?$"
                            },
                            "canCheckPayment": {
                              "type": "boolean",
                              "description": "Current separately gated owner/finance_admin permission for original ready unpaid checkout; absent legacy field means false."
                            }
                          },
                          "required": [
                            "state",
                            "canStart",
                            "canResume",
                            "commandId",
                            "requestKey",
                            "hostedUrl"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "invoiceId",
                        "businessId",
                        "environment",
                        "role",
                        "documentState",
                        "version",
                        "customerId",
                        "customerVersion",
                        "sellerVatStatus",
                        "content",
                        "calculation",
                        "issueAvailable",
                        "deliveryState",
                        "accountingSyncState",
                        "createdAt",
                        "updatedAt",
                        "number",
                        "issuedSnapshotId",
                        "snapshotHash",
                        "issuedAt",
                        "sellerLegalName",
                        "buyerLegalName",
                        "pdfState",
                        "paymentState",
                        "outstanding",
                        "confirmedPaid",
                        "checkout"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency or privileged runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_drafts_unavailable",
                        "invoice_issuance_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateInvoiceDraft",
        "summary": "Versioned full editable draft replacement",
        "description": "Controlled test invoice drafts only. Current provider session, identity and business membership are independently rechecked. No legal issue, number allocation, delivery, payment, accounting or agent execution.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]*\"$"
            },
            "description": "Exact quoted positive Int32 Tallylane-Version from current detail. HTTP If-Match, weak/wildcard/list/duplicate/leading-zero tokens are rejected."
          }
        ],
        "responses": {
          "200": {
            "description": "Durable update or historical canonical replay acknowledgement",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Quoted positive Int32 domain row version. A command replay may acknowledge a historical version; fetch detail before another edit."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "invoiceId",
                    "businessId",
                    "version",
                    "created",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Canonical key conflict or archived customer/state conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Draft/source version changed; review current source before a new edit",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency or privileged runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_drafts_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "One canonical quoted Tallylane-If-Version required; If-Match is rejected",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Full editable draft replacement; maximum64KiB, exact unique camelCase keys. No caller totals, actor/environment, VAT registration/rate, issued number/state accepted. Dates optional; omitted optional text/dates/unit become null and scenario unknown. Decimal strings <=4places, quantity>0, price>=0, each<=1m; known net/gross<=GBP1bn. Tax derives from current scoped business/customer and controlled test policy; unknown/unsupported retains null VAT/gross. Saving never issues/sends.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "currency": {
                    "type": "string",
                    "const": "GBP"
                  },
                  "supplyDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "intendedIssueDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "dueDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "supplyScenario": {
                    "type": "string",
                    "enum": [
                      "domestic_b2b_services",
                      "unknown",
                      "unsupported"
                    ]
                  },
                  "purchaseOrderReference": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "unit": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 40
                        },
                        "quantity": {
                          "type": "string",
                          "maxLength": 12,
                          "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,4})?$"
                        },
                        "unitNetAmount": {
                          "type": "string",
                          "maxLength": 12,
                          "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,4})?$"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 64,
                          "pattern": "^[A-Z][A-Z0-9_]{0,63}$"
                        }
                      },
                      "required": [
                        "description",
                        "quantity",
                        "unitNetAmount",
                        "taxCode"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "minItems": 1
                  }
                },
                "required": [
                  "customerId",
                  "currency",
                  "lines"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/issue-reviews": {
      "post": {
        "operationId": "prepareInvoiceIssueReview",
        "summary": "Prepare immutable test evidence; issuance always unavailable",
        "description": "Empty bounded JSON object only (2 KiB, depth 2). Current session, write role, parent and TEST environment required before replay. The same actor/business/key and invoice/version returns identical retained evidence, including original expiry. Both first preparation and replay return 200. No issue, approval, number, outbox or delivery. Snapshot hashes use canonical PostgreSQL jsonb text, not client serialization.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]*\"$"
            },
            "description": "Exact quoted positive Int32 Tallylane-Version from current detail. HTTP If-Match, weak/wildcard/list/duplicate/leading-zero tokens are rejected."
          }
        ],
        "responses": {
          "200": {
            "description": "Retained immutable test review; may be historical and expired. issueAvailable is always false.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Captured invoice version of this immutable review; may differ from current draft version."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Scoped review resource."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reviewId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "invoiceVersion": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "snapshotHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "snapshot": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "integer",
                          "const": 1
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "invoiceVersion": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "currency": {
                          "type": "string",
                          "const": "GBP"
                        },
                        "actualIssueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "seller": {
                          "type": "object",
                          "properties": {
                            "businessId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "legalName": {
                              "type": "string"
                            },
                            "businessForm": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "tradingName": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine1": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine2": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "town": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "county": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "postcode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": "string",
                              "const": "GB"
                            },
                            "companyNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "vatRegistrationStatus": {
                              "type": "string",
                              "enum": [
                                "registered",
                                "not_registered",
                                "unknown"
                              ]
                            },
                            "vatNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "onboardingState": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "ready"
                              ]
                            }
                          },
                          "required": [
                            "businessId",
                            "legalName",
                            "businessForm",
                            "tradingName",
                            "addressLine1",
                            "addressLine2",
                            "town",
                            "county",
                            "postcode",
                            "country",
                            "companyNumber",
                            "vatRegistrationStatus",
                            "vatNumber",
                            "onboardingState"
                          ],
                          "additionalProperties": false
                        },
                        "sellerSourceHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "buyer": {
                          "type": "object",
                          "properties": {
                            "customerId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "customerType": {
                              "type": "string",
                              "enum": [
                                "company",
                                "individual"
                              ]
                            },
                            "legalName": {
                              "type": "string"
                            },
                            "addressLine1": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine2": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "town": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "county": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "postcode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": "string",
                              "const": "GB"
                            },
                            "vatNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "paymentTermsDays": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 365
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "archived"
                              ]
                            }
                          },
                          "required": [
                            "customerId",
                            "version",
                            "customerType",
                            "legalName",
                            "addressLine1",
                            "addressLine2",
                            "town",
                            "county",
                            "postcode",
                            "country",
                            "vatNumber",
                            "paymentTermsDays",
                            "status"
                          ],
                          "additionalProperties": false
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "customerId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "supplyDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "intendedIssueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "dueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "supplyScenario": {
                              "type": "string",
                              "enum": [
                                "domestic_b2b_services",
                                "unknown",
                                "unsupported"
                              ]
                            },
                            "purchaseOrderReference": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 200
                            },
                            "notes": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 2000
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "description": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 1000
                                  },
                                  "unit": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "maxLength": 40
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64,
                                    "pattern": "^[A-Z][A-Z0-9_]{0,63}$"
                                  }
                                },
                                "required": [
                                  "description",
                                  "unit",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            }
                          },
                          "required": [
                            "customerId",
                            "currency",
                            "supplyDate",
                            "intendedIssueDate",
                            "dueDate",
                            "supplyScenario",
                            "purchaseOrderReference",
                            "notes",
                            "lines"
                          ],
                          "additionalProperties": false
                        },
                        "calculation": {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "calculated",
                                "unresolved"
                              ]
                            },
                            "policyVersion": {
                              "type": "string",
                              "const": "UK_DOMESTIC_SERVICES_TEST_V1"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "totals": {
                              "type": "object",
                              "properties": {
                                "net": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "vat": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "gross": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "roundingAdjustment": {
                                  "type": "string",
                                  "const": "0.00"
                                }
                              },
                              "required": [
                                "net",
                                "vat",
                                "gross",
                                "roundingAdjustment"
                              ],
                              "additionalProperties": false
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "position": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  "unroundedNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{8}$"
                                  },
                                  "netAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "taxClassification": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "standard",
                                      "not_registered",
                                      null
                                    ]
                                  },
                                  "effectiveRate": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "0.20",
                                      "0.00",
                                      null
                                    ]
                                  },
                                  "vatAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "grossAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  }
                                },
                                "required": [
                                  "position",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode",
                                  "unroundedNetAmount",
                                  "netAmount",
                                  "taxClassification",
                                  "effectiveRate",
                                  "vatAmount",
                                  "grossAmount"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            },
                            "blockers": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "vat_registration_unknown",
                                  "unsupported_supply_scenario",
                                  "tax_point_unresolved",
                                  "tax_rule_date_unsupported",
                                  "unsupported_tax_code",
                                  "non_registered_cannot_charge_vat",
                                  "tax_code_registration_mismatch"
                                ]
                              },
                              "maxItems": 7,
                              "minItems": 0
                            },
                            "errors": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "lineIndex": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0,
                                    "maximum": 99
                                  },
                                  "field": {
                                    "type": "string"
                                  },
                                  "code": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "lineIndex",
                                  "field",
                                  "code"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 0,
                              "minItems": 0
                            },
                            "calculationResolved": {
                              "type": "boolean"
                            },
                            "liveIssueApproved": {
                              "type": "boolean",
                              "const": false
                            }
                          },
                          "required": [
                            "state",
                            "policyVersion",
                            "currency",
                            "totals",
                            "lines",
                            "blockers",
                            "errors",
                            "calculationResolved",
                            "liveIssueApproved"
                          ],
                          "additionalProperties": false
                        },
                        "capturedCustomerVersion": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "capturedSellerVatStatus": {
                          "type": "string",
                          "enum": [
                            "registered",
                            "not_registered",
                            "unknown"
                          ]
                        },
                        "approvalState": {
                          "type": "string",
                          "const": "not_configured"
                        },
                        "issueAvailable": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "environment",
                        "invoiceId",
                        "invoiceVersion",
                        "currency",
                        "actualIssueDate",
                        "seller",
                        "sellerSourceHash",
                        "buyer",
                        "content",
                        "calculation",
                        "capturedCustomerVersion",
                        "capturedSellerVatStatus",
                        "approvalState",
                        "issueAvailable"
                      ],
                      "additionalProperties": false
                    },
                    "blockers": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "approval_not_configured",
                          "buyer_address_incomplete",
                          "customer_archived",
                          "draft_source_changed",
                          "due_date_before_issue",
                          "due_date_required",
                          "issue_date_requires_review",
                          "non_registered_cannot_charge_vat",
                          "seller_identity_incomplete",
                          "seller_onboarding_incomplete",
                          "supply_date_required",
                          "tax_code_registration_mismatch",
                          "tax_point_unresolved",
                          "tax_rule_date_unsupported",
                          "tax_unresolved",
                          "unsupported_supply_scenario",
                          "unsupported_tax_code",
                          "vat_registration_unknown"
                        ]
                      },
                      "minItems": 1
                    },
                    "issueAvailable": {
                      "type": "boolean",
                      "const": false
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "reviewId",
                    "invoiceId",
                    "businessId",
                    "environment",
                    "invoiceVersion",
                    "snapshotHash",
                    "snapshot",
                    "blockers",
                    "issueAvailable",
                    "createdAt",
                    "expiresAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Same actor/business/key reused with another invoice or expected version",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Fresh preparation uses stale invoice version or locked source changed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency, bounded timeout or privileged runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_issue_reviews_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "One canonical quoted Tallylane-If-Version required; If-Match is rejected",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/issue-reviews/{reviewId}": {
      "get": {
        "operationId": "getInvoiceIssueReview",
        "summary": "Read a retained scoped immutable test review",
        "description": "No query parameters or directory endpoint. Current session and active read membership required. Historical snapshot/expiry are returned unchanged, without recalculation or current-readiness inference. Parent business, invoice and review must all match. No request key, actor ID, command hash, private audit or buyer contact/delivery preference.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "reviewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained immutable test review; may be historical and expired. issueAvailable is always false.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Captured invoice version of this immutable review; may differ from current draft version."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reviewId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "invoiceVersion": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "snapshotHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "snapshot": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "integer",
                          "const": 1
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "invoiceVersion": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "currency": {
                          "type": "string",
                          "const": "GBP"
                        },
                        "actualIssueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "seller": {
                          "type": "object",
                          "properties": {
                            "businessId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "legalName": {
                              "type": "string"
                            },
                            "businessForm": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "tradingName": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine1": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine2": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "town": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "county": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "postcode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": "string",
                              "const": "GB"
                            },
                            "companyNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "vatRegistrationStatus": {
                              "type": "string",
                              "enum": [
                                "registered",
                                "not_registered",
                                "unknown"
                              ]
                            },
                            "vatNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "onboardingState": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "ready"
                              ]
                            }
                          },
                          "required": [
                            "businessId",
                            "legalName",
                            "businessForm",
                            "tradingName",
                            "addressLine1",
                            "addressLine2",
                            "town",
                            "county",
                            "postcode",
                            "country",
                            "companyNumber",
                            "vatRegistrationStatus",
                            "vatNumber",
                            "onboardingState"
                          ],
                          "additionalProperties": false
                        },
                        "sellerSourceHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "buyer": {
                          "type": "object",
                          "properties": {
                            "customerId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "customerType": {
                              "type": "string",
                              "enum": [
                                "company",
                                "individual"
                              ]
                            },
                            "legalName": {
                              "type": "string"
                            },
                            "addressLine1": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine2": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "town": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "county": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "postcode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": "string",
                              "const": "GB"
                            },
                            "vatNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "paymentTermsDays": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 365
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "archived"
                              ]
                            }
                          },
                          "required": [
                            "customerId",
                            "version",
                            "customerType",
                            "legalName",
                            "addressLine1",
                            "addressLine2",
                            "town",
                            "county",
                            "postcode",
                            "country",
                            "vatNumber",
                            "paymentTermsDays",
                            "status"
                          ],
                          "additionalProperties": false
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "customerId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "supplyDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "intendedIssueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "dueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "supplyScenario": {
                              "type": "string",
                              "enum": [
                                "domestic_b2b_services",
                                "unknown",
                                "unsupported"
                              ]
                            },
                            "purchaseOrderReference": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 200
                            },
                            "notes": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 2000
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "description": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 1000
                                  },
                                  "unit": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "maxLength": 40
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64,
                                    "pattern": "^[A-Z][A-Z0-9_]{0,63}$"
                                  }
                                },
                                "required": [
                                  "description",
                                  "unit",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            }
                          },
                          "required": [
                            "customerId",
                            "currency",
                            "supplyDate",
                            "intendedIssueDate",
                            "dueDate",
                            "supplyScenario",
                            "purchaseOrderReference",
                            "notes",
                            "lines"
                          ],
                          "additionalProperties": false
                        },
                        "calculation": {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "calculated",
                                "unresolved"
                              ]
                            },
                            "policyVersion": {
                              "type": "string",
                              "const": "UK_DOMESTIC_SERVICES_TEST_V1"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "totals": {
                              "type": "object",
                              "properties": {
                                "net": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "vat": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "gross": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "roundingAdjustment": {
                                  "type": "string",
                                  "const": "0.00"
                                }
                              },
                              "required": [
                                "net",
                                "vat",
                                "gross",
                                "roundingAdjustment"
                              ],
                              "additionalProperties": false
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "position": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  "unroundedNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{8}$"
                                  },
                                  "netAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "taxClassification": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "standard",
                                      "not_registered",
                                      null
                                    ]
                                  },
                                  "effectiveRate": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "0.20",
                                      "0.00",
                                      null
                                    ]
                                  },
                                  "vatAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "grossAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  }
                                },
                                "required": [
                                  "position",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode",
                                  "unroundedNetAmount",
                                  "netAmount",
                                  "taxClassification",
                                  "effectiveRate",
                                  "vatAmount",
                                  "grossAmount"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            },
                            "blockers": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "vat_registration_unknown",
                                  "unsupported_supply_scenario",
                                  "tax_point_unresolved",
                                  "tax_rule_date_unsupported",
                                  "unsupported_tax_code",
                                  "non_registered_cannot_charge_vat",
                                  "tax_code_registration_mismatch"
                                ]
                              },
                              "maxItems": 7,
                              "minItems": 0
                            },
                            "errors": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "lineIndex": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0,
                                    "maximum": 99
                                  },
                                  "field": {
                                    "type": "string"
                                  },
                                  "code": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "lineIndex",
                                  "field",
                                  "code"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 0,
                              "minItems": 0
                            },
                            "calculationResolved": {
                              "type": "boolean"
                            },
                            "liveIssueApproved": {
                              "type": "boolean",
                              "const": false
                            }
                          },
                          "required": [
                            "state",
                            "policyVersion",
                            "currency",
                            "totals",
                            "lines",
                            "blockers",
                            "errors",
                            "calculationResolved",
                            "liveIssueApproved"
                          ],
                          "additionalProperties": false
                        },
                        "capturedCustomerVersion": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "capturedSellerVatStatus": {
                          "type": "string",
                          "enum": [
                            "registered",
                            "not_registered",
                            "unknown"
                          ]
                        },
                        "approvalState": {
                          "type": "string",
                          "const": "not_configured"
                        },
                        "issueAvailable": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "environment",
                        "invoiceId",
                        "invoiceVersion",
                        "currency",
                        "actualIssueDate",
                        "seller",
                        "sellerSourceHash",
                        "buyer",
                        "content",
                        "calculation",
                        "capturedCustomerVersion",
                        "capturedSellerVatStatus",
                        "approvalState",
                        "issueAvailable"
                      ],
                      "additionalProperties": false
                    },
                    "blockers": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "approval_not_configured",
                          "buyer_address_incomplete",
                          "customer_archived",
                          "draft_source_changed",
                          "due_date_before_issue",
                          "due_date_required",
                          "issue_date_requires_review",
                          "non_registered_cannot_charge_vat",
                          "seller_identity_incomplete",
                          "seller_onboarding_incomplete",
                          "supply_date_required",
                          "tax_code_registration_mismatch",
                          "tax_point_unresolved",
                          "tax_rule_date_unsupported",
                          "tax_unresolved",
                          "unsupported_supply_scenario",
                          "unsupported_tax_code",
                          "vat_registration_unknown"
                        ]
                      },
                      "minItems": 1
                    },
                    "issueAvailable": {
                      "type": "boolean",
                      "const": false
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "reviewId",
                    "invoiceId",
                    "businessId",
                    "environment",
                    "invoiceVersion",
                    "snapshotHash",
                    "snapshot",
                    "blockers",
                    "issueAvailable",
                    "createdAt",
                    "expiresAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency, bounded timeout or privileged runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_issue_reviews_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/calculate": {
      "post": {
        "operationId": "calculateInvoiceDraft",
        "summary": "Preview scoped test invoice amounts without saving",
        "description": "Read-only current-source calculation. No draft, command, audit, issue, payment or delivery write. Preview is advisory; save rechecks sources.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current-source calculation preview, including unresolved blockers",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator"
                      ]
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "customerVersion": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "sellerVatStatus": {
                      "type": "string",
                      "enum": [
                        "registered",
                        "not_registered",
                        "unknown"
                      ]
                    },
                    "calculation": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "calculated",
                            "unresolved"
                          ]
                        },
                        "policyVersion": {
                          "type": "string",
                          "const": "UK_DOMESTIC_SERVICES_TEST_V1"
                        },
                        "currency": {
                          "type": "string",
                          "const": "GBP"
                        },
                        "totals": {
                          "type": "object",
                          "properties": {
                            "net": {
                              "type": "string",
                              "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                            },
                            "vat": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                            },
                            "gross": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                            },
                            "roundingAdjustment": {
                              "type": "string",
                              "const": "0.00"
                            }
                          },
                          "required": [
                            "net",
                            "vat",
                            "gross",
                            "roundingAdjustment"
                          ],
                          "additionalProperties": false
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "position": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100
                              },
                              "quantity": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                              },
                              "unitNetAmount": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                              },
                              "taxCode": {
                                "type": "string",
                                "maxLength": 64
                              },
                              "unroundedNetAmount": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{8}$"
                              },
                              "netAmount": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                              },
                              "taxClassification": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "enum": [
                                  "standard",
                                  "not_registered",
                                  null
                                ]
                              },
                              "effectiveRate": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "enum": [
                                  "0.20",
                                  "0.00",
                                  null
                                ]
                              },
                              "vatAmount": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                              },
                              "grossAmount": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                              }
                            },
                            "required": [
                              "position",
                              "quantity",
                              "unitNetAmount",
                              "taxCode",
                              "unroundedNetAmount",
                              "netAmount",
                              "taxClassification",
                              "effectiveRate",
                              "vatAmount",
                              "grossAmount"
                            ],
                            "additionalProperties": false
                          },
                          "maxItems": 100,
                          "minItems": 1
                        },
                        "blockers": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "vat_registration_unknown",
                              "unsupported_supply_scenario",
                              "tax_point_unresolved",
                              "tax_rule_date_unsupported",
                              "unsupported_tax_code",
                              "non_registered_cannot_charge_vat",
                              "tax_code_registration_mismatch"
                            ]
                          },
                          "maxItems": 7,
                          "minItems": 0
                        },
                        "errors": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "lineIndex": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "minimum": 0,
                                "maximum": 99
                              },
                              "field": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "lineIndex",
                              "field",
                              "code"
                            ],
                            "additionalProperties": false
                          },
                          "maxItems": 0,
                          "minItems": 0
                        },
                        "calculationResolved": {
                          "type": "boolean"
                        },
                        "liveIssueApproved": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "state",
                        "policyVersion",
                        "currency",
                        "totals",
                        "lines",
                        "blockers",
                        "errors",
                        "calculationResolved",
                        "liveIssueApproved"
                      ],
                      "additionalProperties": false
                    },
                    "issueAvailable": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "customerId",
                    "customerVersion",
                    "sellerVatStatus",
                    "calculation",
                    "issueAvailable"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Canonical key conflict or archived customer/state conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "customer_archived"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency or privileged runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_drafts_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Full editable draft replacement; maximum64KiB, exact unique camelCase keys. No caller totals, actor/environment, VAT registration/rate, issued number/state accepted. Dates optional; omitted optional text/dates/unit become null and scenario unknown. Decimal strings <=4places, quantity>0, price>=0, each<=1m; known net/gross<=GBP1bn. Tax derives from current scoped business/customer and controlled test policy; unknown/unsupported retains null VAT/gross. Saving never issues/sends.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "currency": {
                    "type": "string",
                    "const": "GBP"
                  },
                  "supplyDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "intendedIssueDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "dueDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "supplyScenario": {
                    "type": "string",
                    "enum": [
                      "domestic_b2b_services",
                      "unknown",
                      "unsupported"
                    ]
                  },
                  "purchaseOrderReference": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "unit": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 40
                        },
                        "quantity": {
                          "type": "string",
                          "maxLength": 12,
                          "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,4})?$"
                        },
                        "unitNetAmount": {
                          "type": "string",
                          "maxLength": 12,
                          "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,4})?$"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 64,
                          "pattern": "^[A-Z][A-Z0-9_]{0,63}$"
                        }
                      },
                      "required": [
                        "description",
                        "quantity",
                        "unitNetAmount",
                        "taxCode"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "minItems": 1
                  }
                },
                "required": [
                  "customerId",
                  "currency",
                  "lines"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/issue-approvers": {
      "get": {
        "operationId": "listInvoiceIssueApprovers",
        "summary": "List eligible distinct TEST invoice approvers",
        "description": "Current owner/finance_admin only. Independent mode excludes requester; explicitly configured eligible single_owner mode returns the sole current owner only. No company-form inference. Safe bounded labels; no general user directory. Captured policy returned.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency, bounded timeout, missing issuance persistence or privileged runtime unavailable.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_issuance_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Validated scoped result; issue returns 200 only for durable replay.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "approvers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "finance_admin",
                              "approver"
                            ]
                          },
                          "displayName": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 254
                          },
                          "email": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 254
                          }
                        },
                        "required": [
                          "userId",
                          "role",
                          "displayName",
                          "email"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "approvalPolicy": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "independent_reviewer",
                            "single_owner"
                          ]
                        },
                        "revision": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "default",
                            "owner_decision"
                          ]
                        },
                        "receiptId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "ownerId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "mode",
                        "revision",
                        "source",
                        "receiptId",
                        "ownerId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "approvers",
                    "approvalPolicy"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/issue-proposals": {
      "post": {
        "operationId": "prepareInvoiceIssueProposal",
        "summary": "Prepare immutable TEST invoice proposal for an assigned human",
        "description": "No query parameters. Closed JSON, no duplicate keys; at most 8192 UTF-8 bytes, 4096 decoded JSON characters and depth 4. One nonzero UUID Idempotency-Key and canonical quoted positive Int32 Tallylane-If-Version required; If-Match is forbidden. Only explicit server TEST configuration, enabled test issuance and a current private business grant permit writes. Current provider session and roles are rechecked before replay. Owner/finance_admin assigns a distinct current owner/finance_admin/approver. Header binds current draft version. Retained snapshot hash uses server canonical PostgreSQL JSON, never client serialization. proposalVersion is immutable 1. Expiry, sources and private grant are bound. This prepares a proposal without issuing or allocating a number. Actor capability booleans are derived from current access. Captures immutable business approval mode and revision. Existing/missing policies remain independent reviewer. Explicit owner single_owner policy permits the sole active human owner to review their own proposal; policy changes invalidate unissued proposals.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]*\"$"
            },
            "description": "Exact quoted positive Int32 Tallylane-Version from current detail. HTTP If-Match, weak/wildcard/list/duplicate/leading-zero tokens are rejected."
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required",
                        "test_issuance_disabled"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency, bounded timeout, missing issuance persistence or privileged runtime unavailable.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_issuance_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Conflicting idempotent command, changed gate/state, expired proposal, blocked issuance or conflicting final decision.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Stale invoice/proposal version or legal/customer/calculation source changed.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "One canonical quoted Tallylane-If-Version required; If-Match is rejected",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Historical retained result with current actor capabilities.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Quoted proposalVersion (1) for proposals/decisions, or the resulting issued version for issue acknowledgements."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Scoped proposal resource for proposal/decision; scoped invoice resource for issue."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "proposalId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "invoiceVersion": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "proposalVersion": {
                      "type": "integer",
                      "const": 1
                    },
                    "assignedApproverId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "snapshotHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "snapshot": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "integer",
                          "const": 2
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "invoiceVersion": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "currency": {
                          "type": "string",
                          "const": "GBP"
                        },
                        "actualIssueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "seller": {
                          "type": "object",
                          "properties": {
                            "businessId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "legalName": {
                              "type": "string"
                            },
                            "businessForm": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "tradingName": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine1": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine2": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "town": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "county": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "postcode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": "string",
                              "const": "GB"
                            },
                            "companyNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "vatRegistrationStatus": {
                              "type": "string",
                              "enum": [
                                "registered",
                                "not_registered",
                                "unknown"
                              ]
                            },
                            "vatNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "onboardingState": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "ready"
                              ]
                            }
                          },
                          "required": [
                            "businessId",
                            "legalName",
                            "businessForm",
                            "tradingName",
                            "addressLine1",
                            "addressLine2",
                            "town",
                            "county",
                            "postcode",
                            "country",
                            "companyNumber",
                            "vatRegistrationStatus",
                            "vatNumber",
                            "onboardingState"
                          ],
                          "additionalProperties": false
                        },
                        "sellerSourceHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "buyer": {
                          "type": "object",
                          "properties": {
                            "customerId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "customerType": {
                              "type": "string",
                              "enum": [
                                "company",
                                "individual"
                              ]
                            },
                            "legalName": {
                              "type": "string"
                            },
                            "addressLine1": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine2": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "town": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "county": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "postcode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": "string",
                              "const": "GB"
                            },
                            "vatNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "paymentTermsDays": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 365
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "archived"
                              ]
                            }
                          },
                          "required": [
                            "customerId",
                            "version",
                            "customerType",
                            "legalName",
                            "addressLine1",
                            "addressLine2",
                            "town",
                            "county",
                            "postcode",
                            "country",
                            "vatNumber",
                            "paymentTermsDays",
                            "status"
                          ],
                          "additionalProperties": false
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "customerId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "supplyDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "intendedIssueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "dueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "supplyScenario": {
                              "type": "string",
                              "enum": [
                                "domestic_b2b_services",
                                "unknown",
                                "unsupported"
                              ]
                            },
                            "purchaseOrderReference": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 200
                            },
                            "notes": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 2000
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "description": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 1000
                                  },
                                  "unit": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "maxLength": 40
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64,
                                    "pattern": "^[A-Z][A-Z0-9_]{0,63}$"
                                  }
                                },
                                "required": [
                                  "description",
                                  "unit",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            }
                          },
                          "required": [
                            "customerId",
                            "currency",
                            "supplyDate",
                            "intendedIssueDate",
                            "dueDate",
                            "supplyScenario",
                            "purchaseOrderReference",
                            "notes",
                            "lines"
                          ],
                          "additionalProperties": false
                        },
                        "calculation": {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "calculated",
                                "unresolved"
                              ]
                            },
                            "policyVersion": {
                              "type": "string",
                              "const": "UK_DOMESTIC_SERVICES_TEST_V1"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "totals": {
                              "type": "object",
                              "properties": {
                                "net": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "vat": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "gross": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "roundingAdjustment": {
                                  "type": "string",
                                  "const": "0.00"
                                }
                              },
                              "required": [
                                "net",
                                "vat",
                                "gross",
                                "roundingAdjustment"
                              ],
                              "additionalProperties": false
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "position": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  "unroundedNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{8}$"
                                  },
                                  "netAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "taxClassification": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "standard",
                                      "not_registered",
                                      null
                                    ]
                                  },
                                  "effectiveRate": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "0.20",
                                      "0.00",
                                      null
                                    ]
                                  },
                                  "vatAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "grossAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  }
                                },
                                "required": [
                                  "position",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode",
                                  "unroundedNetAmount",
                                  "netAmount",
                                  "taxClassification",
                                  "effectiveRate",
                                  "vatAmount",
                                  "grossAmount"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            },
                            "blockers": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "vat_registration_unknown",
                                  "unsupported_supply_scenario",
                                  "tax_point_unresolved",
                                  "tax_rule_date_unsupported",
                                  "unsupported_tax_code",
                                  "non_registered_cannot_charge_vat",
                                  "tax_code_registration_mismatch"
                                ]
                              },
                              "maxItems": 7,
                              "minItems": 0
                            },
                            "errors": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "lineIndex": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0,
                                    "maximum": 99
                                  },
                                  "field": {
                                    "type": "string"
                                  },
                                  "code": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "lineIndex",
                                  "field",
                                  "code"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 0,
                              "minItems": 0
                            },
                            "calculationResolved": {
                              "type": "boolean"
                            },
                            "liveIssueApproved": {
                              "type": "boolean",
                              "const": false
                            }
                          },
                          "required": [
                            "state",
                            "policyVersion",
                            "currency",
                            "totals",
                            "lines",
                            "blockers",
                            "errors",
                            "calculationResolved",
                            "liveIssueApproved"
                          ],
                          "additionalProperties": false
                        },
                        "capturedCustomerVersion": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "capturedSellerVatStatus": {
                          "type": "string",
                          "enum": [
                            "registered",
                            "not_registered",
                            "unknown"
                          ]
                        },
                        "approvalPolicy": {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "enum": [
                                "independent_reviewer",
                                "single_owner"
                              ]
                            },
                            "revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "default",
                                "owner_decision"
                              ]
                            },
                            "receiptId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "uuid"
                            },
                            "ownerId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "uuid"
                            }
                          },
                          "required": [
                            "mode",
                            "revision",
                            "source",
                            "receiptId",
                            "ownerId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "environment",
                        "invoiceId",
                        "invoiceVersion",
                        "currency",
                        "actualIssueDate",
                        "seller",
                        "sellerSourceHash",
                        "buyer",
                        "content",
                        "calculation",
                        "capturedCustomerVersion",
                        "capturedSellerVatStatus"
                      ],
                      "additionalProperties": false
                    },
                    "blockers": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                      }
                    },
                    "approvalState": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "approved",
                        "rejected"
                      ]
                    },
                    "decisionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "actorCanDecide": {
                      "type": "boolean"
                    },
                    "actorCanIssue": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "approvalPolicy": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "independent_reviewer",
                            "single_owner"
                          ]
                        },
                        "revision": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "default",
                            "owner_decision"
                          ]
                        },
                        "receiptId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "ownerId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "mode",
                        "revision",
                        "source",
                        "receiptId",
                        "ownerId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "proposalId",
                    "invoiceId",
                    "businessId",
                    "environment",
                    "invoiceVersion",
                    "proposalVersion",
                    "assignedApproverId",
                    "snapshotHash",
                    "snapshot",
                    "blockers",
                    "approvalState",
                    "decisionId",
                    "actorCanDecide",
                    "actorCanIssue",
                    "createdAt",
                    "expiresAt",
                    "approvalPolicy"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "assignedApproverId": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "assignedApproverId"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/issue-proposals/{proposalId}": {
      "get": {
        "operationId": "getInvoiceIssueProposal",
        "summary": "Read retained TEST proposal with current actor capabilities",
        "description": "No query parameters. Current proposer or assigned eligible approver only within exact business/invoice/proposal scope. Returns immutable retained snapshot plus current decision state and actorCanDecide/actorCanIssue. Read may be historical; a readable proposal alone does not authorize issue. Tallylane-Version is proposalVersion 1. Captures immutable business approval mode and revision. Existing/missing policies remain independent reviewer. Explicit owner single_owner policy permits the sole active human owner to review their own proposal; policy changes invalidate unissued proposals.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency, bounded timeout, missing issuance persistence or privileged runtime unavailable.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_issuance_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Historical retained result with current actor capabilities.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Quoted proposalVersion (1) for proposals/decisions, or the resulting issued version for issue acknowledgements."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "proposalId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "invoiceVersion": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "proposalVersion": {
                      "type": "integer",
                      "const": 1
                    },
                    "assignedApproverId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "snapshotHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "snapshot": {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "integer",
                          "const": 2
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "invoiceVersion": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "currency": {
                          "type": "string",
                          "const": "GBP"
                        },
                        "actualIssueDate": {
                          "type": "string",
                          "format": "date"
                        },
                        "seller": {
                          "type": "object",
                          "properties": {
                            "businessId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "legalName": {
                              "type": "string"
                            },
                            "businessForm": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "tradingName": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine1": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine2": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "town": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "county": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "postcode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": "string",
                              "const": "GB"
                            },
                            "companyNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "vatRegistrationStatus": {
                              "type": "string",
                              "enum": [
                                "registered",
                                "not_registered",
                                "unknown"
                              ]
                            },
                            "vatNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "onboardingState": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "ready"
                              ]
                            }
                          },
                          "required": [
                            "businessId",
                            "legalName",
                            "businessForm",
                            "tradingName",
                            "addressLine1",
                            "addressLine2",
                            "town",
                            "county",
                            "postcode",
                            "country",
                            "companyNumber",
                            "vatRegistrationStatus",
                            "vatNumber",
                            "onboardingState"
                          ],
                          "additionalProperties": false
                        },
                        "sellerSourceHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "buyer": {
                          "type": "object",
                          "properties": {
                            "customerId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "customerType": {
                              "type": "string",
                              "enum": [
                                "company",
                                "individual"
                              ]
                            },
                            "legalName": {
                              "type": "string"
                            },
                            "addressLine1": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "addressLine2": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "town": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "county": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "postcode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": "string",
                              "const": "GB"
                            },
                            "vatNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "paymentTermsDays": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 365
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "archived"
                              ]
                            }
                          },
                          "required": [
                            "customerId",
                            "version",
                            "customerType",
                            "legalName",
                            "addressLine1",
                            "addressLine2",
                            "town",
                            "county",
                            "postcode",
                            "country",
                            "vatNumber",
                            "paymentTermsDays",
                            "status"
                          ],
                          "additionalProperties": false
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "customerId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "supplyDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "intendedIssueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "dueDate": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date"
                            },
                            "supplyScenario": {
                              "type": "string",
                              "enum": [
                                "domestic_b2b_services",
                                "unknown",
                                "unsupported"
                              ]
                            },
                            "purchaseOrderReference": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 200
                            },
                            "notes": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "maxLength": 2000
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "description": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 1000
                                  },
                                  "unit": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "maxLength": 40
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64,
                                    "pattern": "^[A-Z][A-Z0-9_]{0,63}$"
                                  }
                                },
                                "required": [
                                  "description",
                                  "unit",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            }
                          },
                          "required": [
                            "customerId",
                            "currency",
                            "supplyDate",
                            "intendedIssueDate",
                            "dueDate",
                            "supplyScenario",
                            "purchaseOrderReference",
                            "notes",
                            "lines"
                          ],
                          "additionalProperties": false
                        },
                        "calculation": {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "calculated",
                                "unresolved"
                              ]
                            },
                            "policyVersion": {
                              "type": "string",
                              "const": "UK_DOMESTIC_SERVICES_TEST_V1"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "totals": {
                              "type": "object",
                              "properties": {
                                "net": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "vat": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "gross": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                },
                                "roundingAdjustment": {
                                  "type": "string",
                                  "const": "0.00"
                                }
                              },
                              "required": [
                                "net",
                                "vat",
                                "gross",
                                "roundingAdjustment"
                              ],
                              "additionalProperties": false
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "position": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 100
                                  },
                                  "quantity": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "unitNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{4}$"
                                  },
                                  "taxCode": {
                                    "type": "string",
                                    "maxLength": 64
                                  },
                                  "unroundedNetAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{8}$"
                                  },
                                  "netAmount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "taxClassification": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "standard",
                                      "not_registered",
                                      null
                                    ]
                                  },
                                  "effectiveRate": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "enum": [
                                      "0.20",
                                      "0.00",
                                      null
                                    ]
                                  },
                                  "vatAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "grossAmount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  }
                                },
                                "required": [
                                  "position",
                                  "quantity",
                                  "unitNetAmount",
                                  "taxCode",
                                  "unroundedNetAmount",
                                  "netAmount",
                                  "taxClassification",
                                  "effectiveRate",
                                  "vatAmount",
                                  "grossAmount"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 100,
                              "minItems": 1
                            },
                            "blockers": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "vat_registration_unknown",
                                  "unsupported_supply_scenario",
                                  "tax_point_unresolved",
                                  "tax_rule_date_unsupported",
                                  "unsupported_tax_code",
                                  "non_registered_cannot_charge_vat",
                                  "tax_code_registration_mismatch"
                                ]
                              },
                              "maxItems": 7,
                              "minItems": 0
                            },
                            "errors": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "lineIndex": {
                                    "type": [
                                      "integer",
                                      "null"
                                    ],
                                    "minimum": 0,
                                    "maximum": 99
                                  },
                                  "field": {
                                    "type": "string"
                                  },
                                  "code": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "lineIndex",
                                  "field",
                                  "code"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 0,
                              "minItems": 0
                            },
                            "calculationResolved": {
                              "type": "boolean"
                            },
                            "liveIssueApproved": {
                              "type": "boolean",
                              "const": false
                            }
                          },
                          "required": [
                            "state",
                            "policyVersion",
                            "currency",
                            "totals",
                            "lines",
                            "blockers",
                            "errors",
                            "calculationResolved",
                            "liveIssueApproved"
                          ],
                          "additionalProperties": false
                        },
                        "capturedCustomerVersion": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "capturedSellerVatStatus": {
                          "type": "string",
                          "enum": [
                            "registered",
                            "not_registered",
                            "unknown"
                          ]
                        },
                        "approvalPolicy": {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "enum": [
                                "independent_reviewer",
                                "single_owner"
                              ]
                            },
                            "revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "default",
                                "owner_decision"
                              ]
                            },
                            "receiptId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "uuid"
                            },
                            "ownerId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "uuid"
                            }
                          },
                          "required": [
                            "mode",
                            "revision",
                            "source",
                            "receiptId",
                            "ownerId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "environment",
                        "invoiceId",
                        "invoiceVersion",
                        "currency",
                        "actualIssueDate",
                        "seller",
                        "sellerSourceHash",
                        "buyer",
                        "content",
                        "calculation",
                        "capturedCustomerVersion",
                        "capturedSellerVatStatus"
                      ],
                      "additionalProperties": false
                    },
                    "blockers": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                      }
                    },
                    "approvalState": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "approved",
                        "rejected"
                      ]
                    },
                    "decisionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "actorCanDecide": {
                      "type": "boolean"
                    },
                    "actorCanIssue": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "approvalPolicy": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "independent_reviewer",
                            "single_owner"
                          ]
                        },
                        "revision": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "default",
                            "owner_decision"
                          ]
                        },
                        "receiptId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "ownerId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "mode",
                        "revision",
                        "source",
                        "receiptId",
                        "ownerId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "proposalId",
                    "invoiceId",
                    "businessId",
                    "environment",
                    "invoiceVersion",
                    "proposalVersion",
                    "assignedApproverId",
                    "snapshotHash",
                    "snapshot",
                    "blockers",
                    "approvalState",
                    "decisionId",
                    "actorCanDecide",
                    "actorCanIssue",
                    "createdAt",
                    "expiresAt",
                    "approvalPolicy"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/issue-proposals/{proposalId}/decision": {
      "post": {
        "operationId": "decideInvoiceIssueProposal",
        "summary": "Approve or reject the bound TEST proposal",
        "description": "No query parameters. Closed JSON, no duplicate keys; at most 8192 UTF-8 bytes, 4096 decoded JSON characters and depth 4. One nonzero UUID Idempotency-Key and canonical quoted positive Int32 Tallylane-If-Version required; If-Match is forbidden. Only explicit server TEST configuration, enabled test issuance and a current private business grant permit writes. Current provider session and roles are rechecked before replay. Only the distinct assigned current eligible approver can decide. Header binds proposalVersion 1. Snapshot hash must equal the retained proposal. Exactly one final decision; reject requires nonblank reason. Optional reason is nullable, at most 500 characters, trimmed and normalized to NFC; controls and malformed Unicode are rejected. Durable replay retains the original decision. Captures immutable business approval mode and revision. Existing/missing policies remain independent reviewer. Explicit owner single_owner policy permits the sole active human owner to review their own proposal; policy changes invalidate unissued proposals.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]*\"$"
            },
            "description": "Exact quoted positive Int32 Tallylane-Version from current detail. HTTP If-Match, weak/wildcard/list/duplicate/leading-zero tokens are rejected."
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required",
                        "test_issuance_disabled"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency, bounded timeout, missing issuance persistence or privileged runtime unavailable.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_issuance_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Conflicting idempotent command, changed gate/state, expired proposal, blocked issuance or conflicting final decision.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Stale invoice/proposal version or legal/customer/calculation source changed.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "One canonical quoted Tallylane-If-Version required; If-Match is rejected",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Validated scoped result; issue returns 200 only for durable replay.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Quoted proposalVersion (1) for proposals/decisions, or the resulting issued version for issue acknowledgements."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Scoped proposal resource for proposal/decision; scoped invoice resource for issue."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "proposalId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "decisionId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "proposalVersion": {
                      "type": "integer",
                      "const": 1
                    },
                    "decision": {
                      "type": "string",
                      "enum": [
                        "approve",
                        "reject"
                      ]
                    },
                    "snapshotHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "proposalId",
                    "decisionId",
                    "businessId",
                    "invoiceId",
                    "proposalVersion",
                    "decision",
                    "snapshotHash",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "snapshotHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "approve",
                      "reject"
                    ]
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  }
                },
                "required": [
                  "snapshotHash",
                  "decision"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/issue": {
      "post": {
        "operationId": "issueTestInvoice",
        "summary": "Issue one approved immutable TEST invoice",
        "description": "No query parameters. Closed JSON, no duplicate keys; at most 8192 UTF-8 bytes, 4096 decoded JSON characters and depth 4. One nonzero UUID Idempotency-Key and canonical quoted positive Int32 Tallylane-If-Version required; If-Match is forbidden. Only explicit server TEST configuration, enabled test issuance and a current private business grant permit writes. Current provider session and roles are rechecked before replay. Current owner/finance_admin supplies the bound approved proposal and decision. Header binds the current draft version; body snapshotHash is the approved proposal hash. Server locks and rechecks legal facts, tax, date, policy and grant, then atomically allocates one TST number, captures the issued snapshot, increments version, records audit/request receipt and an InvoiceIssued outbox event. Returned snapshotHash identifies the issued snapshot and may differ from the approved proposal hash. Issued invoices cannot be edited. Delivery/PDF/payment/accounting work is not implied by this operation.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]*\"$"
            },
            "description": "Exact quoted positive Int32 Tallylane-Version from current detail. HTTP If-Match, weak/wildcard/list/duplicate/leading-zero tokens are rejected."
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required",
                        "test_issuance_disabled"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency, bounded timeout, missing issuance persistence or privileged runtime unavailable.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_issuance_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Conflicting idempotent command, changed gate/state, expired proposal, blocked issuance or conflicting final decision.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Stale invoice/proposal version or legal/customer/calculation source changed.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "One canonical quoted Tallylane-If-Version required; If-Match is rejected",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Durable issue replay; returns the same allocated number and issued snapshot.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Quoted proposalVersion (1) for proposals/decisions, or the resulting issued version for issue acknowledgements."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Scoped proposal resource for proposal/decision; scoped invoice resource for issue."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 2,
                      "maximum": 2147483647
                    },
                    "documentState": {
                      "type": "string",
                      "const": "issued"
                    },
                    "number": {
                      "type": "string",
                      "pattern": "^TST-(?!000000$)(?:[0-9]{6}|[1-9][0-9]{6,8}|1000000000)$",
                      "maxLength": 14
                    },
                    "issuedSnapshotId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "snapshotHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "created": {
                      "type": "boolean",
                      "const": false
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "invoiceId",
                    "businessId",
                    "environment",
                    "version",
                    "documentState",
                    "number",
                    "issuedSnapshotId",
                    "snapshotHash",
                    "created",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "First atomic TEST issue; resulting invoice version is prior draft version plus one.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                },
                "description": "Quoted proposalVersion (1) for proposals/decisions, or the resulting issued version for issue acknowledgements."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Scoped proposal resource for proposal/decision; scoped invoice resource for issue."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 2,
                      "maximum": 2147483647
                    },
                    "documentState": {
                      "type": "string",
                      "const": "issued"
                    },
                    "number": {
                      "type": "string",
                      "pattern": "^TST-(?!000000$)(?:[0-9]{6}|[1-9][0-9]{6,8}|1000000000)$",
                      "maxLength": 14
                    },
                    "issuedSnapshotId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "snapshotHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "created": {
                      "type": "boolean",
                      "const": true
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "invoiceId",
                    "businessId",
                    "environment",
                    "version",
                    "documentState",
                    "number",
                    "issuedSnapshotId",
                    "snapshotHash",
                    "created",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "proposalId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "decisionId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "snapshotHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                },
                "required": [
                  "proposalId",
                  "decisionId",
                  "snapshotHash"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/integrations/xero": {
      "get": {
        "operationId": "getXeroDemoConnection",
        "summary": "Current owner reads the last independently verified UK GBP demo connection",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid closed request, query or canonical key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked genuine session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current owner or private TEST grant denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or unavailable scoped resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Expired, terminal, conflicting or busy connection command",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "flow_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Default disabled, unconfigured or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Stored connection proof; no indefinite token freshness or export claim",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "status": {
                          "type": "string",
                          "const": "connected"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "tenantId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "countryCode": {
                          "type": "string",
                          "const": "GB"
                        },
                        "currency": {
                          "type": "string",
                          "const": "GBP"
                        },
                        "isDemoCompany": {
                          "type": "boolean",
                          "const": true
                        },
                        "verifiedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "status",
                        "connectionId",
                        "tenantId",
                        "countryCode",
                        "currency",
                        "isDemoCompany",
                        "verifiedAt"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "status": {
                          "type": "string",
                          "const": "disconnected"
                        },
                        "connectionId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            null
                          ]
                        },
                        "tenantId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            null
                          ]
                        },
                        "countryCode": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            null
                          ]
                        },
                        "currency": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            null
                          ]
                        },
                        "verifiedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            null
                          ]
                        },
                        "isDemoCompany": {
                          "type": [
                            "boolean",
                            "null"
                          ],
                          "enum": [
                            null
                          ]
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "status",
                        "connectionId",
                        "tenantId",
                        "countryCode",
                        "currency",
                        "verifiedAt",
                        "isDemoCompany"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/integrations/xero/authorizations": {
      "post": {
        "operationId": "startXeroDemoAuthorization",
        "summary": "Owner starts or replays a private TEST UK demo OAuth request",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Invalid closed request, query or canonical key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked genuine session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current owner or private TEST grant denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or unavailable scoped resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Expired, terminal, conflicting or busy connection command",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "flow_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Default disabled, unconfigured or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "New encrypted pending flow; fixed Xero consent URL",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "flowId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "status": {
                      "type": "string",
                      "const": "pending"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "authorizationUrl": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096,
                      "pattern": "^https://login\\.xero\\.com/identity/connect/authorize\\?"
                    }
                  },
                  "required": [
                    "flowId",
                    "businessId",
                    "environment",
                    "status",
                    "expiresAt",
                    "authorizationUrl"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Same original session/key replay; original fixed consent URL",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "flowId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "status": {
                      "type": "string",
                      "const": "pending"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "authorizationUrl": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096,
                      "pattern": "^https://login\\.xero\\.com/identity/connect/authorize\\?"
                    }
                  },
                  "required": [
                    "flowId",
                    "businessId",
                    "environment",
                    "status",
                    "expiresAt",
                    "authorizationUrl"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/integrations/xero/authorizations/{flowId}": {
      "get": {
        "operationId": "getXeroAuthorizationStatus",
        "summary": "Current owner reads their flow outcome; expired or abandoned flows are finalized with audit",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "flowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid closed request, query or canonical key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked genuine session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current owner or private TEST grant denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or unavailable scoped resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Expired, terminal, conflicting or busy connection command",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "flow_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Default disabled, unconfigured or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed safe flow outcome, without OAuth secrets",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "flowId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "exchanging",
                        "connected",
                        "failed",
                        "needs_reconnect",
                        "superseded"
                      ]
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "failureCategory": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        null,
                        "provider_denied",
                        "provider_rejected",
                        "unknown_exchange",
                        "invalid_provider_response",
                        "demo_selection_required",
                        "no_eligible_demo",
                        "access_changed",
                        "not_configured",
                        "expired_flow",
                        "demo_already_connected"
                      ]
                    },
                    "connectionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  },
                  "required": [
                    "flowId",
                    "businessId",
                    "environment",
                    "status",
                    "expiresAt",
                    "failureCategory",
                    "connectionId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/xero/callback": {
      "get": {
        "operationId": "completeXeroDemoAuthorization",
        "summary": "Public fixed callback consumes once and verifies original owner/session and exactly one UK GBP demo",
        "security": [],
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 43
            }
          },
          {
            "name": "code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "name": "error",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "error_description",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 500
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Known flow returns only to configured fixed web origin with opaque flow UUID; no code, token or provider content in redirect",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Location": {
                "schema": {
                  "type": "string",
                  "maxLength": 512
                }
              }
            }
          },
          "400": {
            "description": "Malformed query, unavailable or revoked flow",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "flow_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Unknown opaque state",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "flow_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Default disabled, unconfigured or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/checkout": {
      "post": {
        "operationId": "createTestInvoiceCheckout",
        "summary": "Reserve once and create or replay an explicitly gated single-account TEST checkout",
        "description": "Current owner or finance_admin only; exact empty JSON object, one nonzero UUID Idempotency-Key and no query. Server amount, issued version/hash, account and return origins come from trusted source. An uncertain outcome retains the same key; replay never starts another provider request. Hosted URL is returned only after current authority and remaining balance are rechecked. No caller amount, environment, actor, account, metadata or return URL is accepted. Confirmed payment comes from independent verified readback, never this acknowledgement. Default disabled; hosted availability requires configuration, narrow grants and deployment.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Only {} accepted; bounded to 1024 bytes. Duplicate or unknown fields, nonobject bodies and query parameters are rejected.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current safe checkout acknowledgement; never payment confirmation",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "checkoutState": {
                      "type": "string",
                      "enum": [
                        "reserved",
                        "unknown",
                        "ready",
                        "failed",
                        "manual_reconciliation"
                      ]
                    },
                    "hostedUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 8192,
                      "pattern": "^https://checkout\\.stripe\\.com/c/pay/cs_test_[A-Za-z0-9]{1,240}([?#].*)?$"
                    },
                    "paymentState": {
                      "type": "string",
                      "const": "unconfirmed"
                    }
                  },
                  "required": [
                    "businessId",
                    "invoiceId",
                    "environment",
                    "checkoutState",
                    "hostedUrl",
                    "paymentState"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid closed body, command key, query or media type",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "empty_object_required",
                        "checkout_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or currently revoked genuine user session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized",
                        "checkout_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role or private TEST checkout grant denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "checkout_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Scoped issued invoice absent or inaccessible",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "checkout_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Existing checkout, changed key scope or captured amount/version/hash no longer current",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "checkout_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds 1024 bytes",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "body_limit"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Default disabled or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stripe_test_disabled",
                        "checkout_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/stripe/test-webhook": {
      "post": {
        "operationId": "ingestStripeTestWebhook",
        "summary": "Verify exact raw-byte signature and durably retain a bounded TEST event reference",
        "description": "Bearer authentication is not webhook authority. One Stripe-Signature header authenticates exact raw bytes within the verifier timestamp window and pinned TEST account. Only verified event/account/type/object references and payload hash are retained; event amounts never authorize allocation. Default-off HostedProcessorEnabled optionally awaits bounded processing of exactly that retained event with a separate restricted processor principal and independent account, Checkout and PaymentIntent reads. Default-off preserves ingress-only acknowledgement. Accepted is not a payment claim; unfinished processing returns503 for a retry of the same signed event.",
        "security": [],
        "parameters": [
          {
            "name": "Stripe-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 8192
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Exact raw application/json Stripe event; no query, maximum 256 KiB. The signature verifier accepts only bounded supported TEST event types and closed verified references. This published transport schema never establishes trusted monetary input.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified reference durably acknowledged; no payment status claimed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "accepted"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid media/header/query, raw signature or bounded TEST event",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_webhook"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Same verified event identifier has conflicting reference/hash",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "webhook_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "Raw body exceeds 256 KiB",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "body_limit"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Default disabled, bounded ingress/processor dependency unavailable, or exact-event processing pending; retry the original signed event.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stripe_test_disabled",
                        "webhook_unavailable",
                        "webhook_processing_pending"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/integrations/xero/mapping-candidates": {
      "get": {
        "operationId": "getXeroMappingCandidates",
        "summary": "Read independently verified UK demo account/tax choices; may serialize encrypted token refresh",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid bounded closed request/query or key/version header",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current provider session required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current owner or private accounting gate denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Scoped connection or resource absent",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Refresh/reconnect or command conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "token_refresh_busy",
                        "integration_needs_reconnect",
                        "conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Connection or current mapping version changed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "connection_changed",
                        "stale_version"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "422": {
            "description": "Selected account/tax is not eligible for this standard20 TEST slice",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "mapping_not_eligible"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Default disabled, unconfigured or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "provider_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed safe projection; no invoice or payment export effect",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "connectionId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "tenantId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "mappingVersion": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 999999999
                    },
                    "observedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "salesAccounts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "accountId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "code": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 10,
                            "pattern": "^[A-Za-z0-9._-]{1,10}$"
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 150
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "SALES",
                              "REVENUE",
                              "OTHERINCOME"
                            ]
                          }
                        },
                        "required": [
                          "accountId",
                          "code",
                          "name",
                          "type"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 1000
                    },
                    "paymentAccounts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "accountId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "code": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "maxLength": 10,
                            "pattern": "^[A-Za-z0-9._-]{1,10}$"
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 150
                          },
                          "type": {
                            "type": "string",
                            "const": "BANK"
                          },
                          "currency": {
                            "type": "string",
                            "const": "GBP"
                          },
                          "paymentEnabled": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "accountId",
                          "code",
                          "name",
                          "type",
                          "currency",
                          "paymentEnabled"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 1000
                    },
                    "taxRates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "taxType": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 50,
                            "pattern": "^[A-Z][A-Z0-9_]{0,49}$"
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 50
                          },
                          "effectiveRate": {
                            "type": "string",
                            "pattern": "^(?:0|[1-9][0-9]?|100)(?:\\.[0-9]{1,4})?$"
                          },
                          "canApplyToRevenue": {
                            "type": "boolean",
                            "const": true
                          }
                        },
                        "required": [
                          "taxType",
                          "name",
                          "effectiveRate",
                          "canApplyToRevenue"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 1000
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "connectionId",
                    "tenantId",
                    "mappingVersion",
                    "observedAt",
                    "salesAccounts",
                    "paymentAccounts",
                    "taxRates"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/integrations/xero/mapping": {
      "get": {
        "operationId": "getXeroMapping",
        "summary": "Read current connection-bound accounting mapping; no refresh or provider writes",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid bounded closed request/query or key/version header",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current provider session required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current owner or private accounting gate denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Scoped connection or resource absent",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Refresh/reconnect or command conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "token_refresh_busy",
                        "integration_needs_reconnect",
                        "conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Connection or current mapping version changed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "connection_changed",
                        "stale_version"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "422": {
            "description": "Selected account/tax is not eligible for this standard20 TEST slice",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "mapping_not_eligible"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Default disabled, unconfigured or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "provider_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed safe projection; no invoice or payment export effect",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 999999999
                        },
                        "configured": {
                          "type": "boolean",
                          "const": false
                        },
                        "mapping": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "connectionId",
                        "version",
                        "configured",
                        "mapping"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 999999999
                        },
                        "configured": {
                          "type": "boolean",
                          "const": true
                        },
                        "mapping": {
                          "type": "object",
                          "properties": {
                            "salesAccountId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "standardTaxType": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 50,
                              "pattern": "^[A-Z][A-Z0-9_]{0,49}$"
                            },
                            "paymentAccountId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "confirmedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "required": [
                            "salesAccountId",
                            "standardTaxType",
                            "paymentAccountId",
                            "confirmedAt"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "connectionId",
                        "version",
                        "configured",
                        "mapping"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "confirmXeroMapping",
        "summary": "Current owner explicitly confirms immutable sales/standard20/payment mapping after independent provider readback",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:0|[1-9][0-9]{0,8})\"$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid bounded closed request/query or key/version header",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current provider session required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current owner or private accounting gate denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Scoped connection or resource absent",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Refresh/reconnect or command conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "token_refresh_busy",
                        "integration_needs_reconnect",
                        "conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Connection or current mapping version changed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "connection_changed",
                        "stale_version"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "422": {
            "description": "Selected account/tax is not eligible for this standard20 TEST slice",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "mapping_not_eligible"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Default disabled, unconfigured or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "provider_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed safe projection; no invoice or payment export effect",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 999999999
                        },
                        "configured": {
                          "type": "boolean",
                          "const": true
                        },
                        "mapping": {
                          "type": "object",
                          "properties": {
                            "salesAccountId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "standardTaxType": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 50,
                              "pattern": "^[A-Z][A-Z0-9_]{0,49}$"
                            },
                            "paymentAccountId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "confirmedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "required": [
                            "salesAccountId",
                            "standardTaxType",
                            "paymentAccountId",
                            "confirmedAt"
                          ],
                          "additionalProperties": false
                        },
                        "created": {
                          "type": "boolean",
                          "const": true
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "connectionId",
                        "version",
                        "configured",
                        "mapping",
                        "created",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 999999999
                        },
                        "configured": {
                          "type": "boolean",
                          "const": true
                        },
                        "mapping": {
                          "type": "object",
                          "properties": {
                            "salesAccountId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "standardTaxType": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 50,
                              "pattern": "^[A-Z][A-Z0-9_]{0,49}$"
                            },
                            "paymentAccountId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "confirmedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "required": [
                            "salesAccountId",
                            "standardTaxType",
                            "paymentAccountId",
                            "confirmedAt"
                          ],
                          "additionalProperties": false
                        },
                        "created": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "connectionId",
                        "version",
                        "configured",
                        "mapping",
                        "created",
                        "replayed"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "201": {
            "description": "New immutable mapping confirmed; same historical key replay returns200",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 999999999
                        },
                        "configured": {
                          "type": "boolean",
                          "const": true
                        },
                        "mapping": {
                          "type": "object",
                          "properties": {
                            "salesAccountId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "standardTaxType": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 50,
                              "pattern": "^[A-Z][A-Z0-9_]{0,49}$"
                            },
                            "paymentAccountId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "confirmedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "required": [
                            "salesAccountId",
                            "standardTaxType",
                            "paymentAccountId",
                            "confirmedAt"
                          ],
                          "additionalProperties": false
                        },
                        "created": {
                          "type": "boolean",
                          "const": true
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "connectionId",
                        "version",
                        "configured",
                        "mapping",
                        "created",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 999999999
                        },
                        "configured": {
                          "type": "boolean",
                          "const": true
                        },
                        "mapping": {
                          "type": "object",
                          "properties": {
                            "salesAccountId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "standardTaxType": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 50,
                              "pattern": "^[A-Z][A-Z0-9_]{0,49}$"
                            },
                            "paymentAccountId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "confirmedAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "required": [
                            "salesAccountId",
                            "standardTaxType",
                            "paymentAccountId",
                            "confirmedAt"
                          ],
                          "additionalProperties": false
                        },
                        "created": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "connectionId",
                        "version",
                        "configured",
                        "mapping",
                        "created",
                        "replayed"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "connectionId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "salesAccountId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "standardTaxType": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50,
                    "pattern": "^[A-Z][A-Z0-9_]{0,49}$"
                  },
                  "paymentAccountId": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "connectionId",
                  "salesAccountId",
                  "standardTaxType",
                  "paymentAccountId"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/accounting/xero/export": {
      "get": {
        "operationId": "readXeroInvoiceExport",
        "summary": "Read current UK demo invoice transfer status",
        "description": "Current signed owner access is rechecked. Default-disabled TEST capability requires an expiring private grant pinned to the current connection, UK GBP demo, immutable mapping and accounting-grant revision. GET never starts provider writes.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "businessId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "invoiceId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current closed accounting status. GET performs no provider financial effect.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "not_started",
                        "prepared",
                        "exporting",
                        "unknown",
                        "needs_review",
                        "verified"
                      ]
                    },
                    "issuedVersion": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 2
                    },
                    "mappingVersion": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    },
                    "contactId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "externalInvoiceId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "verifiedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "accountingSyncState": {
                      "type": "string",
                      "enum": [
                        "not_started",
                        "in_progress",
                        "needs_review",
                        "synced"
                      ]
                    },
                    "confirmedPaidAmount": {
                      "type": "string",
                      "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                    },
                    "outstandingAmount": {
                      "type": "string",
                      "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                    },
                    "confirmedPaymentCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "mappedPaymentCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "staleContext": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "invoiceId",
                    "environment",
                    "state",
                    "issuedVersion",
                    "mappingVersion",
                    "contactId",
                    "externalInvoiceId",
                    "verifiedAt",
                    "accountingSyncState",
                    "confirmedPaidAmount",
                    "outstandingAmount",
                    "confirmedPaymentCount",
                    "mappedPaymentCount",
                    "staleContext"
                  ],
                  "additionalProperties": false,
                  "description": "Verified/synced requires independent current invoice and payment readback and the exact current confirmed allocation set. Connection health, mapping save and write acknowledgment are separate."
                },
                "example": {
                  "businessId": "00000000-0000-4000-8000-000000000010",
                  "invoiceId": "00000000-0000-4000-8000-000000000020",
                  "environment": "test",
                  "state": "not_started",
                  "issuedVersion": 2,
                  "mappingVersion": null,
                  "contactId": null,
                  "externalInvoiceId": null,
                  "verifiedAt": null,
                  "accountingSyncState": "not_started",
                  "confirmedPaidAmount": "120.00",
                  "outstandingAmount": "0.00",
                  "confirmedPaymentCount": 1,
                  "mappedPaymentCount": 0,
                  "staleContext": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current provider session required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "conflict",
                        "integration_needs_reconnect",
                        "provider_evidence_requires_review"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stale_context",
                        "connection_changed"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "exportIssuedInvoiceToXero",
        "summary": "Transfer issued invoice and confirmed payments to UK demo",
        "description": "Send exactly {}, the original nonzero UUID Idempotency-Key and quoted issued version. Finite ordered contact, invoice and confirmed-payment effects use frozen requests and independent provider readback. Preserve the original key after timeout/202. Recovery never blindly issues another financial write. The same current allocation set must be independently accepted before synced. No live funds, refunds, credit notes, delivery or production accounting acceptance is implied.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "businessId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "invoiceId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Original nonzero UUID, persisted before sending and retained after an uncertain result."
          },
          {
            "in": "header",
            "name": "Tallylane-If-Version",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[2-9]|[1-9][0-9]{1,8})\"$"
            },
            "description": "Quoted immutable issued version, for example \"2\". If-Match and query parameters are rejected."
          }
        ],
        "responses": {
          "200": {
            "description": "Current closed accounting status. GET performs no provider financial effect.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "not_started",
                        "prepared",
                        "exporting",
                        "unknown",
                        "needs_review",
                        "verified"
                      ]
                    },
                    "issuedVersion": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 2
                    },
                    "mappingVersion": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    },
                    "contactId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "externalInvoiceId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "verifiedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "accountingSyncState": {
                      "type": "string",
                      "enum": [
                        "not_started",
                        "in_progress",
                        "needs_review",
                        "synced"
                      ]
                    },
                    "confirmedPaidAmount": {
                      "type": "string",
                      "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                    },
                    "outstandingAmount": {
                      "type": "string",
                      "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                    },
                    "confirmedPaymentCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "mappedPaymentCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "staleContext": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "invoiceId",
                    "environment",
                    "state",
                    "issuedVersion",
                    "mappingVersion",
                    "contactId",
                    "externalInvoiceId",
                    "verifiedAt",
                    "accountingSyncState",
                    "confirmedPaidAmount",
                    "outstandingAmount",
                    "confirmedPaymentCount",
                    "mappedPaymentCount",
                    "staleContext"
                  ],
                  "additionalProperties": false,
                  "description": "Verified/synced requires independent current invoice and payment readback and the exact current confirmed allocation set. Connection health, mapping save and write acknowledgment are separate."
                },
                "example": {
                  "businessId": "00000000-0000-4000-8000-000000000010",
                  "invoiceId": "00000000-0000-4000-8000-000000000020",
                  "environment": "test",
                  "state": "not_started",
                  "issuedVersion": 2,
                  "mappingVersion": null,
                  "contactId": null,
                  "externalInvoiceId": null,
                  "verifiedAt": null,
                  "accountingSyncState": "not_started",
                  "confirmedPaidAmount": "120.00",
                  "outstandingAmount": "0.00",
                  "confirmedPaymentCount": 1,
                  "mappedPaymentCount": 0,
                  "staleContext": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current provider session required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "not_started",
                            "prepared",
                            "exporting",
                            "unknown",
                            "needs_review",
                            "verified"
                          ]
                        },
                        "issuedVersion": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 2
                        },
                        "mappingVersion": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1
                        },
                        "contactId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "externalInvoiceId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "verifiedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "accountingSyncState": {
                          "type": "string",
                          "enum": [
                            "not_started",
                            "in_progress",
                            "needs_review",
                            "synced"
                          ]
                        },
                        "confirmedPaidAmount": {
                          "type": "string",
                          "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                        },
                        "outstandingAmount": {
                          "type": "string",
                          "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                        },
                        "confirmedPaymentCount": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "mappedPaymentCount": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "staleContext": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "businessId",
                        "invoiceId",
                        "environment",
                        "state",
                        "issuedVersion",
                        "mappingVersion",
                        "contactId",
                        "externalInvoiceId",
                        "verifiedAt",
                        "accountingSyncState",
                        "confirmedPaidAmount",
                        "outstandingAmount",
                        "confirmedPaymentCount",
                        "mappedPaymentCount",
                        "staleContext"
                      ],
                      "additionalProperties": false,
                      "description": "Verified/synced requires independent current invoice and payment readback and the exact current confirmed allocation set. Connection health, mapping save and write acknowledgment are separate."
                    },
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "enum": [
                            "conflict",
                            "integration_needs_reconnect",
                            "provider_evidence_requires_review"
                          ]
                        }
                      },
                      "required": [
                        "error"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "412": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stale_context",
                        "connection_changed"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed access, context, provider-review or availability failure; no provider secrets or raw errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "202": {
            "description": "Busy or uncertain durable transfer; keep the original request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "not_started",
                        "prepared",
                        "exporting",
                        "unknown",
                        "needs_review",
                        "verified"
                      ]
                    },
                    "issuedVersion": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 2
                    },
                    "mappingVersion": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    },
                    "contactId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "externalInvoiceId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "verifiedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "accountingSyncState": {
                      "type": "string",
                      "enum": [
                        "not_started",
                        "in_progress",
                        "needs_review",
                        "synced"
                      ]
                    },
                    "confirmedPaidAmount": {
                      "type": "string",
                      "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                    },
                    "outstandingAmount": {
                      "type": "string",
                      "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                    },
                    "confirmedPaymentCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "mappedPaymentCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "staleContext": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "invoiceId",
                    "environment",
                    "state",
                    "issuedVersion",
                    "mappingVersion",
                    "contactId",
                    "externalInvoiceId",
                    "verifiedAt",
                    "accountingSyncState",
                    "confirmedPaidAmount",
                    "outstandingAmount",
                    "confirmedPaymentCount",
                    "mappedPaymentCount",
                    "staleContext"
                  ],
                  "additionalProperties": false,
                  "description": "Verified/synced requires independent current invoice and payment readback and the exact current confirmed allocation set. Connection health, mapping save and write acknowledgment are separate."
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              },
              "example": {}
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/pdf": {
      "get": {
        "operationId": "readIssuedInvoicePdf",
        "summary": "Download the immutable TEST invoice PDF",
        "description": "Current bearer session, active identity, business membership and existing invoice read role are rechecked. No query, body or range accepted; no redirects or external assets during rendering. TEST marker on every page. Regenerated on demand, not a durable document or email-delivery job. Seller/buyer and amounts remain frozen.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "On-demand TEST PDF generated only from the immutable issued snapshot; at most5MiB. No document job, delivery, payment or external-provider mutation.",
            "headers": {
              "Tallylane-Version": {
                "description": "Quoted immutable issued version, at least2.",
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                }
              },
              "Tallylane-Snapshot-Hash": {
                "description": "Immutable issued snapshot SHA256.",
                "schema": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                }
              },
              "Content-Disposition": {
                "description": "Attachment; server-controlled UUID filename.",
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Current session missing or revoked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Identity, role or TEST environment denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Invoice unavailable in this active membership, or not issued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Snapshot or rendering dependency unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/payment-checks": {
      "post": {
        "operationId": "checkTestInvoicePayment",
        "summary": "Deliberately verify the original invoice TEST payment",
        "description": "Current owner/finance_admin, a current finite invoice-business checkout grant and restricted processor permission are required. Exact empty JSON and retained UUID with quoted issued version; no query, If-Match, caller money or provider IDs. Claims only a matching already-signed event, respects committed leases/backoff, and independently reads original TEST Checkout/PaymentIntent before one atomic allocation. Fresh current authorization and grant/role fingerprints plus audit epochs are rechecked after HTTP. GET refresh does not process money. Unknown/processing keeps the original UUID and requires deliberate read recovery; no automatic POST retry. Default off and separate hosted provider acceptance required.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "businessId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "invoiceId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Original nonzero UUID, persisted before sending and retained after an uncertain result."
          },
          {
            "in": "header",
            "name": "Tallylane-If-Version",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[2-9]|[1-9][0-9]{1,9})\"$",
              "maxLength": 12
            },
            "description": "Quoted immutable issued integer version from 2 through 2147483647, for example \"2\". Numeric upper bound is validated by the server. If-Match and query parameters are rejected."
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Only {} accepted; bounded to 1024 bytes. Duplicate or unknown fields, nonobject bodies and query parameters are rejected.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Closed current TEST check result; paid requires the actual confirmed allocation aggregate with zero outstanding.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"(?:[2-9]|[1-9][0-9]{1,9})\"$",
                  "maxLength": 12
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "checkId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "paid",
                        "awaiting_webhook",
                        "processing",
                        "unconfirmed",
                        "needs_review"
                      ]
                    },
                    "confirmedPaid": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "type": "string",
                          "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                        },
                        "currency": {
                          "type": "string",
                          "const": "GBP"
                        }
                      },
                      "required": [
                        "amount",
                        "currency"
                      ],
                      "additionalProperties": false
                    },
                    "outstanding": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "type": "string",
                          "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                        },
                        "currency": {
                          "type": "string",
                          "const": "GBP"
                        }
                      },
                      "required": [
                        "amount",
                        "currency"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "businessId",
                    "invoiceId",
                    "environment",
                    "checkId",
                    "state",
                    "confirmedPaid",
                    "outstanding"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid closed request",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key",
                        "empty_object_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current session required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current private TEST authority denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Scoped issued invoice missing",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Original check context, checkout or lease conflicts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "payment_check_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Immutable issued version conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "413": {
            "description": "Request exceeds 1024 bytes",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "body_limit"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Quoted issued version of at least 2 required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed configuration or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stripe_payment_check_disabled",
                        "payment_check_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/delivery": {
      "get": {
        "operationId": "readTestInvoiceDelivery",
        "summary": "Read current TEST link and email preparation state",
        "description": "Default-off controlled TEST delivery; current genuine owner/finance_admin, immutable issued invoice and finite private business grant required. Preparation is not queued or sent. No email/provider payment/accounting mutation. Keep original command after unknown response; no automatic POST retry.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "businessId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "invoiceId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed TEST result with no provider send or financial mutation.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "canCreateLink": {
                      "type": "boolean"
                    },
                    "canPrepareEmail": {
                      "type": "boolean"
                    },
                    "activeLink": {
                      "oneOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "linkId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          },
                          "required": [
                            "linkId",
                            "expiresAt"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "email": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "not_prepared",
                            "prepared"
                          ]
                        },
                        "recipient": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "preparedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "providerState": {
                          "type": "string",
                          "enum": [
                            "not_configured",
                            "sandbox_ready",
                            "sandbox_accepted",
                            "submission_unknown",
                            "submission_failed"
                          ]
                        },
                        "preparationId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "canSubmit": {
                          "type": "boolean"
                        },
                        "includesPaymentLink": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "state",
                        "recipient",
                        "preparedAt",
                        "providerState",
                        "preparationId",
                        "canSubmit",
                        "includesPaymentLink"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "environment",
                    "canCreateLink",
                    "canPrepareEmail",
                    "activeLink",
                    "email"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed request invalid",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key",
                        "invalid_recipient"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current session required",
            "headers": {
              "Cache-Control": {
                "description": "Bearer middleware challenges use no-store; early service rejection may include private.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current scoped authority denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Scoped issued invoice or link unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Original command context conflicts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "delivery_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed configuration or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_delivery_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/delivery-links": {
      "post": {
        "operationId": "createTestInvoiceDeliveryLink",
        "summary": "Create or recover an expiring TEST payer capability",
        "description": "Default-off controlled TEST delivery; current genuine owner/finance_admin, immutable issued invoice and finite private business grant required. Preparation is not queued or sent. No email/provider payment/accounting mutation. Keep original command after unknown response; no automatic POST retry.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "businessId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "invoiceId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "Tallylane-If-Version",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[2-9]|[1-9][0-9]{1,9})\"$",
              "maxLength": 12
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed TEST result with no provider send or financial mutation.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"(?:[2-9]|[1-9][0-9]{1,9})\"$",
                  "maxLength": 12
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "linkId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "token": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{43}$",
                      "minLength": 43,
                      "maxLength": 43
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "issuedVersion": {
                      "type": "integer",
                      "minimum": 2,
                      "maximum": 2147483647
                    },
                    "snapshotHash": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    }
                  },
                  "required": [
                    "linkId",
                    "token",
                    "expiresAt",
                    "issuedVersion",
                    "snapshotHash"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed request invalid",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key",
                        "invalid_recipient"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current session required",
            "headers": {
              "Cache-Control": {
                "description": "Bearer middleware challenges use no-store; early service rejection may include private.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current scoped authority denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Scoped issued invoice or link unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Original command context conflicts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "delivery_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed configuration or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_delivery_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Immutable issued version conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Quoted issued version required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Only the stated closed JSON body. No query, If-Match, duplicate/unknown fields or caller financial/provider authority. JSON is at most 1024 bytes; oversize or invalid JSON returns 400.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/delivery-links/{linkId}/revoke": {
      "post": {
        "operationId": "revokeTestInvoiceDeliveryLink",
        "summary": "Revoke the matching scoped TEST payer capability",
        "description": "Default-off controlled TEST delivery; current genuine owner/finance_admin, immutable issued invoice and finite private business grant required. Preparation is not queued or sent. No email/provider payment/accounting mutation. Keep original command after unknown response; no automatic POST retry.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "businessId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "invoiceId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "linkId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "Tallylane-If-Version",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[2-9]|[1-9][0-9]{1,9})\"$",
              "maxLength": 12
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed TEST result with no provider send or financial mutation.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"(?:[2-9]|[1-9][0-9]{1,9})\"$",
                  "maxLength": 12
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "linkId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "state": {
                      "type": "string",
                      "const": "revoked"
                    }
                  },
                  "required": [
                    "linkId",
                    "state"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed request invalid",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key",
                        "invalid_recipient"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current session required",
            "headers": {
              "Cache-Control": {
                "description": "Bearer middleware challenges use no-store; early service rejection may include private.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current scoped authority denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Scoped issued invoice or link unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Original command context conflicts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "delivery_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed configuration or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_delivery_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Immutable issued version conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Quoted issued version required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Only the stated closed JSON body. No query, If-Match, duplicate/unknown fields or caller financial/provider authority. JSON is at most 1024 bytes; oversize or invalid JSON returns 400.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/delivery-preparations": {
      "post": {
        "operationId": "prepareTestInvoiceDelivery",
        "summary": "Prepare reviewed TEST invoice email without sending",
        "description": "Default-off controlled TEST delivery; current genuine owner/finance_admin, immutable issued invoice and finite private business grant required. Preparation is not queued or sent. No email/provider payment/accounting mutation. Keep original command after unknown response; no automatic POST retry. New preparations require a current active owner-created payer link with the same frozen invoice/grant. They pin its link ID and share-URL hash without persisting the raw URL/token. includesPaymentLink explicitly distinguishes historical PDF-only preparations.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "businessId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "invoiceId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "Tallylane-If-Version",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[2-9]|[1-9][0-9]{1,9})\"$",
              "maxLength": 12
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed TEST result with no provider send or financial mutation.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"(?:[2-9]|[1-9][0-9]{1,9})\"$",
                  "maxLength": 12
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "type": "string",
                      "const": "prepared"
                    },
                    "recipient": {
                      "type": "string",
                      "format": "email",
                      "maxLength": 254
                    },
                    "preparedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "providerState": {
                      "type": "string",
                      "const": "not_configured"
                    },
                    "issuedVersion": {
                      "type": "integer",
                      "minimum": 2,
                      "maximum": 2147483647
                    },
                    "snapshotHash": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "preparationId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "includesPaymentLink": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "state",
                    "recipient",
                    "preparedAt",
                    "providerState",
                    "issuedVersion",
                    "snapshotHash",
                    "preparationId",
                    "includesPaymentLink"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed request invalid",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key",
                        "invalid_recipient"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current session required",
            "headers": {
              "Cache-Control": {
                "description": "Bearer middleware challenges use no-store; early service rejection may include private.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current scoped authority denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Scoped issued invoice or link unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Original command context conflicts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "delivery_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed configuration or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_delivery_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Immutable issued version conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Quoted issued version required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Only the stated closed JSON body. No query, If-Match, duplicate/unknown fields or caller financial/provider authority. JSON is at most 1024 bytes; oversize or invalid JSON returns 400.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipient": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  }
                },
                "required": [
                  "recipient"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/payer-links/{linkId}": {
      "get": {
        "operationId": "readTestPayerInvoice",
        "summary": "Read the narrowly scoped immutable TEST invoice",
        "description": "Read-only capability path using separate restricted public-reader login. No body/query; no payment/checkout/Stripe/Xero processing. Current token, expiry/revocation, owner/business/private grant and immutable context are checked on every read. Invalid/expired/revoked capabilities uniformly return 404. A vetted original ready owner-created TEST checkout is shared only while exact current balance/context permit. No provider delivery acceptance is implied.",
        "security": [
          {
            "InvoicePayerCapability": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "linkId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "X-Tallylane-Payer-Token",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43}$",
              "minLength": 43,
              "maxLength": 43
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed TEST result with no provider send or financial mutation.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "number": {
                      "type": "string",
                      "pattern": "^TST-[0-9]{6,}$"
                    },
                    "issuedDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "dueDate": {
                      "type": "string",
                      "format": "date"
                    },
                    "sellerName": {
                      "type": "string"
                    },
                    "buyerName": {
                      "type": "string"
                    },
                    "lines": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "description": {
                            "type": "string"
                          },
                          "quantity": {
                            "type": "string",
                            "pattern": "^(?:0|[1-9][0-9]*)\\.[0-9]{4}$"
                          },
                          "unitNet": {
                            "type": "string",
                            "pattern": "^(?:0|[1-9][0-9]*)\\.[0-9]{4}$"
                          },
                          "net": {
                            "type": "string",
                            "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                          },
                          "vat": {
                            "type": "string",
                            "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                          },
                          "gross": {
                            "type": "string",
                            "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                          }
                        },
                        "required": [
                          "description",
                          "quantity",
                          "unitNet",
                          "net",
                          "vat",
                          "gross"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "net": {
                          "type": "string",
                          "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                        },
                        "vat": {
                          "type": "string",
                          "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                        },
                        "gross": {
                          "type": "string",
                          "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                        }
                      },
                      "required": [
                        "net",
                        "vat",
                        "gross"
                      ],
                      "additionalProperties": false
                    },
                    "payment": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "unpaid",
                            "partially_paid",
                            "paid"
                          ]
                        },
                        "confirmed": {
                          "type": "string",
                          "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                        },
                        "outstanding": {
                          "type": "string",
                          "pattern": "^(?:0|[1-9][0-9]{0,9})\\.[0-9]{2}$"
                        }
                      },
                      "required": [
                        "state",
                        "confirmed",
                        "outstanding"
                      ],
                      "additionalProperties": false
                    },
                    "checkoutUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^https://checkout\\.stripe\\.com/c/pay/cs_test_[A-Za-z0-9]+(?:[?#].*)?$"
                    }
                  },
                  "required": [
                    "environment",
                    "number",
                    "issuedDate",
                    "dueDate",
                    "sellerName",
                    "buyerName",
                    "lines",
                    "totals",
                    "payment",
                    "checkoutUrl"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Uniform invalid, absent, expired or revoked capability",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Sanitized closed configuration or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_delivery_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/payer-links/{linkId}/pdf": {
      "get": {
        "operationId": "readTestPayerInvoicePdf",
        "summary": "Read the narrowly scoped immutable TEST invoice PDF",
        "description": "Read-only capability path using separate restricted public-reader login. No body/query; no payment/checkout/Stripe/Xero processing. Current token, expiry/revocation, owner/business/private grant and immutable context are checked on every read. Invalid/expired/revoked capabilities uniformly return 404. A vetted original ready owner-created TEST checkout is shared only while exact current balance/context permit. No provider delivery acceptance is implied. Range requests are rejected; transient TEST PDF max5MiB.",
        "security": [
          {
            "InvoicePayerCapability": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "linkId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "X-Tallylane-Payer-Token",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43}$",
              "minLength": 43,
              "maxLength": 43
            }
          }
        ],
        "responses": {
          "200": {
            "description": "On-demand TEST PDF generated only from the immutable issued snapshot; at most5MiB. No document job, delivery, payment or external-provider mutation.",
            "headers": {
              "Tallylane-Version": {
                "description": "Quoted immutable issued version, at least2.",
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                }
              },
              "Tallylane-Snapshot-Hash": {
                "description": "Immutable issued snapshot SHA256.",
                "schema": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                }
              },
              "Content-Disposition": {
                "description": "Attachment; safe frozen TEST invoice-number filename.",
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "description": "Uniform invalid, absent, expired or revoked capability",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Sanitized closed configuration or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_delivery_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/delivery-preparations/{preparationId}/submissions": {
      "post": {
        "operationId": "submitTestInvoicePreparationToSandbox",
        "summary": "Deliberately submit the original prepared TEST PDF to pinned Postmark Sandbox",
        "description": "Default-off deliberate TEST submission with current owner/finance_admin, exact issued version, current private business grant, finite restricted processor role and pinned Sandbox server/sender. Original immutable PDF and reviewed recipient are rechecked after durable single-attempt reservation. No retry of unknown or failed outcome, no background resend and no real recipient delivery claim. Provider IDs/errors/secrets remain private. GET refresh is read-only; original same-key request recovers durable state without another provider POST. The original pinned payer URL is regenerated from durable context and hash-checked after current link/grant expiry/revocation checks; caller URLs cannot replace it. Historical PDF-only preparations remain explicitly includesPaymentLink false, without silently attaching a new link.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "businessId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "invoiceId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "preparationId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "header",
            "name": "Tallylane-If-Version",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[2-9]|[1-9][0-9]{1,9})\"$",
              "maxLength": 12
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Closed retained Sandbox submission outcome; no real recipient delivery, payment or accounting acceptance.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"(?:[2-9]|[1-9][0-9]{1,9})\"$",
                  "maxLength": 12
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "preparationId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "submissionState": {
                      "type": "string",
                      "enum": [
                        "sandbox_accepted",
                        "unknown",
                        "failed",
                        "processing"
                      ]
                    }
                  },
                  "required": [
                    "preparationId",
                    "submissionState"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed request invalid",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key",
                        "invalid_recipient"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current session required",
            "headers": {
              "Cache-Control": {
                "description": "Bearer middleware challenges use no-store; early service rejection may include private.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current scoped authority denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Scoped issued invoice or link unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Original command context conflicts",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "delivery_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed configuration or bounded dependency unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_delivery_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Immutable issued version conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Quoted issued version required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Only the stated closed JSON body. No query, If-Match, duplicate/unknown fields or caller financial/provider authority. JSON is at most 1024 bytes; oversize or invalid JSON returns 400.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/agent-runs": {
      "get": {
        "operationId": "listCollectionsRuns",
        "summary": "Read recent persisted TEST Collections runs",
        "description": "Controlled TEST L1 preparation only. No reminder send, approval, payment/allocation, accounting, model tools or financial executor. Runtime/worker/provider gates and finite business grant remain separate; local fixture evidence does not prove genuine model or hosted acceptance.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current permitted projection; needs_review means draft prepared only.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "enum": [
                        "test"
                      ]
                    },
                    "paused": {
                      "type": "boolean"
                    },
                    "canStart": {
                      "type": "boolean"
                    },
                    "runs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "runId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "agent": {
                            "type": "string",
                            "enum": [
                              "collections"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "queued",
                              "preparing",
                              "needs_review",
                              "blocked",
                              "cancelled",
                              "failed"
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "blockedReason": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              null,
                              "runtime_paused",
                              "actor_access_changed",
                              "no_overdue_invoices",
                              "source_changed",
                              "gateway_unavailable",
                              "gateway_invalid",
                              "gateway_failed",
                              "lease_expired",
                              "runtime_grant_changed"
                            ]
                          },
                          "proposalCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 20
                          }
                        },
                        "required": [
                          "runId",
                          "agent",
                          "state",
                          "createdAt",
                          "updatedAt",
                          "blockedReason",
                          "proposalCount"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 50
                    },
                    "nextCursor": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "paused",
                    "canStart",
                    "runs",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_runtime_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "startCollectionsRun",
        "summary": "Queue one durable TEST Collections preparation",
        "description": "Controlled TEST L1 preparation only. No reminder send, approval, payment/allocation, accounting, model tools or financial executor. Runtime/worker/provider gates and finite business grant remain separate; local fixture evidence does not prove genuine model or hosted acceptance.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current permitted projection; needs_review means draft prepared only.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "agent": {
                      "type": "string",
                      "enum": [
                        "collections"
                      ]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "preparing",
                        "needs_review",
                        "blocked",
                        "cancelled",
                        "failed"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "blockedReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        null,
                        "runtime_paused",
                        "actor_access_changed",
                        "no_overdue_invoices",
                        "source_changed",
                        "gateway_unavailable",
                        "gateway_invalid",
                        "gateway_failed",
                        "lease_expired",
                        "runtime_grant_changed"
                      ]
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "enum": [
                        "test"
                      ]
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "number": {
                            "type": "string",
                            "pattern": "^TST-[0-9]{6,}$"
                          },
                          "issuedVersion": {
                            "type": "integer",
                            "minimum": 2
                          },
                          "snapshotHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "customerId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "customerVersion": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "customerName": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          },
                          "recipient": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 254
                          },
                          "dueDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "asOfDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "gross": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "confirmed": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "outstanding": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "enum": [
                              "GBP"
                            ]
                          },
                          "sourceHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "deliveryPreference": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "email"
                            ]
                          },
                          "allocationHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "number",
                          "issuedVersion",
                          "snapshotHash",
                          "customerId",
                          "customerVersion",
                          "customerName",
                          "recipient",
                          "dueDate",
                          "asOfDate",
                          "gross",
                          "confirmed",
                          "outstanding",
                          "currency",
                          "sourceHash",
                          "deliveryPreference",
                          "allocationHash"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    },
                    "proposals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "subject": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "body": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1500
                          },
                          "sourceHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "subject",
                          "body",
                          "sourceHash"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    },
                    "canCancel": {
                      "type": "boolean"
                    },
                    "canPause": {
                      "type": "boolean"
                    },
                    "gateway": {
                      "oneOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "provider": {
                              "type": "string",
                              "enum": [
                                "anthropic",
                                "test_fixture"
                              ]
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "promptVersion": {
                              "type": "string",
                              "enum": [
                                "COLLECTIONS_L1_V1"
                              ]
                            }
                          },
                          "required": [
                            "provider",
                            "model",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "runId",
                    "agent",
                    "state",
                    "createdAt",
                    "updatedAt",
                    "blockedReason",
                    "businessId",
                    "environment",
                    "evidence",
                    "proposals",
                    "canCancel",
                    "canPause",
                    "gateway"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_runtime_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "202": {
            "description": "New queued durable run; no model/executor completion implied.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "agent": {
                      "type": "string",
                      "enum": [
                        "collections"
                      ]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "preparing",
                        "needs_review",
                        "blocked",
                        "cancelled",
                        "failed"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "blockedReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        null,
                        "runtime_paused",
                        "actor_access_changed",
                        "no_overdue_invoices",
                        "source_changed",
                        "gateway_unavailable",
                        "gateway_invalid",
                        "gateway_failed",
                        "lease_expired",
                        "runtime_grant_changed"
                      ]
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "enum": [
                        "test"
                      ]
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "number": {
                            "type": "string",
                            "pattern": "^TST-[0-9]{6,}$"
                          },
                          "issuedVersion": {
                            "type": "integer",
                            "minimum": 2
                          },
                          "snapshotHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "customerId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "customerVersion": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "customerName": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          },
                          "recipient": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 254
                          },
                          "dueDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "asOfDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "gross": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "confirmed": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "outstanding": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "enum": [
                              "GBP"
                            ]
                          },
                          "sourceHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "deliveryPreference": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "email"
                            ]
                          },
                          "allocationHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "number",
                          "issuedVersion",
                          "snapshotHash",
                          "customerId",
                          "customerVersion",
                          "customerName",
                          "recipient",
                          "dueDate",
                          "asOfDate",
                          "gross",
                          "confirmed",
                          "outstanding",
                          "currency",
                          "sourceHash",
                          "deliveryPreference",
                          "allocationHash"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    },
                    "proposals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "subject": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "body": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1500
                          },
                          "sourceHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "subject",
                          "body",
                          "sourceHash"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    },
                    "canCancel": {
                      "type": "boolean"
                    },
                    "canPause": {
                      "type": "boolean"
                    },
                    "gateway": {
                      "oneOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "provider": {
                              "type": "string",
                              "enum": [
                                "anthropic",
                                "test_fixture"
                              ]
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "promptVersion": {
                              "type": "string",
                              "enum": [
                                "COLLECTIONS_L1_V1"
                              ]
                            }
                          },
                          "required": [
                            "provider",
                            "model",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "runId",
                    "agent",
                    "state",
                    "createdAt",
                    "updatedAt",
                    "blockedReason",
                    "businessId",
                    "environment",
                    "evidence",
                    "proposals",
                    "canCancel",
                    "canPause",
                    "gateway"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agent": {
                    "type": "string",
                    "enum": [
                      "collections"
                    ]
                  }
                },
                "required": [
                  "agent"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/agent-runs/{runId}": {
      "get": {
        "operationId": "readCollectionsRun",
        "summary": "Read current run and bound invoice evidence/drafts",
        "description": "Controlled TEST L1 preparation only. No reminder send, approval, payment/allocation, accounting, model tools or financial executor. Runtime/worker/provider gates and finite business grant remain separate; local fixture evidence does not prove genuine model or hosted acceptance.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current permitted projection; needs_review means draft prepared only.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "agent": {
                      "type": "string",
                      "enum": [
                        "collections"
                      ]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "preparing",
                        "needs_review",
                        "blocked",
                        "cancelled",
                        "failed"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "blockedReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        null,
                        "runtime_paused",
                        "actor_access_changed",
                        "no_overdue_invoices",
                        "source_changed",
                        "gateway_unavailable",
                        "gateway_invalid",
                        "gateway_failed",
                        "lease_expired",
                        "runtime_grant_changed"
                      ]
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "enum": [
                        "test"
                      ]
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "number": {
                            "type": "string",
                            "pattern": "^TST-[0-9]{6,}$"
                          },
                          "issuedVersion": {
                            "type": "integer",
                            "minimum": 2
                          },
                          "snapshotHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "customerId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "customerVersion": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "customerName": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          },
                          "recipient": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 254
                          },
                          "dueDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "asOfDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "gross": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "confirmed": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "outstanding": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "enum": [
                              "GBP"
                            ]
                          },
                          "sourceHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "deliveryPreference": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "email"
                            ]
                          },
                          "allocationHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "number",
                          "issuedVersion",
                          "snapshotHash",
                          "customerId",
                          "customerVersion",
                          "customerName",
                          "recipient",
                          "dueDate",
                          "asOfDate",
                          "gross",
                          "confirmed",
                          "outstanding",
                          "currency",
                          "sourceHash",
                          "deliveryPreference",
                          "allocationHash"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    },
                    "proposals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "subject": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "body": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1500
                          },
                          "sourceHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "subject",
                          "body",
                          "sourceHash"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    },
                    "canCancel": {
                      "type": "boolean"
                    },
                    "canPause": {
                      "type": "boolean"
                    },
                    "gateway": {
                      "oneOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "provider": {
                              "type": "string",
                              "enum": [
                                "anthropic",
                                "test_fixture"
                              ]
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "promptVersion": {
                              "type": "string",
                              "enum": [
                                "COLLECTIONS_L1_V1"
                              ]
                            }
                          },
                          "required": [
                            "provider",
                            "model",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "runId",
                    "agent",
                    "state",
                    "createdAt",
                    "updatedAt",
                    "blockedReason",
                    "businessId",
                    "environment",
                    "evidence",
                    "proposals",
                    "canCancel",
                    "canPause",
                    "gateway"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_runtime_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/agent-runs/{runId}/actions": {
      "get": {
        "operationId": "readCollectionsRunActions",
        "summary": "Read empty action list; no executor exists",
        "description": "Controlled TEST L1 preparation only. No reminder send, approval, payment/allocation, accounting, model tools or financial executor. Runtime/worker/provider gates and finite business grant remain separate; local fixture evidence does not prove genuine model or hosted acceptance.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current permitted projection; needs_review means draft prepared only.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "actions": {
                      "type": "array",
                      "items": {},
                      "maxItems": 0
                    }
                  },
                  "required": [
                    "runId",
                    "actions"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_runtime_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/agent-runs/{runId}/cancel": {
      "post": {
        "operationId": "cancelCollectionsRun",
        "summary": "Cancel a current permitted preparation",
        "description": "Controlled TEST L1 preparation only. No reminder send, approval, payment/allocation, accounting, model tools or financial executor. Runtime/worker/provider gates and finite business grant remain separate; local fixture evidence does not prove genuine model or hosted acceptance.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current permitted projection; needs_review means draft prepared only.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "agent": {
                      "type": "string",
                      "enum": [
                        "collections"
                      ]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "preparing",
                        "needs_review",
                        "blocked",
                        "cancelled",
                        "failed"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "blockedReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        null,
                        "runtime_paused",
                        "actor_access_changed",
                        "no_overdue_invoices",
                        "source_changed",
                        "gateway_unavailable",
                        "gateway_invalid",
                        "gateway_failed",
                        "lease_expired",
                        "runtime_grant_changed"
                      ]
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "enum": [
                        "test"
                      ]
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "number": {
                            "type": "string",
                            "pattern": "^TST-[0-9]{6,}$"
                          },
                          "issuedVersion": {
                            "type": "integer",
                            "minimum": 2
                          },
                          "snapshotHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "customerId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "customerVersion": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "customerName": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          },
                          "recipient": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 254
                          },
                          "dueDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "asOfDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "gross": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "confirmed": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "outstanding": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,15})\\.[0-9]{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "enum": [
                              "GBP"
                            ]
                          },
                          "sourceHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "deliveryPreference": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "email"
                            ]
                          },
                          "allocationHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "number",
                          "issuedVersion",
                          "snapshotHash",
                          "customerId",
                          "customerVersion",
                          "customerName",
                          "recipient",
                          "dueDate",
                          "asOfDate",
                          "gross",
                          "confirmed",
                          "outstanding",
                          "currency",
                          "sourceHash",
                          "deliveryPreference",
                          "allocationHash"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    },
                    "proposals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "subject": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "body": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1500
                          },
                          "sourceHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "subject",
                          "body",
                          "sourceHash"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    },
                    "canCancel": {
                      "type": "boolean"
                    },
                    "canPause": {
                      "type": "boolean"
                    },
                    "gateway": {
                      "oneOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "provider": {
                              "type": "string",
                              "enum": [
                                "anthropic",
                                "test_fixture"
                              ]
                            },
                            "model": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "promptVersion": {
                              "type": "string",
                              "enum": [
                                "COLLECTIONS_L1_V1"
                              ]
                            }
                          },
                          "required": [
                            "provider",
                            "model",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "runId",
                    "agent",
                    "state",
                    "createdAt",
                    "updatedAt",
                    "blockedReason",
                    "businessId",
                    "environment",
                    "evidence",
                    "proposals",
                    "canCancel",
                    "canPause",
                    "gateway"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_runtime_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/agent-policy": {
      "put": {
        "operationId": "setCollectionsPolicy",
        "summary": "Pause or resume new TEST preparation",
        "description": "Controlled TEST L1 preparation only. No reminder send, approval, payment/allocation, accounting, model tools or financial executor. Runtime/worker/provider gates and finite business grant remain separate; local fixture evidence does not prove genuine model or hosted acceptance.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current permitted projection; needs_review means draft prepared only.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "enum": [
                        "test"
                      ]
                    },
                    "paused": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "paused"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no source/provider/private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "agent_runtime_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paused": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "paused"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/exceptions": {
      "get": {
        "operationId": "listBusinessExceptions",
        "summary": "Read bounded current TEST business exception records",
        "description": "Read-only TEST durable exception facts with current provider session, user, business and role checks. No provider HTTP, private payload, communication or financial command. Receipt amounts describe the receipt, not invoice outstanding. Unknown outcomes and an empty page do not prove payment, provider health, recipient delivery or accounting success. Canonical source/UUID keyset pages represent current state, not a multi-request snapshot; refresh the first page for current completeness. A resolved or inaccessible detail is 404.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "payments",
                "accounting",
                "delivery"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(checkout|receipt|xero_effect|xero_mapping|xero_connection|delivery_submission):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current permitted minimal directory.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "category": {
                      "type": "string",
                      "enum": [
                        "all",
                        "payments",
                        "accounting",
                        "delivery"
                      ]
                    },
                    "exceptions": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "exceptionId": {
                            "type": "string",
                            "pattern": "^(checkout|receipt|xero_effect|xero_mapping|xero_connection|delivery_submission):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "category": {
                            "type": "string",
                            "enum": [
                              "payments",
                              "accounting",
                              "delivery"
                            ]
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "checkout_unknown",
                              "checkout_manual_review",
                              "checkout_failed",
                              "receipt_unallocated",
                              "receipt_allocation_inconsistent",
                              "xero_export_unknown",
                              "xero_export_needs_review",
                              "xero_mapping_stale",
                              "xero_refresh_unknown",
                              "xero_connection_needs_reconnect",
                              "delivery_unknown",
                              "delivery_failed",
                              "delivery_processing_stale"
                            ]
                          },
                          "resourceId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "invoiceId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "resourceVersion": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "sourceState": {
                            "type": "string",
                            "enum": [
                              "unknown",
                              "manual_reconciliation",
                              "failed",
                              "allocated",
                              "unapplied_overpayment",
                              "needs_review",
                              "exporting",
                              "mapping_confirmed",
                              "refreshing",
                              "needs_reconnect",
                              "processing"
                            ]
                          },
                          "observedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "receiptAmounts": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  },
                                  "receivedMinor": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                  },
                                  "allocatedMinor": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                  },
                                  "unallocatedMinor": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                  }
                                },
                                "required": [
                                  "currency",
                                  "receivedMinor",
                                  "allocatedMinor",
                                  "unallocatedMinor"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "exceptionId",
                          "category",
                          "kind",
                          "resourceId",
                          "invoiceId",
                          "resourceVersion",
                          "sourceState",
                          "observedAt",
                          "receiptAmounts"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "readOnly",
                    "category",
                    "exceptions",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no private source or provider data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no private source or provider data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no private source or provider data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no private source or provider data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no private source or provider data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "exceptions_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/exceptions/{source}/{resourceId}": {
      "get": {
        "operationId": "getBusinessException",
        "summary": "Read one current scoped TEST exception",
        "description": "Read-only TEST durable exception facts with current provider session, user, business and role checks. No provider HTTP, private payload, communication or financial command. Receipt amounts describe the receipt, not invoice outstanding. Unknown outcomes and an empty page do not prove payment, provider health, recipient delivery or accounting success. Canonical source/UUID keyset pages represent current state, not a multi-request snapshot; refresh the first page for current completeness. A resolved or inaccessible detail is 404.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "source",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "checkout",
                "receipt",
                "xero_effect",
                "xero_mapping",
                "xero_connection",
                "delivery_submission"
              ]
            }
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current permitted minimal detail.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "exception": {
                      "type": "object",
                      "properties": {
                        "exceptionId": {
                          "type": "string",
                          "pattern": "^(checkout|receipt|xero_effect|xero_mapping|xero_connection|delivery_submission):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "category": {
                          "type": "string",
                          "enum": [
                            "payments",
                            "accounting",
                            "delivery"
                          ]
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "checkout_unknown",
                            "checkout_manual_review",
                            "checkout_failed",
                            "receipt_unallocated",
                            "receipt_allocation_inconsistent",
                            "xero_export_unknown",
                            "xero_export_needs_review",
                            "xero_mapping_stale",
                            "xero_refresh_unknown",
                            "xero_connection_needs_reconnect",
                            "delivery_unknown",
                            "delivery_failed",
                            "delivery_processing_stale"
                          ]
                        },
                        "resourceId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "invoiceId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "resourceVersion": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "sourceState": {
                          "type": "string",
                          "enum": [
                            "unknown",
                            "manual_reconciliation",
                            "failed",
                            "allocated",
                            "unapplied_overpayment",
                            "needs_review",
                            "exporting",
                            "mapping_confirmed",
                            "refreshing",
                            "needs_reconnect",
                            "processing"
                          ]
                        },
                        "observedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "receiptAmounts": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "currency": {
                                  "type": "string",
                                  "const": "GBP"
                                },
                                "receivedMinor": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                },
                                "allocatedMinor": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                },
                                "unallocatedMinor": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                }
                              },
                              "required": [
                                "currency",
                                "receivedMinor",
                                "allocatedMinor",
                                "unallocatedMinor"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "exceptionId",
                        "category",
                        "kind",
                        "resourceId",
                        "invoiceId",
                        "resourceVersion",
                        "sourceState",
                        "observedAt",
                        "receiptAmounts"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "readOnly",
                    "exception"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no private source or provider data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no private source or provider data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no private source or provider data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no private source or provider data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no private source or provider data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "exceptions_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/reconciliation-runs": {
      "get": {
        "description": "Default-off TEST deterministic ledger review with genuine current owner/finance_admin session, finite agent grant and active policy. Private immutable run and common audit commit atomically. RepeatableRead supplies a complete bounded snapshot; source changes, current grant/policy/initiator access and two-minute initial snapshot freshness are rechecked on reads and replay. Payment confirmation/allocation are separate from accounting: accountingSyncState is not_checked. No allocation, invoice, payment, provider, model or email action. Unknown/409 responses retain the original operation UUID; retrying that same key can return the original run. New UUIDs are not recovery. Directory contains the latest 50 entries with no historical pagination promise.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "operationId": "listReconciliationRuns",
        "summary": "Read bounded current TEST ledger review history",
        "responses": {
          "200": {
            "description": "Recent summaries and current canStart gate.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "agent": {
                      "type": "string",
                      "const": "reconciliation"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "canStart": {
                      "type": "boolean"
                    },
                    "runs": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "properties": {
                          "runId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "explained",
                              "needs_review",
                              "blocked"
                            ]
                          },
                          "blockedReason": {
                            "oneOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "runtime_grant_changed",
                                  "runtime_paused",
                                  "actor_access_changed",
                                  "source_changed",
                                  "stale_evidence"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "runId",
                          "state",
                          "blockedReason",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "agent",
                    "readOnly",
                    "executionAllowed",
                    "canStart",
                    "runs",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "reconciliation_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "reconciliation_source_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "reconciliation_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "description": "Default-off TEST deterministic ledger review with genuine current owner/finance_admin session, finite agent grant and active policy. Private immutable run and common audit commit atomically. RepeatableRead supplies a complete bounded snapshot; source changes, current grant/policy/initiator access and two-minute initial snapshot freshness are rechecked on reads and replay. Payment confirmation/allocation are separate from accounting: accountingSyncState is not_checked. No allocation, invoice, payment, provider, model or email action. Unknown/409 responses retain the original operation UUID; retrying that same key can return the original run. New UUIDs are not recovery. Directory contains the latest 50 entries with no historical pagination promise.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "operationId": "prepareReconciliationRun",
        "summary": "Prepare an immutable TEST ledger explanation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original-key replay with current evidence revalidation.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "agent": {
                      "type": "string",
                      "const": "reconciliation"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "runId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "explained",
                        "needs_review",
                        "blocked"
                      ]
                    },
                    "blockedReason": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "actor_access_changed",
                            "source_changed",
                            "stale_evidence"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "schemaVersion": {
                      "type": "string",
                      "const": "RECONCILIATION_L1_V1"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "outcome": {
                              "type": "string",
                              "enum": [
                                "explained",
                                "needs_review"
                              ]
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "verified_payment_evidence",
                                "no_confirmed_payments"
                              ]
                            },
                            "businessId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "environment": {
                              "type": "string",
                              "const": "test"
                            },
                            "readAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "schemaVersion": {
                              "type": "string",
                              "const": "RECONCILIATION_L1_V1"
                            },
                            "executionAllowed": {
                              "type": "boolean",
                              "const": false
                            },
                            "explanations": {
                              "type": "array",
                              "maxItems": 200,
                              "items": {
                                "type": "object",
                                "properties": {
                                  "receiptId": {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  "invoiceId": {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  "issuedVersion": {
                                    "type": "integer",
                                    "minimum": 2
                                  },
                                  "snapshotHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  },
                                  "receiptSourceHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  },
                                  "allocationId": {
                                    "oneOf": [
                                      {
                                        "type": "string",
                                        "format": "uuid"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "allocationSourceHash": {
                                    "oneOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  },
                                  "confirmedMinor": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 99999999
                                  },
                                  "allocatedMinor": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 99999999
                                  },
                                  "outstandingMinor": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 99999999
                                  },
                                  "reason": {
                                    "type": "string",
                                    "enum": [
                                      "matched_existing_allocation",
                                      "unapplied_overpayment_requires_review"
                                    ]
                                  },
                                  "evidenceHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  },
                                  "paymentConfirmationState": {
                                    "type": "string",
                                    "const": "confirmed"
                                  },
                                  "accountingSyncState": {
                                    "type": "string",
                                    "const": "not_checked"
                                  },
                                  "proposedAllocationMinor": {
                                    "type": "integer",
                                    "const": 0
                                  },
                                  "executionAllowed": {
                                    "type": "boolean",
                                    "const": false
                                  }
                                },
                                "required": [
                                  "receiptId",
                                  "invoiceId",
                                  "issuedVersion",
                                  "snapshotHash",
                                  "receiptSourceHash",
                                  "allocationId",
                                  "allocationSourceHash",
                                  "currency",
                                  "confirmedMinor",
                                  "allocatedMinor",
                                  "outstandingMinor",
                                  "reason",
                                  "evidenceHash",
                                  "paymentConfirmationState",
                                  "accountingSyncState",
                                  "proposedAllocationMinor",
                                  "executionAllowed"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "outcome",
                            "reason",
                            "businessId",
                            "environment",
                            "readAt",
                            "schemaVersion",
                            "executionAllowed",
                            "explanations"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "agent",
                    "readOnly",
                    "executionAllowed",
                    "runId",
                    "state",
                    "blockedReason",
                    "createdAt",
                    "schemaVersion",
                    "replayed",
                    "result"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "New immutable explanation; financial execution remains disabled.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "agent": {
                      "type": "string",
                      "const": "reconciliation"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "runId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "explained",
                        "needs_review",
                        "blocked"
                      ]
                    },
                    "blockedReason": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "actor_access_changed",
                            "source_changed",
                            "stale_evidence"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "schemaVersion": {
                      "type": "string",
                      "const": "RECONCILIATION_L1_V1"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "outcome": {
                              "type": "string",
                              "enum": [
                                "explained",
                                "needs_review"
                              ]
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "verified_payment_evidence",
                                "no_confirmed_payments"
                              ]
                            },
                            "businessId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "environment": {
                              "type": "string",
                              "const": "test"
                            },
                            "readAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "schemaVersion": {
                              "type": "string",
                              "const": "RECONCILIATION_L1_V1"
                            },
                            "executionAllowed": {
                              "type": "boolean",
                              "const": false
                            },
                            "explanations": {
                              "type": "array",
                              "maxItems": 200,
                              "items": {
                                "type": "object",
                                "properties": {
                                  "receiptId": {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  "invoiceId": {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  "issuedVersion": {
                                    "type": "integer",
                                    "minimum": 2
                                  },
                                  "snapshotHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  },
                                  "receiptSourceHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  },
                                  "allocationId": {
                                    "oneOf": [
                                      {
                                        "type": "string",
                                        "format": "uuid"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "allocationSourceHash": {
                                    "oneOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  },
                                  "confirmedMinor": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 99999999
                                  },
                                  "allocatedMinor": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 99999999
                                  },
                                  "outstandingMinor": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 99999999
                                  },
                                  "reason": {
                                    "type": "string",
                                    "enum": [
                                      "matched_existing_allocation",
                                      "unapplied_overpayment_requires_review"
                                    ]
                                  },
                                  "evidenceHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  },
                                  "paymentConfirmationState": {
                                    "type": "string",
                                    "const": "confirmed"
                                  },
                                  "accountingSyncState": {
                                    "type": "string",
                                    "const": "not_checked"
                                  },
                                  "proposedAllocationMinor": {
                                    "type": "integer",
                                    "const": 0
                                  },
                                  "executionAllowed": {
                                    "type": "boolean",
                                    "const": false
                                  }
                                },
                                "required": [
                                  "receiptId",
                                  "invoiceId",
                                  "issuedVersion",
                                  "snapshotHash",
                                  "receiptSourceHash",
                                  "allocationId",
                                  "allocationSourceHash",
                                  "currency",
                                  "confirmedMinor",
                                  "allocatedMinor",
                                  "outstandingMinor",
                                  "reason",
                                  "evidenceHash",
                                  "paymentConfirmationState",
                                  "accountingSyncState",
                                  "proposedAllocationMinor",
                                  "executionAllowed"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "outcome",
                            "reason",
                            "businessId",
                            "environment",
                            "readAt",
                            "schemaVersion",
                            "executionAllowed",
                            "explanations"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "agent",
                    "readOnly",
                    "executionAllowed",
                    "runId",
                    "state",
                    "blockedReason",
                    "createdAt",
                    "schemaVersion",
                    "replayed",
                    "result"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "reconciliation_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "reconciliation_source_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "reconciliation_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/reconciliation-runs/{runId}": {
      "get": {
        "description": "Default-off TEST deterministic ledger review with genuine current owner/finance_admin session, finite agent grant and active policy. Private immutable run and common audit commit atomically. RepeatableRead supplies a complete bounded snapshot; source changes, current grant/policy/initiator access and two-minute initial snapshot freshness are rechecked on reads and replay. Payment confirmation/allocation are separate from accounting: accountingSyncState is not_checked. No allocation, invoice, payment, provider, model or email action. Unknown/409 responses retain the original operation UUID; retrying that same key can return the original run. New UUIDs are not recovery. Directory contains the latest 50 entries with no historical pagination promise.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "operationId": "getReconciliationRun",
        "summary": "Read one currently revalidated TEST ledger review",
        "responses": {
          "200": {
            "description": "Current explanation, or blocked with null evidence.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "agent": {
                      "type": "string",
                      "const": "reconciliation"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "runId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "explained",
                        "needs_review",
                        "blocked"
                      ]
                    },
                    "blockedReason": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "actor_access_changed",
                            "source_changed",
                            "stale_evidence"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "schemaVersion": {
                      "type": "string",
                      "const": "RECONCILIATION_L1_V1"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "outcome": {
                              "type": "string",
                              "enum": [
                                "explained",
                                "needs_review"
                              ]
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "verified_payment_evidence",
                                "no_confirmed_payments"
                              ]
                            },
                            "businessId": {
                              "type": "string",
                              "format": "uuid"
                            },
                            "environment": {
                              "type": "string",
                              "const": "test"
                            },
                            "readAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "schemaVersion": {
                              "type": "string",
                              "const": "RECONCILIATION_L1_V1"
                            },
                            "executionAllowed": {
                              "type": "boolean",
                              "const": false
                            },
                            "explanations": {
                              "type": "array",
                              "maxItems": 200,
                              "items": {
                                "type": "object",
                                "properties": {
                                  "receiptId": {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  "invoiceId": {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  "issuedVersion": {
                                    "type": "integer",
                                    "minimum": 2
                                  },
                                  "snapshotHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  },
                                  "receiptSourceHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  },
                                  "allocationId": {
                                    "oneOf": [
                                      {
                                        "type": "string",
                                        "format": "uuid"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "allocationSourceHash": {
                                    "oneOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  },
                                  "confirmedMinor": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 99999999
                                  },
                                  "allocatedMinor": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 99999999
                                  },
                                  "outstandingMinor": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 99999999
                                  },
                                  "reason": {
                                    "type": "string",
                                    "enum": [
                                      "matched_existing_allocation",
                                      "unapplied_overpayment_requires_review"
                                    ]
                                  },
                                  "evidenceHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  },
                                  "paymentConfirmationState": {
                                    "type": "string",
                                    "const": "confirmed"
                                  },
                                  "accountingSyncState": {
                                    "type": "string",
                                    "const": "not_checked"
                                  },
                                  "proposedAllocationMinor": {
                                    "type": "integer",
                                    "const": 0
                                  },
                                  "executionAllowed": {
                                    "type": "boolean",
                                    "const": false
                                  }
                                },
                                "required": [
                                  "receiptId",
                                  "invoiceId",
                                  "issuedVersion",
                                  "snapshotHash",
                                  "receiptSourceHash",
                                  "allocationId",
                                  "allocationSourceHash",
                                  "currency",
                                  "confirmedMinor",
                                  "allocatedMinor",
                                  "outstandingMinor",
                                  "reason",
                                  "evidenceHash",
                                  "paymentConfirmationState",
                                  "accountingSyncState",
                                  "proposedAllocationMinor",
                                  "executionAllowed"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "outcome",
                            "reason",
                            "businessId",
                            "environment",
                            "readAt",
                            "schemaVersion",
                            "executionAllowed",
                            "explanations"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "agent",
                    "readOnly",
                    "executionAllowed",
                    "runId",
                    "state",
                    "blockedReason",
                    "createdAt",
                    "schemaVersion",
                    "replayed",
                    "result"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "reconciliation_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "reconciliation_source_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed TEST error; no private evidence or financial result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "reconciliation_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/support/businesses/{businessId}/audit": {
      "get": {
        "operationId": "readSupportBusinessAudit",
        "summary": "Read minimal TEST action/change history with an audited access receipt",
        "description": "Separate default-off support boundary: genuine current owner session plus explicit finite business-and-subject TEST support grant required. Owner membership alone grants no support authority. Successful bounded reads, including empty results, atomically commit an immutable access receipt before returning events; receipt failure returns503 without events. Financial resources remain read-only. No raw before/after values, credentials, session tokens, provider/document payloads or unknown changed-field names. UUID ascending keyset pages are current state, not chronological order or a frozen complete snapshot. No provider/model/financial call or resolution endpoint.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "actions",
                "changes"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 50,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current masked events and the committed access receipt ID.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "actions",
                        "changes"
                      ]
                    },
                    "events": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "eventId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "occurredAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "actorType": {
                            "type": "string",
                            "enum": [
                              "user_context",
                              "provider_processor",
                              "maintenance"
                            ]
                          },
                          "actorId": {
                            "oneOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "action": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "resourceType": {
                            "type": "string"
                          },
                          "resourceId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "relatedResourceId": {
                            "oneOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "beforeVersion": {
                            "oneOf": [
                              {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 2147483647
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "afterVersion": {
                            "oneOf": [
                              {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 2147483647
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "operation": {
                            "oneOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "INSERT",
                                  "UPDATE",
                                  "DELETE"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "changedFields": {
                            "type": "array",
                            "maxItems": 31,
                            "items": {
                              "type": "string",
                              "enum": [
                                "id",
                                "business_id",
                                "environment",
                                "status",
                                "state",
                                "version",
                                "role",
                                "enabled",
                                "revision",
                                "expires_at",
                                "issued_at",
                                "document_state",
                                "calculation_state",
                                "net_amount",
                                "vat_amount",
                                "gross_amount",
                                "currency",
                                "country",
                                "payment_terms_days",
                                "collections_paused",
                                "grant_revision",
                                "mapping_version",
                                "issued_version",
                                "invoice_id",
                                "customer_id",
                                "resource_id",
                                "actor_id",
                                "subject_id",
                                "created_at",
                                "updated_at",
                                "archived_at"
                              ]
                            }
                          },
                          "correlationId": {
                            "oneOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "eventId",
                          "occurredAt",
                          "actorType",
                          "actorId",
                          "action",
                          "resourceType",
                          "resourceId",
                          "relatedResourceId",
                          "beforeVersion",
                          "afterVersion",
                          "operation",
                          "changedFields",
                          "correlationId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "readReceiptId": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "readOnly",
                    "kind",
                    "events",
                    "nextCursor",
                    "readReceiptId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without events or a successful read receipt.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without events or a successful read receipt.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without events or a successful read receipt.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "support_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without events or a successful read receipt.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without events or a successful read receipt.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "support_audit_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/documents": {
      "get": {
        "operationId": "listBusinessDocuments",
        "summary": "Read quarantined TEST document metadata",
        "description": "Default-off Documents:Enabled plus current genuine TEST business membership and explicit finite private business grant. Bytes always remain quarantined; no scanner, extraction, model, downloads, approved attachment or financial executor. Maximum20 active reservations/10MiB per business and100 retained intake records. Expired intents count until a separately authorised owner manually releases eligible reserved quota; original metadata and upload keys remain. Signature recognition is not safety validation. Private content never returned. Current owner/admin/operator/bookkeeper/viewer can read metadata; approver excluded. UUID keyset is current state, not chronological order or a frozen snapshot.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            },
            "required": false
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped metadata; no file bytes or review reason.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "documents": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "properties": {
                          "documentId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "filename": {
                            "type": "string",
                            "maxLength": 100,
                            "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]*\\.([pP][dD][fF]|[pP][nN][gG]|[jJ][pP][gG]|[jJ][pP][eE][gG])$"
                          },
                          "mediaType": {
                            "type": "string",
                            "enum": [
                              "application/pdf",
                              "image/png",
                              "image/jpeg"
                            ]
                          },
                          "byteLength": {
                            "type": "integer",
                            "minimum": 8,
                            "maximum": 1048576
                          },
                          "sha256": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{64}$"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "awaiting_upload",
                              "quarantined"
                            ]
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "reviewState": {
                            "type": "string",
                            "enum": [
                              "unreviewed",
                              "classified",
                              "rejected"
                            ]
                          },
                          "classification": {
                            "oneOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "invoice",
                                  "receipt",
                                  "other"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "scanState": {
                            "type": "string",
                            "const": "not_configured"
                          },
                          "extractionState": {
                            "type": "string",
                            "const": "not_started"
                          },
                          "downloadAvailable": {
                            "type": "boolean",
                            "const": false
                          },
                          "attachmentAvailable": {
                            "type": "boolean",
                            "const": false
                          },
                          "source": {
                            "type": "string",
                            "const": "authenticated_user_upload"
                          },
                          "uploaderId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "invoiceId": {
                            "oneOf": [
                              {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "invoiceVersion": {
                            "oneOf": [
                              {
                                "type": "integer",
                                "minimum": 2,
                                "maximum": 2147483647
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "invoiceSnapshotHash": {
                            "oneOf": [
                              {
                                "type": "string",
                                "pattern": "^[0-9a-f]{64}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "expiresAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "uploadedAt": {
                            "oneOf": [
                              {
                                "type": "string",
                                "format": "date-time"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "documentId",
                          "filename",
                          "mediaType",
                          "byteLength",
                          "sha256",
                          "state",
                          "version",
                          "reviewState",
                          "classification",
                          "scanState",
                          "extractionState",
                          "downloadAvailable",
                          "attachmentAvailable",
                          "source",
                          "uploaderId",
                          "invoiceId",
                          "invoiceVersion",
                          "invoiceSnapshotHash",
                          "createdAt",
                          "expiresAt",
                          "uploadedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "documents",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_document_content"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "documents_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}": {
      "get": {
        "operationId": "readBusinessDocument",
        "summary": "Read one quarantined TEST document record",
        "description": "Default-off Documents:Enabled plus current genuine TEST business membership and explicit finite private business grant. Bytes always remain quarantined; no scanner, extraction, model, downloads, approved attachment or financial executor. Maximum20 active reservations/10MiB per business and100 retained intake records. Expired intents count until a separately authorised owner manually releases eligible reserved quota; original metadata and upload keys remain. Signature recognition is not safety validation. Private content never returned. Current owner/admin/operator/bookkeeper/viewer can read metadata; approver excluded. UUID keyset is current state, not chronological order or a frozen snapshot.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "documentId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped metadata; no file bytes or review reason.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "document": {
                      "type": "object",
                      "properties": {
                        "documentId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "filename": {
                          "type": "string",
                          "maxLength": 100,
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]*\\.([pP][dD][fF]|[pP][nN][gG]|[jJ][pP][gG]|[jJ][pP][eE][gG])$"
                        },
                        "mediaType": {
                          "type": "string",
                          "enum": [
                            "application/pdf",
                            "image/png",
                            "image/jpeg"
                          ]
                        },
                        "byteLength": {
                          "type": "integer",
                          "minimum": 8,
                          "maximum": 1048576
                        },
                        "sha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "awaiting_upload",
                            "quarantined"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "reviewState": {
                          "type": "string",
                          "enum": [
                            "unreviewed",
                            "classified",
                            "rejected"
                          ]
                        },
                        "classification": {
                          "oneOf": [
                            {
                              "type": "string",
                              "enum": [
                                "invoice",
                                "receipt",
                                "other"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "scanState": {
                          "type": "string",
                          "const": "not_configured"
                        },
                        "extractionState": {
                          "type": "string",
                          "const": "not_started"
                        },
                        "downloadAvailable": {
                          "type": "boolean",
                          "const": false
                        },
                        "attachmentAvailable": {
                          "type": "boolean",
                          "const": false
                        },
                        "source": {
                          "type": "string",
                          "const": "authenticated_user_upload"
                        },
                        "uploaderId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "invoiceVersion": {
                          "oneOf": [
                            {
                              "type": "integer",
                              "minimum": 2,
                              "maximum": 2147483647
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "invoiceSnapshotHash": {
                          "oneOf": [
                            {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "uploadedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "documentId",
                        "filename",
                        "mediaType",
                        "byteLength",
                        "sha256",
                        "state",
                        "version",
                        "reviewState",
                        "classification",
                        "scanState",
                        "extractionState",
                        "downloadAvailable",
                        "attachmentAvailable",
                        "source",
                        "uploaderId",
                        "invoiceId",
                        "invoiceVersion",
                        "invoiceSnapshotHash",
                        "createdAt",
                        "expiresAt",
                        "uploadedAt"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "document",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_document_content"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "documents_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/documents/upload-intents": {
      "post": {
        "operationId": "createDocumentUploadIntent",
        "summary": "Reserve one bounded TEST upload",
        "description": "Default-off Documents:Enabled plus current genuine TEST business membership and explicit finite private business grant. Bytes always remain quarantined; no scanner, extraction, model, downloads, approved attachment or financial executor. Maximum20 active reservations/10MiB per business and100 retained intake records. Expired intents count until a separately authorised owner manually releases eligible reserved quota; original metadata and upload keys remain. Signature recognition is not safety validation. Private content never returned. Current owner/finance_admin commands use retained original UUID after uncertain outcome; upload finalise rechecks original session, grant revision and ten-minute intent expiry after bounded streaming. Matching replay returns the current record without duplicate content/audit. Human classification does not clear quarantine.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped metadata; no file bytes or review reason.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "document": {
                      "type": "object",
                      "properties": {
                        "documentId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "filename": {
                          "type": "string",
                          "maxLength": 100,
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]*\\.([pP][dD][fF]|[pP][nN][gG]|[jJ][pP][gG]|[jJ][pP][eE][gG])$"
                        },
                        "mediaType": {
                          "type": "string",
                          "enum": [
                            "application/pdf",
                            "image/png",
                            "image/jpeg"
                          ]
                        },
                        "byteLength": {
                          "type": "integer",
                          "minimum": 8,
                          "maximum": 1048576
                        },
                        "sha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "awaiting_upload",
                            "quarantined"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "reviewState": {
                          "type": "string",
                          "enum": [
                            "unreviewed",
                            "classified",
                            "rejected"
                          ]
                        },
                        "classification": {
                          "oneOf": [
                            {
                              "type": "string",
                              "enum": [
                                "invoice",
                                "receipt",
                                "other"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "scanState": {
                          "type": "string",
                          "const": "not_configured"
                        },
                        "extractionState": {
                          "type": "string",
                          "const": "not_started"
                        },
                        "downloadAvailable": {
                          "type": "boolean",
                          "const": false
                        },
                        "attachmentAvailable": {
                          "type": "boolean",
                          "const": false
                        },
                        "source": {
                          "type": "string",
                          "const": "authenticated_user_upload"
                        },
                        "uploaderId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "invoiceVersion": {
                          "oneOf": [
                            {
                              "type": "integer",
                              "minimum": 2,
                              "maximum": 2147483647
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "invoiceSnapshotHash": {
                          "oneOf": [
                            {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "uploadedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "documentId",
                        "filename",
                        "mediaType",
                        "byteLength",
                        "sha256",
                        "state",
                        "version",
                        "reviewState",
                        "classification",
                        "scanState",
                        "extractionState",
                        "downloadAvailable",
                        "attachmentAvailable",
                        "source",
                        "uploaderId",
                        "invoiceId",
                        "invoiceVersion",
                        "invoiceSnapshotHash",
                        "createdAt",
                        "expiresAt",
                        "uploadedAt"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "document",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_document_content"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "documents_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Exactly six fields, hard4096-byte JSON stream; optional invoice fields bothnull or a current issued invoice/version pair. MIME and suffix must match. Duplicate keys and alternate integer spellings rejected.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filename": {
                    "type": "string",
                    "maxLength": 100,
                    "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]*\\.([pP][dD][fF]|[pP][nN][gG]|[jJ][pP][gG]|[jJ][pP][eE][gG])$"
                  },
                  "mediaType": {
                    "type": "string",
                    "enum": [
                      "application/pdf",
                      "image/png",
                      "image/jpeg"
                    ]
                  },
                  "byteLength": {
                    "type": "integer",
                    "minimum": 8,
                    "maximum": 1048576
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "invoiceId": {
                    "oneOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "invoiceVersion": {
                    "oneOf": [
                      {
                        "type": "integer",
                        "minimum": 2,
                        "maximum": 2147483647
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "filename",
                  "mediaType",
                  "byteLength",
                  "sha256",
                  "invoiceId",
                  "invoiceVersion"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}/finalise": {
      "post": {
        "operationId": "finaliseDocumentUpload",
        "summary": "Persist validated bytes to private quarantine",
        "description": "Default-off Documents:Enabled plus current genuine TEST business membership and explicit finite private business grant. Bytes always remain quarantined; no scanner, extraction, model, downloads, approved attachment or financial executor. Maximum20 active reservations/10MiB per business and100 retained intake records. Expired intents count until a separately authorised owner manually releases eligible reserved quota; original metadata and upload keys remain. Signature recognition is not safety validation. Private content never returned. Current owner/finance_admin commands use retained original UUID after uncertain outcome; upload finalise rechecks original session, grant revision and ten-minute intent expiry after bounded streaming. Matching replay returns the current record without duplicate content/audit. Human classification does not clear quarantine.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "documentId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]*$",
              "description": "Canonical unquoted positive integer; finalise always original1."
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped metadata; no file bytes or review reason.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "document": {
                      "type": "object",
                      "properties": {
                        "documentId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "filename": {
                          "type": "string",
                          "maxLength": 100,
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]*\\.([pP][dD][fF]|[pP][nN][gG]|[jJ][pP][gG]|[jJ][pP][eE][gG])$"
                        },
                        "mediaType": {
                          "type": "string",
                          "enum": [
                            "application/pdf",
                            "image/png",
                            "image/jpeg"
                          ]
                        },
                        "byteLength": {
                          "type": "integer",
                          "minimum": 8,
                          "maximum": 1048576
                        },
                        "sha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "awaiting_upload",
                            "quarantined"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "reviewState": {
                          "type": "string",
                          "enum": [
                            "unreviewed",
                            "classified",
                            "rejected"
                          ]
                        },
                        "classification": {
                          "oneOf": [
                            {
                              "type": "string",
                              "enum": [
                                "invoice",
                                "receipt",
                                "other"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "scanState": {
                          "type": "string",
                          "const": "not_configured"
                        },
                        "extractionState": {
                          "type": "string",
                          "const": "not_started"
                        },
                        "downloadAvailable": {
                          "type": "boolean",
                          "const": false
                        },
                        "attachmentAvailable": {
                          "type": "boolean",
                          "const": false
                        },
                        "source": {
                          "type": "string",
                          "const": "authenticated_user_upload"
                        },
                        "uploaderId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "invoiceVersion": {
                          "oneOf": [
                            {
                              "type": "integer",
                              "minimum": 2,
                              "maximum": 2147483647
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "invoiceSnapshotHash": {
                          "oneOf": [
                            {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "uploadedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "documentId",
                        "filename",
                        "mediaType",
                        "byteLength",
                        "sha256",
                        "state",
                        "version",
                        "reviewState",
                        "classification",
                        "scanState",
                        "extractionState",
                        "downloadAvailable",
                        "attachmentAvailable",
                        "source",
                        "uploaderId",
                        "invoiceId",
                        "invoiceVersion",
                        "invoiceSnapshotHash",
                        "createdAt",
                        "expiresAt",
                        "uploadedAt"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "document",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_document_content"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "documents_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Raw8..1,048,576 bytes; exact declared MIME, reservation length/SHA-256 and PDF/PNG/JPEG magic. No Content-Type charset. Original intent UUID and version1 required even after later human review.",
          "content": {
            "application/pdf": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}/reviews": {
      "post": {
        "operationId": "recordDocumentReview",
        "summary": "Record a human classification or rejection",
        "description": "Default-off Documents:Enabled plus current genuine TEST business membership and explicit finite private business grant. Bytes always remain quarantined; no scanner, extraction, model, downloads, approved attachment or financial executor. Maximum20 active reservations/10MiB per business and100 retained intake records. Expired intents count until a separately authorised owner manually releases eligible reserved quota; original metadata and upload keys remain. Signature recognition is not safety validation. Private content never returned. Current owner/finance_admin commands use retained original UUID after uncertain outcome; upload finalise rechecks original session, grant revision and ten-minute intent expiry after bounded streaming. Matching replay returns the current record without duplicate content/audit. Human classification does not clear quarantine.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "documentId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]*$",
              "description": "Canonical unquoted positive integer; finalise always original1."
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped metadata; no file bytes or review reason.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "document": {
                      "type": "object",
                      "properties": {
                        "documentId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "filename": {
                          "type": "string",
                          "maxLength": 100,
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]*\\.([pP][dD][fF]|[pP][nN][gG]|[jJ][pP][gG]|[jJ][pP][eE][gG])$"
                        },
                        "mediaType": {
                          "type": "string",
                          "enum": [
                            "application/pdf",
                            "image/png",
                            "image/jpeg"
                          ]
                        },
                        "byteLength": {
                          "type": "integer",
                          "minimum": 8,
                          "maximum": 1048576
                        },
                        "sha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "awaiting_upload",
                            "quarantined"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "reviewState": {
                          "type": "string",
                          "enum": [
                            "unreviewed",
                            "classified",
                            "rejected"
                          ]
                        },
                        "classification": {
                          "oneOf": [
                            {
                              "type": "string",
                              "enum": [
                                "invoice",
                                "receipt",
                                "other"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "scanState": {
                          "type": "string",
                          "const": "not_configured"
                        },
                        "extractionState": {
                          "type": "string",
                          "const": "not_started"
                        },
                        "downloadAvailable": {
                          "type": "boolean",
                          "const": false
                        },
                        "attachmentAvailable": {
                          "type": "boolean",
                          "const": false
                        },
                        "source": {
                          "type": "string",
                          "const": "authenticated_user_upload"
                        },
                        "uploaderId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "invoiceVersion": {
                          "oneOf": [
                            {
                              "type": "integer",
                              "minimum": 2,
                              "maximum": 2147483647
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "invoiceSnapshotHash": {
                          "oneOf": [
                            {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "uploadedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "documentId",
                        "filename",
                        "mediaType",
                        "byteLength",
                        "sha256",
                        "state",
                        "version",
                        "reviewState",
                        "classification",
                        "scanState",
                        "extractionState",
                        "downloadAvailable",
                        "attachmentAvailable",
                        "source",
                        "uploaderId",
                        "invoiceId",
                        "invoiceVersion",
                        "invoiceSnapshotHash",
                        "createdAt",
                        "expiresAt",
                        "uploadedAt"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "document",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_document_content"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "document_version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "documents_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Exact three-field human review of current quarantined version; immutable record increments version and retains quarantine. Hard4096-byte JSON bound.",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "decision": {
                        "type": "string",
                        "const": "classify"
                      },
                      "classification": {
                        "type": "string",
                        "enum": [
                          "invoice",
                          "receipt",
                          "other"
                        ]
                      },
                      "reason": {
                        "oneOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500,
                            "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "decision",
                      "classification",
                      "reason"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "decision": {
                        "type": "string",
                        "const": "reject"
                      },
                      "classification": {
                        "type": "null"
                      },
                      "reason": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500,
                        "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                      }
                    },
                    "required": [
                      "decision",
                      "classification",
                      "reason"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/finance-reviews": {
      "get": {
        "description": "Default-off TEST deterministic Finance Orchestrator human review. Current owner/finance_admin, finite agent grant and active policy; history/detail/original-key namespace are scoped to initiating actor. Complete bounded RepeatableRead source snapshot (20 invoices,40 specialist contexts) and current source/access/policy/grant/two-minute initial freshness rechecked. Immutable plan plus redacted audits commit atomically. Steps remain ordered and same-invoice version/hash/money pairs source-bound; null amounts remain unknown. Allocated invoice balances exclude unapplied receipts; existing allocations are explanations, sandbox acceptance is not inbox delivery, paid and accounting accepted are separate. No model, specialist dispatch, financial execution or provider calls. Unknown/concurrent409 retries retain original UUID, never create automatic replacement requests. Latest50 actor summaries; no full-history pagination promise.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
            }
          }
        ],
        "operationId": "listFinanceReviews",
        "summary": "Read current actor-scoped TEST finance review history",
        "responses": {
          "200": {
            "description": "Current summaries and canStart gate; no recommendations on directory.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "agent": {
                      "type": "string",
                      "const": "finance_orchestrator"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "providerCallsAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "canStart": {
                      "type": "boolean"
                    },
                    "runs": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "runId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                              },
                              "state": {
                                "type": "string",
                                "const": "review_plan"
                              },
                              "blockedReason": {
                                "type": "null"
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            },
                            "required": [
                              "runId",
                              "state",
                              "blockedReason",
                              "createdAt"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "runId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                              },
                              "state": {
                                "type": "string",
                                "const": "blocked"
                              },
                              "blockedReason": {
                                "type": "string",
                                "enum": [
                                  "runtime_grant_changed",
                                  "runtime_paused",
                                  "actor_access_changed",
                                  "source_changed",
                                  "stale_evidence"
                                ]
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            },
                            "required": [
                              "runId",
                              "state",
                              "blockedReason",
                              "createdAt"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "nextCursor": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "agent",
                    "readOnly",
                    "executionAllowed",
                    "providerCallsAllowed",
                    "canStart",
                    "runs",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "finance_review_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "finance_review_source_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "finance_review_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "description": "Default-off TEST deterministic Finance Orchestrator human review. Current owner/finance_admin, finite agent grant and active policy; history/detail/original-key namespace are scoped to initiating actor. Complete bounded RepeatableRead source snapshot (20 invoices,40 specialist contexts) and current source/access/policy/grant/two-minute initial freshness rechecked. Immutable plan plus redacted audits commit atomically. Steps remain ordered and same-invoice version/hash/money pairs source-bound; null amounts remain unknown. Allocated invoice balances exclude unapplied receipts; existing allocations are explanations, sandbox acceptance is not inbox delivery, paid and accounting accepted are separate. No model, specialist dispatch, financial execution or provider calls. Unknown/concurrent409 retries retain original UUID, never create automatic replacement requests. Latest50 actor summaries; no full-history pagination promise.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
            }
          }
        ],
        "operationId": "prepareFinanceReview",
        "summary": "Prepare a durable read-only TEST invoice-to-cash review plan",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original-key replay with current revalidation; may be blocked with null result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "agent": {
                          "type": "string",
                          "const": "finance_orchestrator"
                        },
                        "readOnly": {
                          "type": "boolean",
                          "const": true
                        },
                        "executionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "providerCallsAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "const": "review_plan"
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "schemaVersion": {
                          "type": "string",
                          "const": "FINANCE_ORCHESTRATOR_L1_V1"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        },
                        "result": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "businessId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                },
                                "environment": {
                                  "type": "string",
                                  "const": "test"
                                },
                                "outcome": {
                                  "type": "string",
                                  "const": "review_plan"
                                },
                                "readAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "schemaVersion": {
                                  "type": "string",
                                  "const": "FINANCE_ORCHESTRATOR_L1_V1"
                                },
                                "goal": {
                                  "type": "string",
                                  "const": "invoice_to_cash_review"
                                },
                                "executionAllowed": {
                                  "type": "boolean",
                                  "const": false
                                },
                                "providerCallsAllowed": {
                                  "type": "boolean",
                                  "const": false
                                },
                                "reason": {
                                  "type": "string",
                                  "const": "supervised_review_required"
                                },
                                "recommendations": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 120,
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_tax_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "draft_calculation_unresolved"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_issue_approval"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "distinct_human_approval_required"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "verify_payment_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "authoritative_balance_unavailable"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "verify_accounting_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "accounting_read_unavailable"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_accounting_exception"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "accounting_context_requires_review"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_accounting_export"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "export_not_started",
                                              "export_not_verified"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "specialist_evidence_stale"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections",
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "paid_invoice_supersedes_collection"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "const": 0
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "collection_eligibility_not_confirmed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_payment_exception"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "unapplied_payment_requires_review"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_existing_allocation_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "existing_allocation_explanation_only"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_draft"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "reminder_draft_not_sent"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_run"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "collection_run_not_ready"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_existing_checkout"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_confirmation_incomplete"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_checkout_failure"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_failed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_delivery_status"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "email_submission_not_confirmed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_sandbox_delivery"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "sandbox_acceptance_is_not_inbox_delivery"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_invoice_delivery"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "invoice_email_not_submitted"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_eligibility"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "customer_or_collection_policy_blocks_reminder"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_preparation"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "overdue_balance_requires_supervised_draft"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_payment_progress"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_ready_is_not_payment",
                                              "balance_remains_outstanding"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_blocker"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "runtime_grant_changed",
                                              "runtime_paused",
                                              "actor_access_changed",
                                              "source_changed",
                                              "stale_evidence",
                                              "no_overdue_invoices",
                                              "gateway_unavailable",
                                              "gateway_invalid",
                                              "gateway_failed",
                                              "lease_expired",
                                              "specialist_not_available"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections",
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "businessId",
                                "environment",
                                "outcome",
                                "readAt",
                                "schemaVersion",
                                "goal",
                                "executionAllowed",
                                "providerCallsAllowed",
                                "reason",
                                "recommendations"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "businessId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                },
                                "environment": {
                                  "type": "string",
                                  "const": "test"
                                },
                                "outcome": {
                                  "type": "string",
                                  "const": "review_plan"
                                },
                                "readAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "schemaVersion": {
                                  "type": "string",
                                  "const": "FINANCE_ORCHESTRATOR_L1_V1"
                                },
                                "goal": {
                                  "type": "string",
                                  "const": "invoice_to_cash_review"
                                },
                                "executionAllowed": {
                                  "type": "boolean",
                                  "const": false
                                },
                                "providerCallsAllowed": {
                                  "type": "boolean",
                                  "const": false
                                },
                                "reason": {
                                  "type": "string",
                                  "const": "no_review_steps_from_current_evidence"
                                },
                                "recommendations": {
                                  "type": "array",
                                  "maxItems": 0,
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_tax_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "draft_calculation_unresolved"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_issue_approval"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "distinct_human_approval_required"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "verify_payment_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "authoritative_balance_unavailable"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "verify_accounting_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "accounting_read_unavailable"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_accounting_exception"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "accounting_context_requires_review"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_accounting_export"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "export_not_started",
                                              "export_not_verified"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "specialist_evidence_stale"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections",
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "paid_invoice_supersedes_collection"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "const": 0
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "collection_eligibility_not_confirmed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_payment_exception"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "unapplied_payment_requires_review"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_existing_allocation_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "existing_allocation_explanation_only"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_draft"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "reminder_draft_not_sent"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_run"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "collection_run_not_ready"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_existing_checkout"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_confirmation_incomplete"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_checkout_failure"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_failed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_delivery_status"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "email_submission_not_confirmed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_sandbox_delivery"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "sandbox_acceptance_is_not_inbox_delivery"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_invoice_delivery"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "invoice_email_not_submitted"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_eligibility"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "customer_or_collection_policy_blocks_reminder"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_preparation"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "overdue_balance_requires_supervised_draft"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_payment_progress"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_ready_is_not_payment",
                                              "balance_remains_outstanding"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_blocker"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "runtime_grant_changed",
                                              "runtime_paused",
                                              "actor_access_changed",
                                              "source_changed",
                                              "stale_evidence",
                                              "no_overdue_invoices",
                                              "gateway_unavailable",
                                              "gateway_invalid",
                                              "gateway_failed",
                                              "lease_expired",
                                              "specialist_not_available"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections",
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "businessId",
                                "environment",
                                "outcome",
                                "readAt",
                                "schemaVersion",
                                "goal",
                                "executionAllowed",
                                "providerCallsAllowed",
                                "reason",
                                "recommendations"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "agent",
                        "readOnly",
                        "executionAllowed",
                        "providerCallsAllowed",
                        "runId",
                        "state",
                        "blockedReason",
                        "createdAt",
                        "schemaVersion",
                        "replayed",
                        "result"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "agent": {
                          "type": "string",
                          "const": "finance_orchestrator"
                        },
                        "readOnly": {
                          "type": "boolean",
                          "const": true
                        },
                        "executionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "providerCallsAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "const": "blocked"
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "actor_access_changed",
                            "source_changed",
                            "stale_evidence"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "schemaVersion": {
                          "type": "string",
                          "const": "FINANCE_ORCHESTRATOR_L1_V1"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        },
                        "result": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "agent",
                        "readOnly",
                        "executionAllowed",
                        "providerCallsAllowed",
                        "runId",
                        "state",
                        "blockedReason",
                        "createdAt",
                        "schemaVersion",
                        "replayed",
                        "result"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "201": {
            "description": "New immutable actor-scoped read-only plan; not replayed or blocked.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "agent": {
                      "type": "string",
                      "const": "finance_orchestrator"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "providerCallsAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "runId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                    },
                    "state": {
                      "type": "string",
                      "const": "review_plan"
                    },
                    "blockedReason": {
                      "type": "null"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "schemaVersion": {
                      "type": "string",
                      "const": "FINANCE_ORCHESTRATOR_L1_V1"
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": false
                    },
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "businessId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                            },
                            "environment": {
                              "type": "string",
                              "const": "test"
                            },
                            "outcome": {
                              "type": "string",
                              "const": "review_plan"
                            },
                            "readAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "schemaVersion": {
                              "type": "string",
                              "const": "FINANCE_ORCHESTRATOR_L1_V1"
                            },
                            "goal": {
                              "type": "string",
                              "const": "invoice_to_cash_review"
                            },
                            "executionAllowed": {
                              "type": "boolean",
                              "const": false
                            },
                            "providerCallsAllowed": {
                              "type": "boolean",
                              "const": false
                            },
                            "reason": {
                              "type": "string",
                              "const": "supervised_review_required"
                            },
                            "recommendations": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 120,
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_tax_evidence"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "draft_calculation_unresolved"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "finance_orchestrator"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "null"
                                      },
                                      "outstandingMinor": {
                                        "type": "null"
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_issue_approval"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "distinct_human_approval_required"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "finance_orchestrator"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "null"
                                      },
                                      "outstandingMinor": {
                                        "type": "null"
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "verify_payment_evidence"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "authoritative_balance_unavailable"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "finance_orchestrator"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "null"
                                      },
                                      "outstandingMinor": {
                                        "type": "null"
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "verify_accounting_evidence"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "accounting_read_unavailable"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "accounting"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_accounting_exception"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "accounting_context_requires_review"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "accounting"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_accounting_export"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "export_not_started",
                                          "export_not_verified"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "accounting"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_specialist_context"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "specialist_evidence_stale"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections",
                                          "reconciliation"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_specialist_context"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "paid_invoice_supersedes_collection"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "const": 0
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_specialist_context"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "collection_eligibility_not_confirmed"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_payment_exception"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "unapplied_payment_requires_review"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "reconciliation"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_existing_allocation_evidence"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "existing_allocation_explanation_only"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "reconciliation"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_collection_draft"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "reminder_draft_not_sent"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_collection_run"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "collection_run_not_ready"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_existing_checkout"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "checkout_confirmation_incomplete"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "payments"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_checkout_failure"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "checkout_failed"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "payments"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_delivery_status"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "email_submission_not_confirmed"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "delivery"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_sandbox_delivery"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "sandbox_acceptance_is_not_inbox_delivery"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "delivery"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_invoice_delivery"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "invoice_email_not_submitted"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "delivery"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_collection_eligibility"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "customer_or_collection_policy_blocks_reminder"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_collection_preparation"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "overdue_balance_requires_supervised_draft"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_payment_progress"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "checkout_ready_is_not_payment",
                                          "balance_remains_outstanding"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "payments"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_specialist_blocker"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "runtime_grant_changed",
                                          "runtime_paused",
                                          "actor_access_changed",
                                          "source_changed",
                                          "stale_evidence",
                                          "no_overdue_invoices",
                                          "gateway_unavailable",
                                          "gateway_invalid",
                                          "gateway_failed",
                                          "lease_expired",
                                          "specialist_not_available"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections",
                                          "reconciliation"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            }
                          },
                          "required": [
                            "businessId",
                            "environment",
                            "outcome",
                            "readAt",
                            "schemaVersion",
                            "goal",
                            "executionAllowed",
                            "providerCallsAllowed",
                            "reason",
                            "recommendations"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "businessId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                            },
                            "environment": {
                              "type": "string",
                              "const": "test"
                            },
                            "outcome": {
                              "type": "string",
                              "const": "review_plan"
                            },
                            "readAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "schemaVersion": {
                              "type": "string",
                              "const": "FINANCE_ORCHESTRATOR_L1_V1"
                            },
                            "goal": {
                              "type": "string",
                              "const": "invoice_to_cash_review"
                            },
                            "executionAllowed": {
                              "type": "boolean",
                              "const": false
                            },
                            "providerCallsAllowed": {
                              "type": "boolean",
                              "const": false
                            },
                            "reason": {
                              "type": "string",
                              "const": "no_review_steps_from_current_evidence"
                            },
                            "recommendations": {
                              "type": "array",
                              "maxItems": 0,
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_tax_evidence"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "draft_calculation_unresolved"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "finance_orchestrator"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "null"
                                      },
                                      "outstandingMinor": {
                                        "type": "null"
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_issue_approval"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "distinct_human_approval_required"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "finance_orchestrator"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "null"
                                      },
                                      "outstandingMinor": {
                                        "type": "null"
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "verify_payment_evidence"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "authoritative_balance_unavailable"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "finance_orchestrator"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "null"
                                      },
                                      "outstandingMinor": {
                                        "type": "null"
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "verify_accounting_evidence"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "accounting_read_unavailable"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "accounting"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_accounting_exception"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "accounting_context_requires_review"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "accounting"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_accounting_export"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "export_not_started",
                                          "export_not_verified"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "accounting"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_specialist_context"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "specialist_evidence_stale"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections",
                                          "reconciliation"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_specialist_context"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "paid_invoice_supersedes_collection"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "const": 0
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_specialist_context"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "collection_eligibility_not_confirmed"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_payment_exception"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "unapplied_payment_requires_review"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "reconciliation"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_existing_allocation_evidence"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "existing_allocation_explanation_only"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "reconciliation"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_collection_draft"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "reminder_draft_not_sent"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_collection_run"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "collection_run_not_ready"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_existing_checkout"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "checkout_confirmation_incomplete"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "payments"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_checkout_failure"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "checkout_failed"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "payments"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_delivery_status"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "email_submission_not_confirmed"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "delivery"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_sandbox_delivery"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "sandbox_acceptance_is_not_inbox_delivery"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "delivery"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_invoice_delivery"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "invoice_email_not_submitted"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "delivery"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_collection_eligibility"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "customer_or_collection_policy_blocks_reminder"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_collection_preparation"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "overdue_balance_requires_supervised_draft"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_payment_progress"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "checkout_ready_is_not_payment",
                                          "balance_remains_outstanding"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "payments"
                                        ]
                                      },
                                      "runId": {
                                        "type": "null"
                                      },
                                      "runSourceHash": {
                                        "type": "null"
                                      },
                                      "confirmedAllocatedMinor": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 99999999
                                      },
                                      "outstandingMinor": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 99999999
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "order": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                      },
                                      "invoiceId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "invoiceVersion": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 2147483647
                                      },
                                      "invoiceSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "code": {
                                        "type": "string",
                                        "const": "review_specialist_blocker"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "runtime_grant_changed",
                                          "runtime_paused",
                                          "actor_access_changed",
                                          "source_changed",
                                          "stale_evidence",
                                          "no_overdue_invoices",
                                          "gateway_unavailable",
                                          "gateway_invalid",
                                          "gateway_failed",
                                          "lease_expired",
                                          "specialist_not_available"
                                        ]
                                      },
                                      "specialist": {
                                        "type": "string",
                                        "enum": [
                                          "collections",
                                          "reconciliation"
                                        ]
                                      },
                                      "runId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                      },
                                      "runSourceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "confirmedAllocatedMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "outstandingMinor": {
                                        "oneOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "evidenceHash": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$",
                                        "minLength": 64,
                                        "maxLength": 64
                                      },
                                      "executionAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      },
                                      "providerCallsAllowed": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "order",
                                      "invoiceId",
                                      "invoiceVersion",
                                      "invoiceSourceHash",
                                      "code",
                                      "reason",
                                      "specialist",
                                      "runId",
                                      "runSourceHash",
                                      "confirmedAllocatedMinor",
                                      "outstandingMinor",
                                      "evidenceHash",
                                      "executionAllowed",
                                      "providerCallsAllowed"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            }
                          },
                          "required": [
                            "businessId",
                            "environment",
                            "outcome",
                            "readAt",
                            "schemaVersion",
                            "goal",
                            "executionAllowed",
                            "providerCallsAllowed",
                            "reason",
                            "recommendations"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "agent",
                    "readOnly",
                    "executionAllowed",
                    "providerCallsAllowed",
                    "runId",
                    "state",
                    "blockedReason",
                    "createdAt",
                    "schemaVersion",
                    "replayed",
                    "result"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "finance_review_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "finance_review_source_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "finance_review_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/finance-reviews/{runId}": {
      "get": {
        "description": "Default-off TEST deterministic Finance Orchestrator human review. Current owner/finance_admin, finite agent grant and active policy; history/detail/original-key namespace are scoped to initiating actor. Complete bounded RepeatableRead source snapshot (20 invoices,40 specialist contexts) and current source/access/policy/grant/two-minute initial freshness rechecked. Immutable plan plus redacted audits commit atomically. Steps remain ordered and same-invoice version/hash/money pairs source-bound; null amounts remain unknown. Allocated invoice balances exclude unapplied receipts; existing allocations are explanations, sandbox acceptance is not inbox delivery, paid and accounting accepted are separate. No model, specialist dispatch, financial execution or provider calls. Unknown/concurrent409 retries retain original UUID, never create automatic replacement requests. Latest50 actor summaries; no full-history pagination promise.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
            }
          }
        ],
        "operationId": "getFinanceReview",
        "summary": "Read one actor-scoped currently revalidated TEST finance review",
        "responses": {
          "200": {
            "description": "Current plan or blocked with null recommendations.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "agent": {
                          "type": "string",
                          "const": "finance_orchestrator"
                        },
                        "readOnly": {
                          "type": "boolean",
                          "const": true
                        },
                        "executionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "providerCallsAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "const": "review_plan"
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "schemaVersion": {
                          "type": "string",
                          "const": "FINANCE_ORCHESTRATOR_L1_V1"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        },
                        "result": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "businessId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                },
                                "environment": {
                                  "type": "string",
                                  "const": "test"
                                },
                                "outcome": {
                                  "type": "string",
                                  "const": "review_plan"
                                },
                                "readAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "schemaVersion": {
                                  "type": "string",
                                  "const": "FINANCE_ORCHESTRATOR_L1_V1"
                                },
                                "goal": {
                                  "type": "string",
                                  "const": "invoice_to_cash_review"
                                },
                                "executionAllowed": {
                                  "type": "boolean",
                                  "const": false
                                },
                                "providerCallsAllowed": {
                                  "type": "boolean",
                                  "const": false
                                },
                                "reason": {
                                  "type": "string",
                                  "const": "supervised_review_required"
                                },
                                "recommendations": {
                                  "type": "array",
                                  "minItems": 1,
                                  "maxItems": 120,
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_tax_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "draft_calculation_unresolved"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_issue_approval"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "distinct_human_approval_required"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "verify_payment_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "authoritative_balance_unavailable"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "verify_accounting_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "accounting_read_unavailable"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_accounting_exception"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "accounting_context_requires_review"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_accounting_export"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "export_not_started",
                                              "export_not_verified"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "specialist_evidence_stale"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections",
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "paid_invoice_supersedes_collection"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "const": 0
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "collection_eligibility_not_confirmed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_payment_exception"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "unapplied_payment_requires_review"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_existing_allocation_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "existing_allocation_explanation_only"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_draft"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "reminder_draft_not_sent"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_run"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "collection_run_not_ready"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_existing_checkout"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_confirmation_incomplete"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_checkout_failure"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_failed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_delivery_status"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "email_submission_not_confirmed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_sandbox_delivery"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "sandbox_acceptance_is_not_inbox_delivery"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_invoice_delivery"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "invoice_email_not_submitted"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_eligibility"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "customer_or_collection_policy_blocks_reminder"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_preparation"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "overdue_balance_requires_supervised_draft"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_payment_progress"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_ready_is_not_payment",
                                              "balance_remains_outstanding"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_blocker"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "runtime_grant_changed",
                                              "runtime_paused",
                                              "actor_access_changed",
                                              "source_changed",
                                              "stale_evidence",
                                              "no_overdue_invoices",
                                              "gateway_unavailable",
                                              "gateway_invalid",
                                              "gateway_failed",
                                              "lease_expired",
                                              "specialist_not_available"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections",
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "businessId",
                                "environment",
                                "outcome",
                                "readAt",
                                "schemaVersion",
                                "goal",
                                "executionAllowed",
                                "providerCallsAllowed",
                                "reason",
                                "recommendations"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "businessId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                },
                                "environment": {
                                  "type": "string",
                                  "const": "test"
                                },
                                "outcome": {
                                  "type": "string",
                                  "const": "review_plan"
                                },
                                "readAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "schemaVersion": {
                                  "type": "string",
                                  "const": "FINANCE_ORCHESTRATOR_L1_V1"
                                },
                                "goal": {
                                  "type": "string",
                                  "const": "invoice_to_cash_review"
                                },
                                "executionAllowed": {
                                  "type": "boolean",
                                  "const": false
                                },
                                "providerCallsAllowed": {
                                  "type": "boolean",
                                  "const": false
                                },
                                "reason": {
                                  "type": "string",
                                  "const": "no_review_steps_from_current_evidence"
                                },
                                "recommendations": {
                                  "type": "array",
                                  "maxItems": 0,
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_tax_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "draft_calculation_unresolved"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_issue_approval"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "distinct_human_approval_required"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "verify_payment_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "authoritative_balance_unavailable"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "finance_orchestrator"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "null"
                                          },
                                          "outstandingMinor": {
                                            "type": "null"
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "verify_accounting_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "accounting_read_unavailable"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_accounting_exception"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "accounting_context_requires_review"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_accounting_export"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "export_not_started",
                                              "export_not_verified"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "accounting"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "specialist_evidence_stale"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections",
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "paid_invoice_supersedes_collection"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "const": 0
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_context"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "collection_eligibility_not_confirmed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_payment_exception"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "unapplied_payment_requires_review"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_existing_allocation_evidence"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "existing_allocation_explanation_only"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_draft"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "reminder_draft_not_sent"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_run"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "collection_run_not_ready"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_existing_checkout"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_confirmation_incomplete"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_checkout_failure"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_failed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_delivery_status"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "email_submission_not_confirmed"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_sandbox_delivery"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "sandbox_acceptance_is_not_inbox_delivery"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_invoice_delivery"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "invoice_email_not_submitted"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "delivery"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_eligibility"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "customer_or_collection_policy_blocks_reminder"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_collection_preparation"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "overdue_balance_requires_supervised_draft"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_payment_progress"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "checkout_ready_is_not_payment",
                                              "balance_remains_outstanding"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "payments"
                                            ]
                                          },
                                          "runId": {
                                            "type": "null"
                                          },
                                          "runSourceHash": {
                                            "type": "null"
                                          },
                                          "confirmedAllocatedMinor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 99999999
                                          },
                                          "outstandingMinor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 99999999
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "order": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 120
                                          },
                                          "invoiceId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "invoiceVersion": {
                                            "type": "integer",
                                            "minimum": 2,
                                            "maximum": 2147483647
                                          },
                                          "invoiceSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "code": {
                                            "type": "string",
                                            "const": "review_specialist_blocker"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "runtime_grant_changed",
                                              "runtime_paused",
                                              "actor_access_changed",
                                              "source_changed",
                                              "stale_evidence",
                                              "no_overdue_invoices",
                                              "gateway_unavailable",
                                              "gateway_invalid",
                                              "gateway_failed",
                                              "lease_expired",
                                              "specialist_not_available"
                                            ]
                                          },
                                          "specialist": {
                                            "type": "string",
                                            "enum": [
                                              "collections",
                                              "reconciliation"
                                            ]
                                          },
                                          "runId": {
                                            "type": "string",
                                            "format": "uuid",
                                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                                          },
                                          "runSourceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "confirmedAllocatedMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "outstandingMinor": {
                                            "oneOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 99999999
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "evidenceHash": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$",
                                            "minLength": 64,
                                            "maxLength": 64
                                          },
                                          "executionAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          },
                                          "providerCallsAllowed": {
                                            "type": "boolean",
                                            "const": false
                                          }
                                        },
                                        "required": [
                                          "order",
                                          "invoiceId",
                                          "invoiceVersion",
                                          "invoiceSourceHash",
                                          "code",
                                          "reason",
                                          "specialist",
                                          "runId",
                                          "runSourceHash",
                                          "confirmedAllocatedMinor",
                                          "outstandingMinor",
                                          "evidenceHash",
                                          "executionAllowed",
                                          "providerCallsAllowed"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "businessId",
                                "environment",
                                "outcome",
                                "readAt",
                                "schemaVersion",
                                "goal",
                                "executionAllowed",
                                "providerCallsAllowed",
                                "reason",
                                "recommendations"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "agent",
                        "readOnly",
                        "executionAllowed",
                        "providerCallsAllowed",
                        "runId",
                        "state",
                        "blockedReason",
                        "createdAt",
                        "schemaVersion",
                        "replayed",
                        "result"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "agent": {
                          "type": "string",
                          "const": "finance_orchestrator"
                        },
                        "readOnly": {
                          "type": "boolean",
                          "const": true
                        },
                        "executionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "providerCallsAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "const": "blocked"
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "actor_access_changed",
                            "source_changed",
                            "stale_evidence"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "schemaVersion": {
                          "type": "string",
                          "const": "FINANCE_ORCHESTRATOR_L1_V1"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        },
                        "result": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "agent",
                        "readOnly",
                        "executionAllowed",
                        "providerCallsAllowed",
                        "runId",
                        "state",
                        "blockedReason",
                        "createdAt",
                        "schemaVersion",
                        "replayed",
                        "result"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "finance_review_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "finance_review_source_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no retained private evidence or financial outcome.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "finance_review_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/partner/businesses/{businessId}/invoices": {
      "get": {
        "operationId": "listPartnerTestIssuedInvoices",
        "summary": "Minimal current delegated TEST issued invoice page",
        "description": "Default-off operator-provisioned foundation, separate machine authentication and DB principal. Each attempt is rate limited; canonical client/business/link/grant/resource usage and machine audit commit atomically before release. No request body, human JWT substitution, public MFA consent, PII/PDF/pay links/provider identifiers, financial writes or live access.",
        "security": [
          {
            "PartnerTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Canonical integer 1-100, default50; repeated/unknown query fields denied",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "description": "Exclusive lowercase nonzero UUID keyset cursor",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current TEST machine read; issued amounts only, no payment/accounting completion claim",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "PARTNER_INVOICE_READ_V1"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "invoices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                          },
                          "issuedVersion": {
                            "type": "integer",
                            "minimum": 2
                          },
                          "currency": {
                            "type": "string",
                            "const": "GBP"
                          },
                          "netMinor": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,10}|100000000000)(?![\\s\\S])",
                            "maxLength": 12
                          },
                          "vatMinor": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,10}|100000000000)(?![\\s\\S])",
                            "maxLength": 12
                          },
                          "grossMinor": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,10}|100000000000)(?![\\s\\S])",
                            "maxLength": 12
                          },
                          "issuedOn": {
                            "type": "string",
                            "format": "date"
                          },
                          "dueOn": {
                            "type": "string",
                            "format": "date"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "issuedVersion",
                          "currency",
                          "netMinor",
                          "vatMinor",
                          "grossMinor",
                          "issuedOn",
                          "dueOn"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 100
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "usageDecision": {
                      "type": "string",
                      "enum": [
                        "first_attempt",
                        "existing_attempt"
                      ]
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "businessId",
                    "environment",
                    "readOnly",
                    "invoices",
                    "nextCursor",
                    "usageDecision"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_read_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_rate_limit",
                        "partner_usage_limit"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_read_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/partner/businesses/{businessId}/invoices/{invoiceId}": {
      "get": {
        "operationId": "getPartnerTestIssuedInvoice",
        "summary": "Minimal current delegated TEST issued invoice read",
        "description": "Default-off operator-provisioned foundation, separate machine authentication and DB principal. Each attempt is rate limited; canonical client/business/link/grant/resource usage and machine audit commit atomically before release. No request body, human JWT substitution, public MFA consent, PII/PDF/pay links/provider identifiers, financial writes or live access.",
        "security": [
          {
            "PartnerTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current TEST machine read; issued amounts only, no payment/accounting completion claim",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "PARTNER_INVOICE_READ_V1"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "invoices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                          },
                          "issuedVersion": {
                            "type": "integer",
                            "minimum": 2
                          },
                          "currency": {
                            "type": "string",
                            "const": "GBP"
                          },
                          "netMinor": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,10}|100000000000)(?![\\s\\S])",
                            "maxLength": 12
                          },
                          "vatMinor": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,10}|100000000000)(?![\\s\\S])",
                            "maxLength": 12
                          },
                          "grossMinor": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,10}|100000000000)(?![\\s\\S])",
                            "maxLength": 12
                          },
                          "issuedOn": {
                            "type": "string",
                            "format": "date"
                          },
                          "dueOn": {
                            "type": "string",
                            "format": "date"
                          }
                        },
                        "required": [
                          "invoiceId",
                          "issuedVersion",
                          "currency",
                          "netMinor",
                          "vatMinor",
                          "grossMinor",
                          "issuedOn",
                          "dueOn"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 1,
                      "minItems": 1
                    },
                    "nextCursor": {
                      "type": "null"
                    },
                    "usageDecision": {
                      "type": "string",
                      "enum": [
                        "first_attempt",
                        "existing_attempt"
                      ]
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "businessId",
                    "environment",
                    "readOnly",
                    "invoices",
                    "nextCursor",
                    "usageDecision"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_read_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_rate_limit",
                        "partner_usage_limit"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed machine read denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_read_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/documents/expired-reservations": {
      "get": {
        "operationId": "previewExpiredDocumentReservations",
        "summary": "Read eligible expired TEST upload reservations",
        "description": "Manual TEST only; both Documents:Enabled and default-off Documents:CleanupEnabled plus current genuine owner session/membership, finite DOC business grant and separate finite actor/business cleanup grant. Recheck current authority before completion; preview and release also recheck after the shared business quota lock. No stored-file deletion, scanning, extraction, provider/model/financial action or worker. Expiration alone does not release quota. Original metadata/keys/reviews/body and audit remain; retained intake history is capped at100, active reservations at20/10MiB. Released awaiting_upload/version1 metadata is not a fabricated new document state. Read projection contains no filenames, review reasons or session identifiers. Current eligible page and separate active quota versus retained history; not an upload or deletion permission. No body; only the documented query parameters, each once, with canonical spelling.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 10
            },
            "required": false
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Current eligible page and separate active quota versus retained history; not an upload or deletion permission.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "reservations": {
                      "type": "array",
                      "maxItems": 10,
                      "items": {
                        "type": "object",
                        "properties": {
                          "documentId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "expectedVersion": {
                            "type": "integer",
                            "const": 1
                          },
                          "sha256": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{64}$"
                          },
                          "byteLength": {
                            "type": "integer",
                            "minimum": 8,
                            "maximum": 1048576
                          },
                          "expiredAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "documentId",
                          "expectedVersion",
                          "sha256",
                          "byteLength",
                          "expiredAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "quota": {
                      "type": "object",
                      "properties": {
                        "activeReservationCount": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "activeReservedBytes": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "maximumReservationCount": {
                          "type": "integer",
                          "const": 20
                        },
                        "maximumReservedBytes": {
                          "type": "integer",
                          "const": 10485760
                        },
                        "retainedIntakeCount": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "maximumRetainedIntakes": {
                          "type": "integer",
                          "const": 100
                        }
                      },
                      "required": [
                        "activeReservationCount",
                        "activeReservedBytes",
                        "maximumReservationCount",
                        "maximumReservedBytes",
                        "retainedIntakeCount",
                        "maximumRetainedIntakes"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "reservations",
                    "nextCursor",
                    "quota"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_release_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_release_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_version_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_release_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/documents/reservation-releases": {
      "post": {
        "operationId": "releaseExpiredDocumentReservations",
        "summary": "Release declared quota of never-uploaded expired TEST reservations",
        "description": "Manual TEST only; both Documents:Enabled and default-off Documents:CleanupEnabled plus current genuine owner session/membership, finite DOC business grant and separate finite actor/business cleanup grant. Recheck current authority before completion; preview and release also recheck after the shared business quota lock. No stored-file deletion, scanning, extraction, provider/model/financial action or worker. Expiration alone does not release quota. Original metadata/keys/reviews/body and audit remain; retained intake history is capped at100, active reservations at20/10MiB. Released awaiting_upload/version1 metadata is not a fabricated new document state. Read projection contains no filenames, review reasons or session identifiers. Committed original receipt; storedBodyBytesDeleted is always0. Current authorized same-key/session/body/grant-revision replay returns the same receipt, replayed=true. Exact application/json body capped at4096 bytes;1..10 unique canonical targets, expectedVersion exactly1, lowercase SHA256. No query or Tallylane-If-Version/If-Match; retain original key/body on uncertainty. Mixed invalid targets roll back the entire batch.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Committed original receipt; storedBodyBytesDeleted is always0. Current authorized same-key/session/body/grant-revision replay returns the same receipt, replayed=true.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "receipt": {
                      "type": "object",
                      "properties": {
                        "receiptId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "requestKey": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "releasedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "documentIds": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 10,
                          "items": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          }
                        },
                        "reservationCount": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10
                        },
                        "reservedBytesReleased": {
                          "type": "integer",
                          "minimum": 8,
                          "maximum": 10485760
                        },
                        "storedBodyBytesDeleted": {
                          "type": "integer",
                          "const": 0
                        }
                      },
                      "required": [
                        "receiptId",
                        "requestKey",
                        "releasedAt",
                        "documentIds",
                        "reservationCount",
                        "reservedBytesReleased",
                        "storedBodyBytesDeleted"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "receipt",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_release_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_release_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_version_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_release_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reservations": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "documentId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "expectedVersion": {
                          "type": "integer",
                          "const": 1
                        },
                        "sha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        }
                      },
                      "required": [
                        "documentId",
                        "expectedVersion",
                        "sha256"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "reservations"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/documents/reservation-releases/{receiptId}": {
      "get": {
        "operationId": "readDocumentReservationRelease",
        "summary": "Read a retained TEST reservation-release receipt",
        "description": "Manual TEST only; both Documents:Enabled and default-off Documents:CleanupEnabled plus current genuine owner session/membership, finite DOC business grant and separate finite actor/business cleanup grant. Recheck current authority before completion; preview and release also recheck after the shared business quota lock. No stored-file deletion, scanning, extraction, provider/model/financial action or worker. Expiration alone does not release quota. Original metadata/keys/reviews/body and audit remain; retained intake history is capped at100, active reservations at20/10MiB. Released awaiting_upload/version1 metadata is not a fabricated new document state. Read projection contains no filenames, review reasons or session identifiers. Historical same-business receipt under fresh explicitly granted owner authority. Its released quota is a historical amount, not current free capacity. No body; only the documented query parameters, each once, with canonical spelling.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "receiptId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Historical same-business receipt under fresh explicitly granted owner authority. Its released quota is a historical amount, not current free capacity.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "receipt": {
                      "type": "object",
                      "properties": {
                        "receiptId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "requestKey": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "releasedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "documentIds": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 10,
                          "items": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          }
                        },
                        "reservationCount": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10
                        },
                        "reservedBytesReleased": {
                          "type": "integer",
                          "minimum": 8,
                          "maximum": 10485760
                        },
                        "storedBodyBytesDeleted": {
                          "type": "integer",
                          "const": 0
                        }
                      },
                      "required": [
                        "receiptId",
                        "requestKey",
                        "releasedAt",
                        "documentIds",
                        "reservationCount",
                        "reservedBytesReleased",
                        "storedBodyBytesDeleted"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "receipt",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_release_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_release_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_version_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private content or provider details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "document_release_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/members": {
      "get": {
        "operationId": "listManagedBusinessMembers",
        "summary": "Read current existing TEST members",
        "description": "Default-off Memberships:ManagementEnabled and Platform:Environment=test; genuine current owner/session/business and separate finite actor/business TEST grant are checked before replay and at completion. Existing members only. Other-member management; no invitations, user creation, self role/revoke, atomic ownership transfer, restore or provider call. Last eligible active owner counts current canonical platform/provider users. Commands serialize by business before actor membership locks; role/status changes bump PostgreSQL-managed version and immutable receipt/common audit atomically. Failed audit rolls back. Original session/grant revision/key/body binding survives uncertainty; current revocation denies replay. Successful receipt contains historical snapshot, separate from freshly read directory. No personal names/emails/provider metadata or cross-business rows. Canonical limit1..50/default20 and optional lowercase nonzero UUID cursor; each query once; no body/Range/If-Match. Ascending keyset including active and revoked memberships. No single directory version header.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            },
            "required": false
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped directory.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "members": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "properties": {
                          "membershipId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "finance_admin",
                              "finance_operator",
                              "approver",
                              "bookkeeper",
                              "viewer"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "revoked"
                            ]
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          }
                        },
                        "required": [
                          "membershipId",
                          "userId",
                          "role",
                          "status",
                          "version"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "members",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "membership_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "membership_management_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/members/{membershipId}/change-role": {
      "post": {
        "operationId": "changeExistingTestMemberRole",
        "summary": "Change another existing TEST member role",
        "description": "Default-off Memberships:ManagementEnabled and Platform:Environment=test; genuine current owner/session/business and separate finite actor/business TEST grant are checked before replay and at completion. Existing members only. Other-member management; no invitations, user creation, self role/revoke, atomic ownership transfer, restore or provider call. Last eligible active owner counts current canonical platform/provider users. Commands serialize by business before actor membership locks; role/status changes bump PostgreSQL-managed version and immutable receipt/common audit atomically. Failed audit rolls back. Original session/grant revision/key/body binding survives uncertainty; current revocation denies replay. Successful receipt contains historical snapshot, separate from freshly read directory. No personal names/emails/provider metadata or cross-business rows. Exactly application/json with no charset, query or Range/If-Match. Closed no-escape/no-duplicate object; streaming body<=1024bytes. Same-role no-op, inactive or ineligible promotion conflict; stale version412. Replayed POST returns original receipt with replayed=true; no current state inferred.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "membershipId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]{0,9}\"$",
              "description": "Exactly quoted canonical positive Int32. Unquoted, weak, zero, leading-zero, overflow, multiple or mixed If-Match yields428."
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable historical receipt under fresh current owner authority.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]{0,9}\"$"
                },
                "description": "Quoted canonical positive Int32 from the historical memberSnapshot.version; not fresh directory authority."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "receipt": {
                      "type": "object",
                      "properties": {
                        "receiptId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "requestKey": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "membership.role_changed",
                            "membership.revoked"
                          ]
                        },
                        "previousRole": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "finance_admin",
                            "finance_operator",
                            "approver",
                            "bookkeeper",
                            "viewer"
                          ]
                        },
                        "previousStatus": {
                          "type": "string",
                          "const": "active"
                        },
                        "previousVersion": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483646
                        },
                        "memberSnapshot": {
                          "type": "object",
                          "properties": {
                            "membershipId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "userId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "owner",
                                "finance_admin",
                                "finance_operator",
                                "approver",
                                "bookkeeper",
                                "viewer"
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "revoked"
                              ]
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            }
                          },
                          "required": [
                            "membershipId",
                            "userId",
                            "role",
                            "status",
                            "version"
                          ],
                          "additionalProperties": false
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "receiptId",
                        "requestKey",
                        "action",
                        "previousRole",
                        "previousStatus",
                        "previousVersion",
                        "memberSnapshot",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "receipt",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "membership_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "membership_self_change_denied",
                        "last_owner_required",
                        "membership_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "membership_version_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "version_required"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "membership_management_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "finance_admin",
                      "finance_operator",
                      "approver",
                      "bookkeeper",
                      "viewer"
                    ]
                  }
                },
                "required": [
                  "role"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/members/{membershipId}/revoke": {
      "post": {
        "operationId": "revokeExistingTestMember",
        "summary": "Revoke another existing TEST membership",
        "description": "Default-off Memberships:ManagementEnabled and Platform:Environment=test; genuine current owner/session/business and separate finite actor/business TEST grant are checked before replay and at completion. Existing members only. Other-member management; no invitations, user creation, self role/revoke, atomic ownership transfer, restore or provider call. Last eligible active owner counts current canonical platform/provider users. Commands serialize by business before actor membership locks; role/status changes bump PostgreSQL-managed version and immutable receipt/common audit atomically. Failed audit rolls back. Original session/grant revision/key/body binding survives uncertainty; current revocation denies replay. Successful receipt contains historical snapshot, separate from freshly read directory. No personal names/emails/provider metadata or cross-business rows. Exactly application/json with no charset, query or Range/If-Match. Closed no-escape/no-duplicate object; streaming body<=1024bytes. Same-role no-op, inactive or ineligible promotion conflict; stale version412. Replayed POST returns original receipt with replayed=true; no current state inferred.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "membershipId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]{0,9}\"$",
              "description": "Exactly quoted canonical positive Int32. Unquoted, weak, zero, leading-zero, overflow, multiple or mixed If-Match yields428."
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable historical receipt under fresh current owner authority.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]{0,9}\"$"
                },
                "description": "Quoted canonical positive Int32 from the historical memberSnapshot.version; not fresh directory authority."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "receipt": {
                      "type": "object",
                      "properties": {
                        "receiptId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "requestKey": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "membership.role_changed",
                            "membership.revoked"
                          ]
                        },
                        "previousRole": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "finance_admin",
                            "finance_operator",
                            "approver",
                            "bookkeeper",
                            "viewer"
                          ]
                        },
                        "previousStatus": {
                          "type": "string",
                          "const": "active"
                        },
                        "previousVersion": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483646
                        },
                        "memberSnapshot": {
                          "type": "object",
                          "properties": {
                            "membershipId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "userId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "owner",
                                "finance_admin",
                                "finance_operator",
                                "approver",
                                "bookkeeper",
                                "viewer"
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "revoked"
                              ]
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            }
                          },
                          "required": [
                            "membershipId",
                            "userId",
                            "role",
                            "status",
                            "version"
                          ],
                          "additionalProperties": false
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "receiptId",
                        "requestKey",
                        "action",
                        "previousRole",
                        "previousStatus",
                        "previousVersion",
                        "memberSnapshot",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "receipt",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "membership_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "membership_self_change_denied",
                        "last_owner_required",
                        "membership_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "membership_version_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "version_required"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "membership_management_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/member-change-receipts/{receiptId}": {
      "get": {
        "operationId": "readTestMemberChangeReceipt",
        "summary": "Read retained TEST member-change receipt",
        "description": "Default-off Memberships:ManagementEnabled and Platform:Environment=test; genuine current owner/session/business and separate finite actor/business TEST grant are checked before replay and at completion. Existing members only. Other-member management; no invitations, user creation, self role/revoke, atomic ownership transfer, restore or provider call. Last eligible active owner counts current canonical platform/provider users. Commands serialize by business before actor membership locks; role/status changes bump PostgreSQL-managed version and immutable receipt/common audit atomically. Failed audit rolls back. Original session/grant revision/key/body binding survives uncertainty; current revocation denies replay. Successful receipt contains historical snapshot, separate from freshly read directory. No personal names/emails/provider metadata or cross-business rows. No query/body/Range/If-Match. A fresh granted owner may read a historical same-business receipt; replayed=false. Quoted version describes that old snapshot, never current membership authority.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          },
          {
            "name": "receiptId",
            "in": "path",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Immutable historical receipt under fresh current owner authority.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]{0,9}\"$"
                },
                "description": "Quoted canonical positive Int32 from the historical memberSnapshot.version; not fresh directory authority."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "receipt": {
                      "type": "object",
                      "properties": {
                        "receiptId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "requestKey": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "membership.role_changed",
                            "membership.revoked"
                          ]
                        },
                        "previousRole": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "finance_admin",
                            "finance_operator",
                            "approver",
                            "bookkeeper",
                            "viewer"
                          ]
                        },
                        "previousStatus": {
                          "type": "string",
                          "const": "active"
                        },
                        "previousVersion": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483646
                        },
                        "memberSnapshot": {
                          "type": "object",
                          "properties": {
                            "membershipId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "userId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "owner",
                                "finance_admin",
                                "finance_operator",
                                "approver",
                                "bookkeeper",
                                "viewer"
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "revoked"
                              ]
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            }
                          },
                          "required": [
                            "membershipId",
                            "userId",
                            "role",
                            "status",
                            "version"
                          ],
                          "additionalProperties": false
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "receiptId",
                        "requestKey",
                        "action",
                        "previousRole",
                        "previousStatus",
                        "previousVersion",
                        "memberSnapshot",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "receipt",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "membership_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error without private data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "membership_management_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/agent-runs/{runId}/reviews": {
      "get": {
        "description": "TEST human review evidence only. Current signed human identity, session, business membership and Agents:Enabled are required. Source evidence, finite grant, originating and historical reviewer authority, policy and exact proposal hashes are rechecked. A receipt remains historical after source or authority drift. The run remains needs_review; no reminder, invoice, payment, accounting or specialist dispatch is authorized. No query, If-Match or Range; GET has no body. Current authority precedes original-key replay.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "operationId": "getCollectionsHumanReviews",
        "summary": "Read current Collections recommendation review evidence",
        "responses": {
          "200": {
            "description": "Current source checks and immutable human receipts; receipt does not grant execution.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "runId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "canReview": {
                      "type": "boolean"
                    },
                    "blockedReason": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "sourceHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$",
                            "minLength": 64,
                            "maxLength": 64
                          },
                          "proposalHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$",
                            "minLength": 64,
                            "maxLength": 64
                          },
                          "sourceCurrent": {
                            "type": "boolean"
                          },
                          "canReview": {
                            "type": "boolean"
                          },
                          "blockedReason": {
                            "oneOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "runtime_grant_changed",
                                  "runtime_paused",
                                  "run_not_reviewable",
                                  "actor_access_changed",
                                  "source_changed",
                                  "reviewer_access_changed",
                                  "review_expired"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "receipt": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "decisionId": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  "decision": {
                                    "type": "string",
                                    "enum": [
                                      "approved",
                                      "rejected"
                                    ]
                                  },
                                  "reviewerRole": {
                                    "type": "string",
                                    "enum": [
                                      "owner",
                                      "finance_admin"
                                    ]
                                  },
                                  "reviewedAt": {
                                    "type": "string",
                                    "format": "date-time",
                                    "maxLength": 40
                                  },
                                  "expiresAt": {
                                    "type": "string",
                                    "format": "date-time",
                                    "maxLength": 40
                                  }
                                },
                                "required": [
                                  "decisionId",
                                  "decision",
                                  "reviewerRole",
                                  "reviewedAt",
                                  "expiresAt"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "invoiceId",
                          "sourceHash",
                          "proposalHash",
                          "sourceCurrent",
                          "canReview",
                          "blockedReason",
                          "receipt"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    }
                  },
                  "required": [
                    "businessId",
                    "runId",
                    "environment",
                    "readOnly",
                    "executionAllowed",
                    "readAt",
                    "canReview",
                    "blockedReason",
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "collections_review_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "collections_review_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "collections_review_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "description": "TEST human review evidence only. Current signed human identity, session, business membership and Agents:Enabled are required. Source evidence, finite grant, originating and historical reviewer authority, policy and exact proposal hashes are rechecked. A receipt remains historical after source or authority drift. The run remains needs_review; no reminder, invoice, payment, accounting or specialist dispatch is authorized. No query, If-Match or Range; GET has no body. Current authority precedes original-key replay. POST permits only a current owner or finance_admin, exact lowercase nonzero UUID key, four-field body and streamed maximum2048bytes. One immutable decision per run/invoice. The original session and exact body/hash must match replay. Concurrent serialization may return409; retain the original key/body. expiresAt is no later than reviewedAt+30minutes or the finite runtime deadline. Receipt and safe action audit commit atomically; no source amounts derive from model text.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "operationId": "recordCollectionsHumanReview",
        "summary": "Record a human decision on a retained TEST Collections recommendation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "invoiceId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                  },
                  "sourceHash": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$",
                    "minLength": 64,
                    "maxLength": 64
                  },
                  "proposalHash": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$",
                    "minLength": 64,
                    "maxLength": 64
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "approved",
                      "rejected"
                    ]
                  }
                },
                "required": [
                  "invoiceId",
                  "sourceHash",
                  "proposalHash",
                  "decision"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "One new immutable human review and audit; no dispatch.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "runId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "canReview": {
                      "type": "boolean"
                    },
                    "blockedReason": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "sourceHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$",
                            "minLength": 64,
                            "maxLength": 64
                          },
                          "proposalHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$",
                            "minLength": 64,
                            "maxLength": 64
                          },
                          "sourceCurrent": {
                            "type": "boolean"
                          },
                          "canReview": {
                            "type": "boolean"
                          },
                          "blockedReason": {
                            "oneOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "runtime_grant_changed",
                                  "runtime_paused",
                                  "run_not_reviewable",
                                  "actor_access_changed",
                                  "source_changed",
                                  "reviewer_access_changed",
                                  "review_expired"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "receipt": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "decisionId": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  "decision": {
                                    "type": "string",
                                    "enum": [
                                      "approved",
                                      "rejected"
                                    ]
                                  },
                                  "reviewerRole": {
                                    "type": "string",
                                    "enum": [
                                      "owner",
                                      "finance_admin"
                                    ]
                                  },
                                  "reviewedAt": {
                                    "type": "string",
                                    "format": "date-time",
                                    "maxLength": 40
                                  },
                                  "expiresAt": {
                                    "type": "string",
                                    "format": "date-time",
                                    "maxLength": 40
                                  }
                                },
                                "required": [
                                  "decisionId",
                                  "decision",
                                  "reviewerRole",
                                  "reviewedAt",
                                  "expiresAt"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "invoiceId",
                          "sourceHash",
                          "proposalHash",
                          "sourceCurrent",
                          "canReview",
                          "blockedReason",
                          "receipt"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "businessId",
                    "runId",
                    "environment",
                    "readOnly",
                    "executionAllowed",
                    "readAt",
                    "canReview",
                    "blockedReason",
                    "items",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Original request replay with current source checks; a historical receipt is not current authority.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "runId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "canReview": {
                      "type": "boolean"
                    },
                    "blockedReason": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "sourceHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$",
                            "minLength": 64,
                            "maxLength": 64
                          },
                          "proposalHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$",
                            "minLength": 64,
                            "maxLength": 64
                          },
                          "sourceCurrent": {
                            "type": "boolean"
                          },
                          "canReview": {
                            "type": "boolean"
                          },
                          "blockedReason": {
                            "oneOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "runtime_grant_changed",
                                  "runtime_paused",
                                  "run_not_reviewable",
                                  "actor_access_changed",
                                  "source_changed",
                                  "reviewer_access_changed",
                                  "review_expired"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "receipt": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "decisionId": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  "decision": {
                                    "type": "string",
                                    "enum": [
                                      "approved",
                                      "rejected"
                                    ]
                                  },
                                  "reviewerRole": {
                                    "type": "string",
                                    "enum": [
                                      "owner",
                                      "finance_admin"
                                    ]
                                  },
                                  "reviewedAt": {
                                    "type": "string",
                                    "format": "date-time",
                                    "maxLength": 40
                                  },
                                  "expiresAt": {
                                    "type": "string",
                                    "format": "date-time",
                                    "maxLength": 40
                                  }
                                },
                                "required": [
                                  "decisionId",
                                  "decision",
                                  "reviewerRole",
                                  "reviewedAt",
                                  "expiresAt"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "invoiceId",
                          "sourceHash",
                          "proposalHash",
                          "sourceCurrent",
                          "canReview",
                          "blockedReason",
                          "receipt"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "businessId",
                    "runId",
                    "environment",
                    "readOnly",
                    "executionAllowed",
                    "readAt",
                    "canReview",
                    "blockedReason",
                    "items",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "collections_review_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "collections_review_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no provider/private/reviewer identity data.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "collections_review_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/agent-runs/{runId}/reminder-preparations": {
      "get": {
        "operationId": "getCollectionsReminderPreparations",
        "summary": "Read current or historical TEST reminder text preparations",
        "description": "Separately default-off. Fresh current authority and full reviewed invoice/customer/payment/run evidence determine capability/content. Immutable preparation ID/hash/times remain historical; stale content is null. Read does not send or execute finance.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current preparations; communication approval remains required and sendAllowed is false",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "runId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "sendAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "communicationApprovalRequired": {
                      "type": "boolean",
                      "const": true
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "canPrepare": {
                      "type": "boolean"
                    },
                    "blockedReason": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "review_expired",
                            "reviewer_access_changed",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "items": {
                      "type": "array",
                      "maxItems": 20,
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              "reviewDecisionId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "sourceHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "proposalHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "sourceCurrent": {
                                "type": "boolean",
                                "const": true
                              },
                              "canPrepare": {
                                "type": "boolean"
                              },
                              "blockedReason": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "runtime_grant_changed",
                                      "runtime_paused",
                                      "run_not_reviewable",
                                      "actor_access_changed",
                                      "source_changed",
                                      "review_expired",
                                      "reviewer_access_changed",
                                      "review_not_approved",
                                      "preparation_expired",
                                      "preparation_access_changed"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "preparation": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "preparationId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                      },
                                      "artifactHash": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      "templateVersion": {
                                        "type": "string",
                                        "const": "TEST_COLLECTIONS_REMINDER_TEXT_V1"
                                      },
                                      "preparedAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "expiresAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "state": {
                                        "type": "string",
                                        "const": "prepared"
                                      },
                                      "content": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "recipient": {
                                                "type": "string",
                                                "minLength": 3,
                                                "maxLength": 254
                                              },
                                              "subject": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "body": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 1500
                                              }
                                            },
                                            "required": [
                                              "recipient",
                                              "subject",
                                              "body"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "preparationId",
                                      "artifactHash",
                                      "templateVersion",
                                      "preparedAt",
                                      "expiresAt",
                                      "state",
                                      "content"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "invoiceId",
                              "reviewDecisionId",
                              "sourceHash",
                              "proposalHash",
                              "sourceCurrent",
                              "canPrepare",
                              "blockedReason",
                              "preparation"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              "reviewDecisionId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "sourceHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "proposalHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "sourceCurrent": {
                                "type": "boolean",
                                "const": false
                              },
                              "canPrepare": {
                                "type": "boolean",
                                "const": false
                              },
                              "blockedReason": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "runtime_grant_changed",
                                      "runtime_paused",
                                      "run_not_reviewable",
                                      "actor_access_changed",
                                      "source_changed",
                                      "review_expired",
                                      "reviewer_access_changed",
                                      "review_not_approved",
                                      "preparation_expired",
                                      "preparation_access_changed"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "preparation": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "preparationId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                      },
                                      "artifactHash": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      "templateVersion": {
                                        "type": "string",
                                        "const": "TEST_COLLECTIONS_REMINDER_TEXT_V1"
                                      },
                                      "preparedAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "expiresAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "state": {
                                        "type": "string",
                                        "const": "prepared"
                                      },
                                      "content": {
                                        "type": "null"
                                      }
                                    },
                                    "required": [
                                      "preparationId",
                                      "artifactHash",
                                      "templateVersion",
                                      "preparedAt",
                                      "expiresAt",
                                      "state",
                                      "content"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "invoiceId",
                              "reviewDecisionId",
                              "sourceHash",
                              "proposalHash",
                              "sourceCurrent",
                              "canPrepare",
                              "blockedReason",
                              "preparation"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "recoveryScope": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    }
                  },
                  "required": [
                    "businessId",
                    "runId",
                    "environment",
                    "readOnly",
                    "executionAllowed",
                    "sendAllowed",
                    "communicationApprovalRequired",
                    "readAt",
                    "canPrepare",
                    "blockedReason",
                    "items",
                    "recoveryScope"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority, input, conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority, input, conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority, input, conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "collections_preparation_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority, input, conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority, input, conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "collections_preparation_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "prepareCollectionsReminder",
        "summary": "Retain exact reviewed TEST reminder text; no dispatch",
        "description": "Current owner or finance administrator deliberately retains exact approved proposal text and authoritative recipient. Human proposal approval is not communication/send authority. At most one artifact per review. Current auth precedes replay; original key/body/session survive ambiguity and replay never extends finite expiry.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "invoiceId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                  },
                  "reviewDecisionId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                  },
                  "sourceHash": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "proposalHash": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "invoiceId",
                  "reviewDecisionId",
                  "sourceHash",
                  "proposalHash"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "New immutable text preparation; not sent",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "runId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "sendAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "communicationApprovalRequired": {
                      "type": "boolean",
                      "const": true
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "canPrepare": {
                      "type": "boolean"
                    },
                    "blockedReason": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "review_expired",
                            "reviewer_access_changed",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "items": {
                      "type": "array",
                      "maxItems": 20,
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              "reviewDecisionId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "sourceHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "proposalHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "sourceCurrent": {
                                "type": "boolean",
                                "const": true
                              },
                              "canPrepare": {
                                "type": "boolean"
                              },
                              "blockedReason": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "runtime_grant_changed",
                                      "runtime_paused",
                                      "run_not_reviewable",
                                      "actor_access_changed",
                                      "source_changed",
                                      "review_expired",
                                      "reviewer_access_changed",
                                      "review_not_approved",
                                      "preparation_expired",
                                      "preparation_access_changed"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "preparation": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "preparationId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                      },
                                      "artifactHash": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      "templateVersion": {
                                        "type": "string",
                                        "const": "TEST_COLLECTIONS_REMINDER_TEXT_V1"
                                      },
                                      "preparedAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "expiresAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "state": {
                                        "type": "string",
                                        "const": "prepared"
                                      },
                                      "content": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "recipient": {
                                                "type": "string",
                                                "minLength": 3,
                                                "maxLength": 254
                                              },
                                              "subject": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "body": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 1500
                                              }
                                            },
                                            "required": [
                                              "recipient",
                                              "subject",
                                              "body"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "preparationId",
                                      "artifactHash",
                                      "templateVersion",
                                      "preparedAt",
                                      "expiresAt",
                                      "state",
                                      "content"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "invoiceId",
                              "reviewDecisionId",
                              "sourceHash",
                              "proposalHash",
                              "sourceCurrent",
                              "canPrepare",
                              "blockedReason",
                              "preparation"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              "reviewDecisionId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "sourceHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "proposalHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "sourceCurrent": {
                                "type": "boolean",
                                "const": false
                              },
                              "canPrepare": {
                                "type": "boolean",
                                "const": false
                              },
                              "blockedReason": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "runtime_grant_changed",
                                      "runtime_paused",
                                      "run_not_reviewable",
                                      "actor_access_changed",
                                      "source_changed",
                                      "review_expired",
                                      "reviewer_access_changed",
                                      "review_not_approved",
                                      "preparation_expired",
                                      "preparation_access_changed"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "preparation": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "preparationId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                      },
                                      "artifactHash": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      "templateVersion": {
                                        "type": "string",
                                        "const": "TEST_COLLECTIONS_REMINDER_TEXT_V1"
                                      },
                                      "preparedAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "expiresAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "state": {
                                        "type": "string",
                                        "const": "prepared"
                                      },
                                      "content": {
                                        "type": "null"
                                      }
                                    },
                                    "required": [
                                      "preparationId",
                                      "artifactHash",
                                      "templateVersion",
                                      "preparedAt",
                                      "expiresAt",
                                      "state",
                                      "content"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "invoiceId",
                              "reviewDecisionId",
                              "sourceHash",
                              "proposalHash",
                              "sourceCurrent",
                              "canPrepare",
                              "blockedReason",
                              "preparation"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "recoveryScope": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    }
                  },
                  "required": [
                    "businessId",
                    "runId",
                    "environment",
                    "readOnly",
                    "executionAllowed",
                    "sendAllowed",
                    "communicationApprovalRequired",
                    "readAt",
                    "canPrepare",
                    "blockedReason",
                    "items",
                    "replayed",
                    "recoveryScope"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Original-key replay with freshly evaluated current source; not sent",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "runId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "executionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "sendAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "communicationApprovalRequired": {
                      "type": "boolean",
                      "const": true
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "canPrepare": {
                      "type": "boolean"
                    },
                    "blockedReason": {
                      "oneOf": [
                        {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "review_expired",
                            "reviewer_access_changed",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "items": {
                      "type": "array",
                      "maxItems": 20,
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              "reviewDecisionId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "sourceHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "proposalHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "sourceCurrent": {
                                "type": "boolean",
                                "const": true
                              },
                              "canPrepare": {
                                "type": "boolean"
                              },
                              "blockedReason": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "runtime_grant_changed",
                                      "runtime_paused",
                                      "run_not_reviewable",
                                      "actor_access_changed",
                                      "source_changed",
                                      "review_expired",
                                      "reviewer_access_changed",
                                      "review_not_approved",
                                      "preparation_expired",
                                      "preparation_access_changed"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "preparation": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "preparationId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                      },
                                      "artifactHash": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      "templateVersion": {
                                        "type": "string",
                                        "const": "TEST_COLLECTIONS_REMINDER_TEXT_V1"
                                      },
                                      "preparedAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "expiresAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "state": {
                                        "type": "string",
                                        "const": "prepared"
                                      },
                                      "content": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "recipient": {
                                                "type": "string",
                                                "minLength": 3,
                                                "maxLength": 254
                                              },
                                              "subject": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 120
                                              },
                                              "body": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 1500
                                              }
                                            },
                                            "required": [
                                              "recipient",
                                              "subject",
                                              "body"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "preparationId",
                                      "artifactHash",
                                      "templateVersion",
                                      "preparedAt",
                                      "expiresAt",
                                      "state",
                                      "content"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "invoiceId",
                              "reviewDecisionId",
                              "sourceHash",
                              "proposalHash",
                              "sourceCurrent",
                              "canPrepare",
                              "blockedReason",
                              "preparation"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              "reviewDecisionId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "sourceHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "proposalHash": {
                                "type": "string",
                                "pattern": "^[a-f0-9]{64}$"
                              },
                              "sourceCurrent": {
                                "type": "boolean",
                                "const": false
                              },
                              "canPrepare": {
                                "type": "boolean",
                                "const": false
                              },
                              "blockedReason": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "runtime_grant_changed",
                                      "runtime_paused",
                                      "run_not_reviewable",
                                      "actor_access_changed",
                                      "source_changed",
                                      "review_expired",
                                      "reviewer_access_changed",
                                      "review_not_approved",
                                      "preparation_expired",
                                      "preparation_access_changed"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "preparation": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "preparationId": {
                                        "type": "string",
                                        "format": "uuid",
                                        "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                      },
                                      "artifactHash": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      "templateVersion": {
                                        "type": "string",
                                        "const": "TEST_COLLECTIONS_REMINDER_TEXT_V1"
                                      },
                                      "preparedAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "expiresAt": {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      "state": {
                                        "type": "string",
                                        "const": "prepared"
                                      },
                                      "content": {
                                        "type": "null"
                                      }
                                    },
                                    "required": [
                                      "preparationId",
                                      "artifactHash",
                                      "templateVersion",
                                      "preparedAt",
                                      "expiresAt",
                                      "state",
                                      "content"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "invoiceId",
                              "reviewDecisionId",
                              "sourceHash",
                              "proposalHash",
                              "sourceCurrent",
                              "canPrepare",
                              "blockedReason",
                              "preparation"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "recoveryScope": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    }
                  },
                  "required": [
                    "businessId",
                    "runId",
                    "environment",
                    "readOnly",
                    "executionAllowed",
                    "sendAllowed",
                    "communicationApprovalRequired",
                    "readAt",
                    "canPrepare",
                    "blockedReason",
                    "items",
                    "replayed",
                    "recoveryScope"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority, input, conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority, input, conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority, input, conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "collections_preparation_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority, input, conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current authority, input, conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "collections_preparation_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority, input, conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "collections_preparation_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoice-approvals": {
      "get": {
        "operationId": "listAssignedInvoiceReviews",
        "summary": "Read current account assigned invoice issue reviews",
        "description": "Current human assignee only. Captured proposal facts and independent expiry are retained history; follow existing detail for fresh human action checks. No issue or payment command.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current assigned reviews",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "readOnly",
                    "readAt",
                    "reviews",
                    "nextCursor"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "approver"
                      ]
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "reviews": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "proposalId",
                          "invoiceId",
                          "invoiceVersion",
                          "proposalVersion",
                          "capturedBuyerName",
                          "capturedGrossAmount",
                          "currency",
                          "approvalState",
                          "createdAt",
                          "expiresAt",
                          "expired"
                        ],
                        "properties": {
                          "proposalId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "invoiceVersion": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "proposalVersion": {
                            "type": "integer",
                            "const": 1
                          },
                          "capturedBuyerName": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          },
                          "capturedGrossAmount": {
                            "type": "string",
                            "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)$"
                          },
                          "currency": {
                            "type": "string",
                            "const": "GBP"
                          },
                          "approvalState": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "approved",
                              "rejected"
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "expiresAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "expired": {
                            "type": "boolean"
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_approvals_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-access/requests": {
      "get": {
        "operationId": "listOwnerPartnerRequests",
        "summary": "listOwnerPartnerRequests",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current owner scoped TEST result; retained review/receipt is historical, no provider enrollment or credential provisioning claim.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "requests",
                    "nextCursor"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "requests": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "requestId",
                          "clientId",
                          "clientLabel",
                          "scope",
                          "version",
                          "expiresAt"
                        ],
                        "properties": {
                          "requestId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "clientId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "clientLabel": {
                            "type": "string",
                            "minLength": 3,
                            "maxLength": 80,
                            "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]*$"
                          },
                          "scope": {
                            "type": "string",
                            "const": "invoices:read"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "expiresAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_access_denied",
                        "second_factor_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-access/grants": {
      "get": {
        "operationId": "listOwnerPartnerGrants",
        "summary": "listOwnerPartnerGrants",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current owner scoped TEST result; retained review/receipt is historical, no provider enrollment or credential provisioning claim.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "grants",
                    "nextCursor"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "grants": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "grantId",
                          "clientId",
                          "scope",
                          "version",
                          "status",
                          "expiresAt"
                        ],
                        "properties": {
                          "grantId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "clientId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "scope": {
                            "type": "string",
                            "const": "invoices:read"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "revoked",
                              "expired",
                              "unavailable"
                            ]
                          },
                          "expiresAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_access_denied",
                        "second_factor_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-consent-reviews": {
      "post": {
        "operationId": "prepareOwnerPartnerConsentReview",
        "summary": "prepareOwnerPartnerConsentReview",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]{0,9}\"$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current owner scoped TEST result; retained review/receipt is historical, no provider enrollment or credential provisioning claim.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]{0,9}\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "review",
                    "replayed"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "review": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "reviewId",
                        "requestId",
                        "clientId",
                        "clientLabel",
                        "scope",
                        "allowedFields",
                        "version",
                        "reviewHash",
                        "accessExpiresAt",
                        "reviewExpiresAt",
                        "approvalExpiresAt",
                        "createdAt"
                      ],
                      "properties": {
                        "reviewId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "requestId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "clientId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "clientLabel": {
                          "type": "string",
                          "minLength": 3,
                          "maxLength": 80,
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]*$"
                        },
                        "scope": {
                          "type": "string",
                          "const": "invoices:read"
                        },
                        "allowedFields": {
                          "type": "array",
                          "minItems": 8,
                          "maxItems": 8,
                          "items": {
                            "type": "string",
                            "enum": [
                              "invoiceId",
                              "issuedVersion",
                              "currency",
                              "netMinor",
                              "vatMinor",
                              "grossMinor",
                              "issuedOn",
                              "dueOn"
                            ]
                          },
                          "const": [
                            "invoiceId",
                            "issuedVersion",
                            "currency",
                            "netMinor",
                            "vatMinor",
                            "grossMinor",
                            "issuedOn",
                            "dueOn"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "const": 1
                        },
                        "reviewHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "accessExpiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "reviewExpiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "approvalExpiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_access_denied",
                        "second_factor_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_version_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "428": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "requestId",
                  "expiresAt"
                ],
                "properties": {
                  "requestId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-consent-reviews/{reviewId}": {
      "get": {
        "operationId": "readOwnerPartnerConsentReview",
        "summary": "readOwnerPartnerConsentReview",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "reviewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current owner scoped TEST result; retained review/receipt is historical, no provider enrollment or credential provisioning claim.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]{0,9}\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "review",
                    "replayed"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "review": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "reviewId",
                        "requestId",
                        "clientId",
                        "clientLabel",
                        "scope",
                        "allowedFields",
                        "version",
                        "reviewHash",
                        "accessExpiresAt",
                        "reviewExpiresAt",
                        "approvalExpiresAt",
                        "createdAt"
                      ],
                      "properties": {
                        "reviewId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "requestId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "clientId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "clientLabel": {
                          "type": "string",
                          "minLength": 3,
                          "maxLength": 80,
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]*$"
                        },
                        "scope": {
                          "type": "string",
                          "const": "invoices:read"
                        },
                        "allowedFields": {
                          "type": "array",
                          "minItems": 8,
                          "maxItems": 8,
                          "items": {
                            "type": "string",
                            "enum": [
                              "invoiceId",
                              "issuedVersion",
                              "currency",
                              "netMinor",
                              "vatMinor",
                              "grossMinor",
                              "issuedOn",
                              "dueOn"
                            ]
                          },
                          "const": [
                            "invoiceId",
                            "issuedVersion",
                            "currency",
                            "netMinor",
                            "vatMinor",
                            "grossMinor",
                            "issuedOn",
                            "dueOn"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "const": 1
                        },
                        "reviewHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "accessExpiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "reviewExpiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "approvalExpiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_access_denied",
                        "second_factor_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-consent-reviews/{reviewId}/decide": {
      "post": {
        "operationId": "decideOwnerPartnerConsentReview",
        "summary": "decideOwnerPartnerConsentReview",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "reviewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]{0,9}\"$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current owner scoped TEST result; retained review/receipt is historical, no provider enrollment or credential provisioning claim.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]{0,9}\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "receipt",
                    "replayed"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "receipt": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "receiptId",
                            "requestKey",
                            "command",
                            "reviewId",
                            "reviewHash",
                            "grantSnapshot",
                            "createdAt"
                          ],
                          "properties": {
                            "receiptId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "requestKey": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "command": {
                              "type": "string",
                              "const": "approve"
                            },
                            "reviewId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "reviewHash": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "grantSnapshot": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "grantId",
                                "clientId",
                                "scope",
                                "version",
                                "status",
                                "expiresAt"
                              ],
                              "properties": {
                                "grantId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                },
                                "clientId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                },
                                "scope": {
                                  "type": "string",
                                  "const": "invoices:read"
                                },
                                "version": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2147483647
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "active"
                                  ]
                                },
                                "expiresAt": {
                                  "type": "string",
                                  "format": "date-time"
                                }
                              }
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "receiptId",
                            "requestKey",
                            "command",
                            "reviewId",
                            "reviewHash",
                            "grantSnapshot",
                            "createdAt"
                          ],
                          "properties": {
                            "receiptId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "requestKey": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "command": {
                              "type": "string",
                              "const": "reject"
                            },
                            "reviewId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "reviewHash": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "grantSnapshot": {
                              "type": "null"
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_access_denied",
                        "second_factor_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_version_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "428": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "decision",
                  "reviewHash"
                ],
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "approve",
                      "reject"
                    ]
                  },
                  "reviewHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-access/grants/{grantId}/revoke": {
      "post": {
        "operationId": "revokeOwnerPartnerGrant",
        "summary": "revokeOwnerPartnerGrant",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "grantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]{0,9}\"$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current owner scoped TEST result; retained review/receipt is historical, no provider enrollment or credential provisioning claim.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]{0,9}\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "receipt",
                    "replayed"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "receipt": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "receiptId",
                        "requestKey",
                        "command",
                        "reviewId",
                        "reviewHash",
                        "grantSnapshot",
                        "createdAt"
                      ],
                      "properties": {
                        "receiptId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "requestKey": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "command": {
                          "type": "string",
                          "const": "revoke"
                        },
                        "reviewId": {
                          "type": "null"
                        },
                        "reviewHash": {
                          "type": "null"
                        },
                        "grantSnapshot": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "grantId",
                            "clientId",
                            "scope",
                            "version",
                            "status",
                            "expiresAt"
                          ],
                          "properties": {
                            "grantId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "clientId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "scope": {
                              "type": "string",
                              "const": "invoices:read"
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "revoked"
                              ]
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_access_denied",
                        "second_factor_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_version_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "428": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [],
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-consent-receipts/{receiptId}": {
      "get": {
        "operationId": "readOwnerPartnerConsentReceipt",
        "summary": "readOwnerPartnerConsentReceipt",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "receiptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current owner scoped TEST result; retained review/receipt is historical, no provider enrollment or credential provisioning claim.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]{0,9}\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "receipt",
                    "replayed"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "receipt": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "receiptId",
                            "requestKey",
                            "command",
                            "reviewId",
                            "reviewHash",
                            "grantSnapshot",
                            "createdAt"
                          ],
                          "properties": {
                            "receiptId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "requestKey": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "command": {
                              "type": "string",
                              "const": "approve"
                            },
                            "reviewId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "reviewHash": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "grantSnapshot": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "grantId",
                                "clientId",
                                "scope",
                                "version",
                                "status",
                                "expiresAt"
                              ],
                              "properties": {
                                "grantId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                },
                                "clientId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                },
                                "scope": {
                                  "type": "string",
                                  "const": "invoices:read"
                                },
                                "version": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2147483647
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "active"
                                  ]
                                },
                                "expiresAt": {
                                  "type": "string",
                                  "format": "date-time"
                                }
                              }
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "receiptId",
                            "requestKey",
                            "command",
                            "reviewId",
                            "reviewHash",
                            "grantSnapshot",
                            "createdAt"
                          ],
                          "properties": {
                            "receiptId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "requestKey": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "command": {
                              "type": "string",
                              "const": "reject"
                            },
                            "reviewId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "reviewHash": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "grantSnapshot": {
                              "type": "null"
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "receiptId",
                            "requestKey",
                            "command",
                            "reviewId",
                            "reviewHash",
                            "grantSnapshot",
                            "createdAt"
                          ],
                          "properties": {
                            "receiptId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "requestKey": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "command": {
                              "type": "string",
                              "const": "revoke"
                            },
                            "reviewId": {
                              "type": "null"
                            },
                            "reviewHash": {
                              "type": "null"
                            },
                            "grantSnapshot": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "grantId",
                                "clientId",
                                "scope",
                                "version",
                                "status",
                                "expiresAt"
                              ],
                              "properties": {
                                "grantId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                },
                                "clientId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                },
                                "scope": {
                                  "type": "string",
                                  "const": "invoices:read"
                                },
                                "version": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2147483647
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "revoked"
                                  ]
                                },
                                "expiresAt": {
                                  "type": "string",
                                  "format": "date-time"
                                }
                              }
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_access_denied",
                        "second_factor_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed current-authority or dependency result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "partner_consent_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoice-directory": {
      "get": {
        "operationId": "searchInvoiceDirectory",
        "summary": "Server-scoped TEST invoice document, customer, number and ID search",
        "description": "Search all scoped business records at request time; current session and membership are rechecked before returning. Substring search covers immutable issued number or invoice UUID, not customer names. At most100 UUID-ordered results; a cursor must exist within the current filter. No payment, delivery or issue command. Read-only request; no CSV export.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "documentState",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "draft",
                "issued"
              ],
              "default": "all"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9 -]+$",
              "description": "Trimmed ASCII substring. The response echoes lowercase normalization."
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current filtered invoice page; empty is an authoritative empty result, not a dependency failure",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "invoices": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "customerId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "version": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 2147483647
                              },
                              "documentState": {
                                "type": "string",
                                "const": "draft"
                              },
                              "calculationState": {
                                "type": "string",
                                "enum": [
                                  "calculated",
                                  "unresolved"
                                ]
                              },
                              "net": {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "vat": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "gross": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "updatedAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            },
                            "required": [
                              "invoiceId",
                              "customerId",
                              "version",
                              "documentState",
                              "calculationState",
                              "net",
                              "vat",
                              "gross",
                              "createdAt",
                              "updatedAt"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "customerId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "version": {
                                "type": "integer",
                                "minimum": 2,
                                "maximum": 2147483647
                              },
                              "documentState": {
                                "type": "string",
                                "const": "issued"
                              },
                              "calculationState": {
                                "type": "string",
                                "const": "calculated"
                              },
                              "net": {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "vat": {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "gross": {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "updatedAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "number": {
                                "type": "string",
                                "pattern": "^TST-(?!000000$)(?:[0-9]{6}|[1-9][0-9]{6,8}|1000000000)$",
                                "maxLength": 14
                              }
                            },
                            "required": [
                              "invoiceId",
                              "customerId",
                              "version",
                              "documentState",
                              "calculationState",
                              "net",
                              "vat",
                              "gross",
                              "createdAt",
                              "updatedAt",
                              "number"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "maxItems": 100,
                      "minItems": 0
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "filterScope": {
                      "type": "string",
                      "const": "business"
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "filters": {
                      "type": "object",
                      "properties": {
                        "documentState": {
                          "type": "string",
                          "enum": [
                            "all",
                            "draft",
                            "issued"
                          ]
                        },
                        "customerId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "query": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "maxLength": 64,
                          "pattern": "^[a-z0-9 -]+$"
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        }
                      },
                      "required": [
                        "documentState",
                        "customerId",
                        "query",
                        "limit"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "invoices",
                    "nextCursor",
                    "readOnly",
                    "filterScope",
                    "readAt",
                    "filters"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency or privileged runtime unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_directory_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/collections/contact-policy": {
      "get": {
        "operationId": "getCollectionsContactPolicy",
        "summary": "Read current TEST contact window",
        "description": "TEST only; separately default-off Agents:Enabled + PreparationEnabled + CommunicationEnabled. Verified current human actor/session/business role checked before original replay and at current deadlines. No query/conditional headers; GET has no body or Idempotency-Key. Immutable review of recommendation is not communication approval; communication approval is not send. No financial execution or real inbox delivery.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped facts and historical immutable receipts; no implicit execution",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "canEdit": {
                          "type": "boolean"
                        },
                        "timezone": {
                          "type": "string",
                          "const": "Europe/London"
                        },
                        "minimumContactIntervalHours": {
                          "type": "integer",
                          "const": 24
                        },
                        "maximumCustomerAttemptsPer24Hours": {
                          "type": "integer",
                          "const": 1
                        },
                        "maximumBusinessAttemptsPer24Hours": {
                          "type": "integer",
                          "const": 20
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "revision": {
                          "type": "integer",
                          "const": 0
                        },
                        "enabled": {
                          "type": "boolean",
                          "const": false
                        },
                        "allowedWeekdays": {
                          "type": "null"
                        },
                        "startMinute": {
                          "type": "null"
                        },
                        "endMinute": {
                          "type": "null"
                        },
                        "expiresAt": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "readAt",
                        "canEdit",
                        "timezone",
                        "minimumContactIntervalHours",
                        "maximumCustomerAttemptsPer24Hours",
                        "maximumBusinessAttemptsPer24Hours",
                        "realDeliveryAllowed",
                        "revision",
                        "enabled",
                        "allowedWeekdays",
                        "startMinute",
                        "endMinute",
                        "expiresAt"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "canEdit": {
                          "type": "boolean"
                        },
                        "timezone": {
                          "type": "string",
                          "const": "Europe/London"
                        },
                        "minimumContactIntervalHours": {
                          "type": "integer",
                          "const": 24
                        },
                        "maximumCustomerAttemptsPer24Hours": {
                          "type": "integer",
                          "const": 1
                        },
                        "maximumBusinessAttemptsPer24Hours": {
                          "type": "integer",
                          "const": 20
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "revision": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "allowedWeekdays": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 7,
                          "items": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 7
                          }
                        },
                        "startMinute": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1438
                        },
                        "endMinute": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1439
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        }
                      },
                      "required": [
                        "businessId",
                        "environment",
                        "readAt",
                        "canEdit",
                        "timezone",
                        "minimumContactIntervalHours",
                        "maximumCustomerAttemptsPer24Hours",
                        "maximumBusinessAttemptsPer24Hours",
                        "realDeliveryAllowed",
                        "revision",
                        "enabled",
                        "allowedWeekdays",
                        "startMinute",
                        "endMinute",
                        "expiresAt"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "recordCollectionsContactPolicy",
        "summary": "Owner records a finite TEST contact window",
        "description": "TEST only; separately default-off Agents:Enabled + PreparationEnabled + CommunicationEnabled. Verified current human actor/session/business role checked before original replay and at current deadlines. No query/conditional headers; GET has no body or Idempotency-Key. Immutable review of recommendation is not communication approval; communication approval is not send. No financial execution or real inbox delivery. POST application/json <=4096 UTF-8 bytes, depth3, exactly closed unique fields. Same actor/session/resource/canonical original key/body replays without a new attempt; different body/session conflicts. Current mutable contact settings may differ on replay. Sandbox submissions use a separate restricted finite processor and exactly one durable attempt; ambiguous outcomes never resend.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Original request replay under current authority; no redispatch",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "minLength": 36,
                      "maxLength": 36,
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "canEdit": {
                      "type": "boolean"
                    },
                    "timezone": {
                      "type": "string",
                      "const": "Europe/London"
                    },
                    "minimumContactIntervalHours": {
                      "type": "integer",
                      "const": 24
                    },
                    "maximumCustomerAttemptsPer24Hours": {
                      "type": "integer",
                      "const": 1
                    },
                    "maximumBusinessAttemptsPer24Hours": {
                      "type": "integer",
                      "const": 20
                    },
                    "realDeliveryAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "allowedWeekdays": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 7,
                      "items": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 7
                      }
                    },
                    "startMinute": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1438
                    },
                    "endMinute": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1439
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "readAt",
                    "canEdit",
                    "timezone",
                    "minimumContactIntervalHours",
                    "maximumCustomerAttemptsPer24Hours",
                    "maximumBusinessAttemptsPer24Hours",
                    "realDeliveryAllowed",
                    "revision",
                    "enabled",
                    "allowedWeekdays",
                    "startMinute",
                    "endMinute",
                    "expiresAt",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "New durable request recorded; inspect distinct decision/submission state",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "minLength": 36,
                      "maxLength": 36,
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "canEdit": {
                      "type": "boolean"
                    },
                    "timezone": {
                      "type": "string",
                      "const": "Europe/London"
                    },
                    "minimumContactIntervalHours": {
                      "type": "integer",
                      "const": 24
                    },
                    "maximumCustomerAttemptsPer24Hours": {
                      "type": "integer",
                      "const": 1
                    },
                    "maximumBusinessAttemptsPer24Hours": {
                      "type": "integer",
                      "const": 20
                    },
                    "realDeliveryAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "allowedWeekdays": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 7,
                      "items": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 7
                      }
                    },
                    "startMinute": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1438
                    },
                    "endMinute": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1439
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "readAt",
                    "canEdit",
                    "timezone",
                    "minimumContactIntervalHours",
                    "maximumCustomerAttemptsPer24Hours",
                    "maximumBusinessAttemptsPer24Hours",
                    "realDeliveryAllowed",
                    "revision",
                    "enabled",
                    "allowedWeekdays",
                    "startMinute",
                    "endMinute",
                    "expiresAt",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2147483646
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "allowedWeekdays": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 7,
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 7
                    }
                  },
                  "startMinute": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1438
                  },
                  "endMinute": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1439
                  }
                },
                "required": [
                  "expectedRevision",
                  "enabled",
                  "allowedWeekdays",
                  "startMinute",
                  "endMinute"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/collections/contact-safety": {
      "get": {
        "operationId": "getCollectionsContactSafety",
        "summary": "Read current customer contact and issued invoice dispute declarations",
        "description": "TEST only; separately default-off Agents:Enabled + PreparationEnabled + CommunicationEnabled. Verified current human actor/session/business role checked before original replay and at current deadlines. No query/conditional headers; GET has no body or Idempotency-Key. Immutable review of recommendation is not communication approval; communication approval is not send. No financial execution or real inbox delivery.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped facts and historical immutable receipts; no implicit execution",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "minLength": 36,
                      "maxLength": 36,
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "minLength": 36,
                      "maxLength": 36,
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "canEdit": {
                      "type": "boolean"
                    },
                    "customerVersion": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "issuedVersion": {
                      "type": "integer",
                      "minimum": 2,
                      "maximum": 2147483647
                    },
                    "snapshotHash": {
                      "type": "string",
                      "minLength": 64,
                      "maxLength": 64,
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "contactRevision": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 2147483647
                    },
                    "disputeRevision": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 2147483647
                    },
                    "contactState": {
                      "type": "string",
                      "enum": [
                        "unknown",
                        "allowed_test",
                        "do_not_contact"
                      ]
                    },
                    "disputeState": {
                      "type": "string",
                      "enum": [
                        "unknown",
                        "clear_test",
                        "disputed"
                      ]
                    },
                    "contactExpiresAt": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "disputeExpiresAt": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "deliveryPreference": {
                      "type": "string",
                      "enum": [
                        "manual",
                        "email"
                      ]
                    },
                    "collectionsPaused": {
                      "type": "boolean"
                    },
                    "realDeliveryAllowed": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "businessId",
                    "invoiceId",
                    "environment",
                    "readAt",
                    "canEdit",
                    "customerVersion",
                    "issuedVersion",
                    "snapshotHash",
                    "contactRevision",
                    "disputeRevision",
                    "contactState",
                    "disputeState",
                    "contactExpiresAt",
                    "disputeExpiresAt",
                    "deliveryPreference",
                    "collectionsPaused",
                    "realDeliveryAllowed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "recordCollectionsContactSafety",
        "summary": "Owner or finance administrator records finite TEST contact and dispute declarations",
        "description": "TEST only; separately default-off Agents:Enabled + PreparationEnabled + CommunicationEnabled. Verified current human actor/session/business role checked before original replay and at current deadlines. No query/conditional headers; GET has no body or Idempotency-Key. Immutable review of recommendation is not communication approval; communication approval is not send. No financial execution or real inbox delivery. POST application/json <=4096 UTF-8 bytes, depth3, exactly closed unique fields. Same actor/session/resource/canonical original key/body replays without a new attempt; different body/session conflicts. Current mutable contact settings may differ on replay. Sandbox submissions use a separate restricted finite processor and exactly one durable attempt; ambiguous outcomes never resend.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Original request replay under current authority; no redispatch",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "minLength": 36,
                      "maxLength": 36,
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "minLength": 36,
                      "maxLength": 36,
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "canEdit": {
                      "type": "boolean"
                    },
                    "customerVersion": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "issuedVersion": {
                      "type": "integer",
                      "minimum": 2,
                      "maximum": 2147483647
                    },
                    "snapshotHash": {
                      "type": "string",
                      "minLength": 64,
                      "maxLength": 64,
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "contactRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "disputeRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "contactState": {
                      "type": "string",
                      "enum": [
                        "unknown",
                        "allowed_test",
                        "do_not_contact"
                      ]
                    },
                    "disputeState": {
                      "type": "string",
                      "enum": [
                        "unknown",
                        "clear_test",
                        "disputed"
                      ]
                    },
                    "contactExpiresAt": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "disputeExpiresAt": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "deliveryPreference": {
                      "type": "string",
                      "enum": [
                        "manual",
                        "email"
                      ]
                    },
                    "collectionsPaused": {
                      "type": "boolean"
                    },
                    "realDeliveryAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "businessId",
                    "invoiceId",
                    "environment",
                    "readAt",
                    "canEdit",
                    "customerVersion",
                    "issuedVersion",
                    "snapshotHash",
                    "contactRevision",
                    "disputeRevision",
                    "contactState",
                    "disputeState",
                    "contactExpiresAt",
                    "disputeExpiresAt",
                    "deliveryPreference",
                    "collectionsPaused",
                    "realDeliveryAllowed",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "New durable request recorded; inspect distinct decision/submission state",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "minLength": 36,
                      "maxLength": 36,
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "minLength": 36,
                      "maxLength": 36,
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time",
                      "maxLength": 40
                    },
                    "canEdit": {
                      "type": "boolean"
                    },
                    "customerVersion": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "issuedVersion": {
                      "type": "integer",
                      "minimum": 2,
                      "maximum": 2147483647
                    },
                    "snapshotHash": {
                      "type": "string",
                      "minLength": 64,
                      "maxLength": 64,
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "contactRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "disputeRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "contactState": {
                      "type": "string",
                      "enum": [
                        "unknown",
                        "allowed_test",
                        "do_not_contact"
                      ]
                    },
                    "disputeState": {
                      "type": "string",
                      "enum": [
                        "unknown",
                        "clear_test",
                        "disputed"
                      ]
                    },
                    "contactExpiresAt": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "disputeExpiresAt": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "deliveryPreference": {
                      "type": "string",
                      "enum": [
                        "manual",
                        "email"
                      ]
                    },
                    "collectionsPaused": {
                      "type": "boolean"
                    },
                    "realDeliveryAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "businessId",
                    "invoiceId",
                    "environment",
                    "readAt",
                    "canEdit",
                    "customerVersion",
                    "issuedVersion",
                    "snapshotHash",
                    "contactRevision",
                    "disputeRevision",
                    "contactState",
                    "disputeState",
                    "contactExpiresAt",
                    "disputeExpiresAt",
                    "deliveryPreference",
                    "collectionsPaused",
                    "realDeliveryAllowed",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedContactRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2147483646
                  },
                  "expectedDisputeRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2147483646
                  },
                  "customerVersion": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2147483647
                  },
                  "issuedVersion": {
                    "type": "integer",
                    "minimum": 2,
                    "maximum": 2147483647
                  },
                  "snapshotHash": {
                    "type": "string",
                    "minLength": 64,
                    "maxLength": 64,
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "contactState": {
                    "type": "string",
                    "enum": [
                      "unknown",
                      "allowed_test",
                      "do_not_contact"
                    ]
                  },
                  "disputeState": {
                    "type": "string",
                    "enum": [
                      "unknown",
                      "clear_test",
                      "disputed"
                    ]
                  }
                },
                "required": [
                  "expectedContactRevision",
                  "expectedDisputeRevision",
                  "customerVersion",
                  "issuedVersion",
                  "snapshotHash",
                  "contactState",
                  "disputeState"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/agent-runs/{runId}/reminder-preparations/{preparationId}/communication": {
      "get": {
        "operationId": "getCollectionsReminderCommunication",
        "summary": "Read exact TEST transport preview and separate communication receipts",
        "description": "TEST only; separately default-off Agents:Enabled + PreparationEnabled + CommunicationEnabled. Verified current human actor/session/business role checked before original replay and at current deadlines. No query/conditional headers; GET has no body or Idempotency-Key. Immutable review of recommendation is not communication approval; communication approval is not send. No financial execution or real inbox delivery.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "preparationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped facts and historical immutable receipts; no implicit execution",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "null"
                        },
                        "submission": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "oneOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "processing"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "null"
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "sandbox_accepted"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": true
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "unknown"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "oneOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time",
                                          "maxLength": 40
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "failed"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "null"
                        },
                        "submission": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "oneOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "processing"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "null"
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "sandbox_accepted"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": true
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "unknown"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "oneOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time",
                                          "maxLength": 40
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "failed"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean"
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean"
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/agent-runs/{runId}/reminder-preparations/{preparationId}/communication-decisions": {
      "post": {
        "operationId": "decideCollectionsReminderCommunication",
        "summary": "Explicitly approve or reject the exact retained Sandbox communication",
        "description": "TEST only; separately default-off Agents:Enabled + PreparationEnabled + CommunicationEnabled. Verified current human actor/session/business role checked before original replay and at current deadlines. No query/conditional headers; GET has no body or Idempotency-Key. Immutable review of recommendation is not communication approval; communication approval is not send. No financial execution or real inbox delivery. POST application/json <=4096 UTF-8 bytes, depth3, exactly closed unique fields. Same actor/session/resource/canonical original key/body replays without a new attempt; different body/session conflicts. Current mutable contact settings may differ on replay. Sandbox submissions use a separate restricted finite processor and exactly one durable attempt; ambiguous outcomes never resend.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "preparationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Original request replay under current authority; no redispatch",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "null"
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "oneOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "processing"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "null"
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "sandbox_accepted"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": true
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "unknown"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "oneOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time",
                                          "maxLength": 40
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "failed"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "null"
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "oneOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "processing"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "null"
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "sandbox_accepted"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": true
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "unknown"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "oneOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time",
                                          "maxLength": 40
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "failed"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean"
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean"
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "201": {
            "description": "New durable request recorded; inspect distinct decision/submission state",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "null"
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "oneOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "processing"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "null"
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "sandbox_accepted"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": true
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "unknown"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "oneOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time",
                                          "maxLength": 40
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "failed"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "null"
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "oneOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "processing"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "null"
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "sandbox_accepted"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": true
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "unknown"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "oneOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time",
                                          "maxLength": 40
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "failed"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean"
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean"
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "artifactHash": {
                    "type": "string",
                    "minLength": 64,
                    "maxLength": 64,
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "safetyHash": {
                    "type": "string",
                    "minLength": 64,
                    "maxLength": 64,
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "approved",
                      "rejected"
                    ]
                  }
                },
                "required": [
                  "artifactHash",
                  "safetyHash",
                  "decision"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/agent-runs/{runId}/reminder-preparations/{preparationId}/sandbox-submissions": {
      "post": {
        "operationId": "submitCollectionsReminderSandbox",
        "summary": "Explicit single durable Postmark Sandbox attempt; unknown never resends",
        "description": "TEST only; separately default-off Agents:Enabled + PreparationEnabled + CommunicationEnabled. Verified current human actor/session/business role checked before original replay and at current deadlines. No query/conditional headers; GET has no body or Idempotency-Key. Immutable review of recommendation is not communication approval; communication approval is not send. No financial execution or real inbox delivery. POST application/json <=4096 UTF-8 bytes, depth3, exactly closed unique fields. Same actor/session/resource/canonical original key/body replays without a new attempt; different body/session conflicts. Current mutable contact settings may differ on replay. Sandbox submissions use a separate restricted finite processor and exactly one durable attempt; ambiguous outcomes never resend.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "preparationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "minLength": 36,
              "maxLength": 36,
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Original request replay under current authority; no redispatch",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "null"
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "oneOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "processing"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "null"
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "sandbox_accepted"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": true
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "unknown"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "oneOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time",
                                          "maxLength": 40
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "failed"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "null"
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "oneOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "processing"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "null"
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "sandbox_accepted"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": true
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "unknown"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "oneOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time",
                                          "maxLength": 40
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "failed"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean"
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean"
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "201": {
            "description": "New durable request recorded; inspect distinct decision/submission state",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "null"
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed"
                          ]
                        },
                        "preview": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "oneOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "processing"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "null"
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "sandbox_accepted"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": true
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "unknown"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "oneOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time",
                                          "maxLength": 40
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "failed"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "null"
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": false
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "blockedReason": {
                          "type": "string",
                          "enum": [
                            "runtime_grant_changed",
                            "runtime_paused",
                            "run_not_reviewable",
                            "actor_access_changed",
                            "source_changed",
                            "reviewer_access_changed",
                            "review_expired",
                            "review_not_approved",
                            "preparation_expired",
                            "preparation_access_changed",
                            "contact_policy_unavailable",
                            "contact_permission_unknown",
                            "do_not_contact",
                            "dispute_unknown",
                            "invoice_disputed",
                            "collections_paused",
                            "email_contact_not_selected",
                            "recipient_transport_unsupported",
                            "payment_pending_unknown",
                            "quiet_hours",
                            "recent_contact",
                            "contact_quota_exceeded",
                            "sender_not_configured",
                            "communication_expired"
                          ]
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "oneOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "processing"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "null"
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "sandbox_accepted"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": true
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "unknown"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "oneOf": [
                                        {
                                          "type": "string",
                                          "format": "date-time",
                                          "maxLength": 40
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "submissionId": {
                                      "type": "string",
                                      "format": "uuid",
                                      "minLength": 36,
                                      "maxLength": 36,
                                      "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                    },
                                    "state": {
                                      "type": "string",
                                      "const": "failed"
                                    },
                                    "startedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "finishedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "maxLength": 40
                                    },
                                    "sandboxAccepted": {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    "retryAllowed": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "submissionId",
                                    "state",
                                    "startedAt",
                                    "finishedAt",
                                    "sandboxAccepted",
                                    "retryAllowed"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "decision",
                        "submission",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "null"
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean"
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "rejected"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean"
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": false
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean",
                          "const": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "preparationId": {
                          "type": "string",
                          "format": "uuid",
                          "minLength": 36,
                          "maxLength": 36,
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "recoveryScope": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "artifactHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "safetyHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "transportHash": {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64,
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "readAt": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "financialExecutionAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "realDeliveryAllowed": {
                          "type": "boolean",
                          "const": false
                        },
                        "sourceCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "eligible": {
                          "type": "boolean",
                          "const": true
                        },
                        "safetyCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "blockedReason": {
                          "type": "null"
                        },
                        "preview": {
                          "type": "object",
                          "properties": {
                            "templateVersion": {
                              "type": "string",
                              "const": "TEST_COLLECTIONS_REMINDER_SANDBOX_V1"
                            },
                            "recipient": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 254,
                              "pattern": "^[!-~]+$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 17,
                              "maxLength": 136,
                              "pattern": "^TEST reminder · [^0-9@<>\\u0000-\\u001f\\u007f]+$"
                            },
                            "body": {
                              "type": "string",
                              "minLength": 97,
                              "maxLength": 1596,
                              "pattern": "^This is a Tallylane TEST reminder processed by Postmark Sandbox\\. No real payment is requested\\.\\n\\n[^0-9@<>\\u0000-\\u0009\\u000b-\\u001f\\u007f]+$"
                            }
                          },
                          "required": [
                            "templateVersion",
                            "recipient",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        "submission": {
                          "type": "null"
                        },
                        "decision": {
                          "type": "object",
                          "properties": {
                            "decisionId": {
                              "type": "string",
                              "format": "uuid",
                              "minLength": 36,
                              "maxLength": 36,
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "decision": {
                              "type": "string",
                              "const": "approved"
                            },
                            "decidedAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "maxLength": 40
                            },
                            "artifactHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "safetyHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            },
                            "transportHash": {
                              "type": "string",
                              "minLength": 64,
                              "maxLength": 64,
                              "pattern": "^[a-f0-9]{64}$"
                            }
                          },
                          "required": [
                            "decisionId",
                            "decision",
                            "decidedAt",
                            "expiresAt",
                            "artifactHash",
                            "safetyHash",
                            "transportHash"
                          ],
                          "additionalProperties": false
                        },
                        "decisionCurrent": {
                          "type": "boolean",
                          "const": true
                        },
                        "canApprove": {
                          "type": "boolean",
                          "const": false
                        },
                        "canSubmitSandbox": {
                          "type": "boolean"
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "businessId",
                        "runId",
                        "invoiceId",
                        "preparationId",
                        "recoveryScope",
                        "artifactHash",
                        "safetyHash",
                        "transportHash",
                        "readAt",
                        "environment",
                        "financialExecutionAllowed",
                        "realDeliveryAllowed",
                        "sourceCurrent",
                        "eligible",
                        "safetyCurrent",
                        "blockedReason",
                        "preview",
                        "submission",
                        "decision",
                        "decisionCurrent",
                        "canApprove",
                        "canSubmitSandbox",
                        "replayed"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_access_denied"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_conflict"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed input, authority, source conflict or dependency denial",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "collections_communication_unavailable"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "communicationDecisionId": {
                    "type": "string",
                    "format": "uuid",
                    "minLength": 36,
                    "maxLength": 36,
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                  },
                  "artifactHash": {
                    "type": "string",
                    "minLength": 64,
                    "maxLength": 64,
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "safetyHash": {
                    "type": "string",
                    "minLength": 64,
                    "maxLength": 64,
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "communicationDecisionId",
                  "artifactHash",
                  "safetyHash"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoice-directory/summary": {
      "get": {
        "operationId": "readInvoiceDirectorySummary",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "businessId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "in": "query",
            "name": "documentState",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "draft",
                "issued"
              ]
            }
          },
          {
            "in": "query",
            "name": "customerId",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "in": "query",
            "name": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9 -]+$"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:[1-9]|[1-9][0-9]|100)$"
            }
          },
          {
            "in": "query",
            "name": "after",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "description": "TEST read only. Five current financial read roles, exact once canonical filters, no body/content/transfer/range. Null draft summaries. Zero-total no_payment_due never confirms payment. Current local Xero checkpoint only.",
        "responses": {
          "200": {
            "description": "One bounded captured page of local durable facts after fresh current authority; no provider refresh or business totals.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "readOnly",
                    "filterScope",
                    "readAt",
                    "asOfDate",
                    "filters",
                    "invoices",
                    "nextCursor"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "filterScope": {
                      "type": "string",
                      "const": "business"
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "asOfDate": {
                      "type": "string",
                      "format": "date",
                      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                    },
                    "filters": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "documentState",
                        "customerId",
                        "query",
                        "limit"
                      ],
                      "properties": {
                        "documentState": {
                          "type": "string",
                          "enum": [
                            "all",
                            "draft",
                            "issued"
                          ]
                        },
                        "customerId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "query": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[a-z0-9 -]+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        }
                      }
                    },
                    "invoices": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "invoiceId",
                          "customerId",
                          "version",
                          "documentState",
                          "calculationState",
                          "number",
                          "net",
                          "vat",
                          "gross",
                          "createdAt",
                          "updatedAt",
                          "payment",
                          "due",
                          "accounting"
                        ],
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "customerId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "documentState": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "issued"
                            ]
                          },
                          "calculationState": {
                            "type": "string",
                            "enum": [
                              "calculated",
                              "unresolved"
                            ]
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^TST-[0-9]{6,10}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "net": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "amount",
                              "currency"
                            ],
                            "properties": {
                              "amount": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                              },
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              }
                            }
                          },
                          "vat": {
                            "anyOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "gross": {
                            "anyOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "amount",
                                  "currency"
                                ],
                                "properties": {
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "const": "GBP"
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "payment": {
                            "anyOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "ledgerState",
                                  "paymentState",
                                  "amountCondition",
                                  "confirmedAllocated",
                                  "outstanding"
                                ],
                                "properties": {
                                  "ledgerState": {
                                    "type": "string",
                                    "enum": [
                                      "verified",
                                      "needs_review"
                                    ]
                                  },
                                  "paymentState": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "enum": [
                                          "unpaid",
                                          "partially_paid",
                                          "paid"
                                        ]
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "amountCondition": {
                                    "type": "string",
                                    "enum": [
                                      "positive_total",
                                      "no_payment_due",
                                      "needs_review"
                                    ]
                                  },
                                  "confirmedAllocated": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "amount",
                                          "currency"
                                        ],
                                        "properties": {
                                          "amount": {
                                            "type": "string",
                                            "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "const": "GBP"
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "outstanding": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "amount",
                                          "currency"
                                        ],
                                        "properties": {
                                          "amount": {
                                            "type": "string",
                                            "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "const": "GBP"
                                          }
                                        }
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "due": {
                            "anyOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "dueDate",
                                  "asOfDate",
                                  "state"
                                ],
                                "properties": {
                                  "dueDate": {
                                    "type": "string",
                                    "format": "date",
                                    "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                                  },
                                  "asOfDate": {
                                    "type": "string",
                                    "format": "date",
                                    "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                                  },
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "not_due",
                                      "due_today",
                                      "overdue",
                                      "settled",
                                      "no_payment_due",
                                      "unknown"
                                    ]
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "accounting": {
                            "anyOf": [
                              {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "state",
                                  "verifiedAt"
                                ],
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "not_started",
                                      "in_progress",
                                      "needs_review",
                                      "synced"
                                    ]
                                  },
                                  "verifiedAt": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "format": "date-time"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        }
                      }
                    },
                    "nextCursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed failure; no source rows returned.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed failure; no source rows returned.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "no-store, private"
                  ]
                }
              },
              "X-Content-Type-Options": {
                "required": false,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "WWW-Authenticate": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed failure; no source rows returned.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed failure; no source rows returned.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed failure; no source rows returned.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_summary_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/overview": {
      "get": {
        "operationId": "readBusinessOverview",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "businessId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "description": "Exact whole-business Tallylane-issued TEST receivables and max5 latest-created issued records from one local durable capture; excludes external Xero history. No query/body/range. Current five-role authority before and after response preparation.",
        "responses": {
          "200": {
            "description": "One bounded captured page of local durable facts after fresh current authority; no provider refresh or business totals.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "readOnly",
                    "readAt",
                    "asOfDate",
                    "scope",
                    "sourceCoverage",
                    "recentIssued",
                    "receivables"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "asOfDate": {
                      "type": "string",
                      "format": "date",
                      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                    },
                    "scope": {
                      "type": "string",
                      "const": "business"
                    },
                    "sourceCoverage": {
                      "type": "string",
                      "const": "tallylane_issued"
                    },
                    "recentIssued": {
                      "type": "array",
                      "maxItems": 5,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "invoiceId",
                          "customerId",
                          "version",
                          "documentState",
                          "calculationState",
                          "number",
                          "net",
                          "vat",
                          "gross",
                          "createdAt",
                          "updatedAt",
                          "payment",
                          "due",
                          "accounting"
                        ],
                        "properties": {
                          "invoiceId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "customerId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 2,
                            "maximum": 2147483647
                          },
                          "documentState": {
                            "type": "string",
                            "const": "issued"
                          },
                          "calculationState": {
                            "type": "string",
                            "const": "calculated"
                          },
                          "number": {
                            "type": "string",
                            "pattern": "^TST-[0-9]{6,10}$"
                          },
                          "net": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "amount",
                              "currency"
                            ],
                            "properties": {
                              "amount": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                              },
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              }
                            }
                          },
                          "vat": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "amount",
                              "currency"
                            ],
                            "properties": {
                              "amount": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                              },
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              }
                            }
                          },
                          "gross": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "amount",
                              "currency"
                            ],
                            "properties": {
                              "amount": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                              },
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              }
                            }
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "payment": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "ledgerState",
                              "paymentState",
                              "amountCondition",
                              "confirmedAllocated",
                              "outstanding"
                            ],
                            "properties": {
                              "ledgerState": {
                                "type": "string",
                                "enum": [
                                  "verified",
                                  "needs_review"
                                ]
                              },
                              "paymentState": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "unpaid",
                                      "partially_paid",
                                      "paid"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "amountCondition": {
                                "type": "string",
                                "enum": [
                                  "positive_total",
                                  "no_payment_due",
                                  "needs_review"
                                ]
                              },
                              "confirmedAllocated": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "amount",
                                      "currency"
                                    ],
                                    "properties": {
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                                      },
                                      "currency": {
                                        "type": "string",
                                        "const": "GBP"
                                      }
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "outstanding": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "amount",
                                      "currency"
                                    ],
                                    "properties": {
                                      "amount": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                                      },
                                      "currency": {
                                        "type": "string",
                                        "const": "GBP"
                                      }
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            }
                          },
                          "due": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "dueDate",
                              "asOfDate",
                              "state"
                            ],
                            "properties": {
                              "dueDate": {
                                "type": "string",
                                "format": "date",
                                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                              },
                              "asOfDate": {
                                "type": "string",
                                "format": "date",
                                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                              },
                              "state": {
                                "type": "string",
                                "enum": [
                                  "not_due",
                                  "due_today",
                                  "overdue",
                                  "settled",
                                  "no_payment_due",
                                  "unknown"
                                ]
                              }
                            }
                          },
                          "accounting": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "state",
                              "verifiedAt"
                            ],
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "not_started",
                                  "in_progress",
                                  "needs_review",
                                  "synced"
                                ]
                              },
                              "verifiedAt": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            }
                          }
                        }
                      }
                    },
                    "receivables": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "completeness",
                        "issuedCount",
                        "outstandingInvoiceCount",
                        "outstandingMoney",
                        "overdueInvoiceCount",
                        "overdueMoney",
                        "dueNextSevenInvoiceCount",
                        "dueNextSevenMoney"
                      ],
                      "properties": {
                        "completeness": {
                          "type": "string",
                          "enum": [
                            "verified",
                            "needs_review"
                          ]
                        },
                        "issuedCount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 2147483647
                        },
                        "outstandingInvoiceCount": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 2147483647
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "outstandingMoney": {
                          "anyOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "amount",
                                "currency"
                              ],
                              "properties": {
                                "amount": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                                },
                                "currency": {
                                  "type": "string",
                                  "const": "GBP"
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "overdueInvoiceCount": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 2147483647
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "overdueMoney": {
                          "anyOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "amount",
                                "currency"
                              ],
                              "properties": {
                                "amount": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                                },
                                "currency": {
                                  "type": "string",
                                  "const": "GBP"
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "dueNextSevenInvoiceCount": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 2147483647
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "dueNextSevenMoney": {
                          "anyOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "amount",
                                "currency"
                              ],
                              "properties": {
                                "amount": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                                },
                                "currency": {
                                  "type": "string",
                                  "const": "GBP"
                                }
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed failure; no source rows returned.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed failure; no source rows returned.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "no-store, private"
                  ]
                }
              },
              "X-Content-Type-Options": {
                "required": false,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "WWW-Authenticate": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed failure; no source rows returned.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed failure; no source rows returned.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed failure; no source rows returned.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "business_overview_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoice-directory/export": {
      "get": {
        "operationId": "exportInvoiceDirectoryCsv",
        "summary": "Read a bounded filtered TEST invoice amount CSV",
        "description": "Five current invoice read roles. Closed filters once each; no after/limit, GET body/content/write headers or Range. One restricted RLS capture of at most 1000 matching rows with fresh current authority before the buffered file. 1001 matches fail with 422 and no partial file. No provider, model or financial command.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "documentState",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "draft",
                "issued"
              ],
              "default": "all"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9 -]+$",
              "description": "Trimmed ASCII substring. The response echoes lowercase normalization."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Complete captured amount CSV, at most 1000 matching TEST invoices. Zero matches yield the header only. No payment, outstanding or Xero facts; no pagination or partial file.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "Content-Disposition": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^attachment;"
                },
                "description": "Fixed tallylane-invoices.csv attachment."
              },
              "Tallylane-Export-Count": {
                "required": true,
                "schema": {
                  "type": "string",
                  "pattern": "^(?:0|[1-9][0-9]{0,2}|1000)$"
                },
                "description": "Captured rows in this file; not a later total or continuity token."
              }
            },
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "description": "UTF-8 without BOM; RFC4180 CRLF. Exact ten columns: invoice_id, customer_id, version, document_state, calculation_state, number, currency, net, vat, gross. Closed validated cells. Draft number and unresolved VAT/gross are empty, distinct from 0.00."
                }
              }
            }
          },
          "400": {
            "description": "Closed error; no CSV, export-count or attachment header.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed error; no CSV, export-count or attachment header.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "no-store, private"
                  ]
                }
              },
              "X-Content-Type-Options": {
                "required": false,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "WWW-Authenticate": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed error; no CSV, export-count or attachment header.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed error; no CSV, export-count or attachment header.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Closed error; no CSV, export-count or attachment header.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_export_limit_exceeded"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed error; no CSV, export-count or attachment header.",
            "headers": {
              "Cache-Control": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "no-store, private"
                }
              },
              "X-Content-Type-Options": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_export_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoice-approval-policy": {
      "get": {
        "operationId": "readInvoiceApprovalPolicy",
        "summary": "Read current invoice approval policy",
        "description": "Current owner/finance_admin; fresh signed active TEST session. Missing policy is independent_reviewer revision1. No query parameters; current eligibility is read under the membership serialization lock. No body/chunked transfer, query, Range, If-Match, Idempotency-Key or Tallylane-If-Version header is accepted.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required",
                        "test_issuance_disabled"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency, bounded timeout, missing issuance persistence or privileged runtime unavailable.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_approval_policy_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Validated scoped result; issue returns 200 only for durable replay.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "policy": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "independent_reviewer",
                            "single_owner"
                          ]
                        },
                        "revision": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "default",
                            "owner_decision"
                          ]
                        },
                        "receiptId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "ownerId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "mode",
                        "revision",
                        "source",
                        "receiptId",
                        "ownerId"
                      ],
                      "additionalProperties": false
                    },
                    "actorCanChange": {
                      "type": "boolean"
                    },
                    "singleOwnerEligible": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "policy",
                    "actorCanChange",
                    "singleOwnerEligible"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "changeInvoiceApprovalPolicy",
        "summary": "Explicitly change invoice approval policy",
        "description": "Owner-only human TEST command, explicit confirmed=true, expected policy revision, original nonzero UUID Idempotency-Key. Closed JSON, at most1024bytes, no duplicate keys/query/If-Match. Does not issue, change members/grants or grant agent/payment/accounting authority. single_owner requires exactly one active owner bound to this policy; non-owner team members remain. Immutable owner/session/membership-version receipt and common audit. Every change increments revision; previous proposals remain immutable and cannot acquire new meaning. Replay returns only original receipt after current owner/session check.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]*\"$"
            },
            "description": "Exact quoted positive Int32 Tallylane-Version from current detail. HTTP If-Match, weak/wildcard/list/duplicate/leading-zero tokens are rejected."
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid closed bounded request, query or command key",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or revoked provider session",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role denied or server environment is not test",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required",
                        "test_issuance_disabled"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Absent or inaccessible scoped parent/resource",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Dependency, bounded timeout, missing issuance persistence or privileged runtime unavailable.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_approval_policy_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Conflicting idempotent command, changed gate/state, expired proposal, blocked issuance or conflicting final decision.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Stale invoice/proposal version or legal/customer/calculation source changed.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "One canonical quoted Tallylane-If-Version required; If-Match is rejected",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Historical retained result with current actor capabilities.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "receiptId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "independent_reviewer",
                        "single_owner"
                      ]
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 2,
                      "maximum": 2147483647
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "receiptId",
                    "mode",
                    "revision",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "independent_reviewer",
                      "single_owner"
                    ]
                  },
                  "confirmed": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "required": [
                  "mode",
                  "confirmed"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/integrations/xero/history/settings": {
      "get": {
        "operationId": "ReadXeroHistorySettings",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Default-off owner-only TEST accounting read scope. Closed query/body and Range validation applies; commands additionally reject If-Match and require one canonical original key/version header. GET never dispatches provider HTTP or acknowledges an unknown POST.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded current-authority application acknowledgement or read; never full/current Xero ledger proof.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "sourceScope",
                    "connectionId",
                    "version",
                    "enabled",
                    "chosenAt",
                    "activeRunId"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "not": {
                        "const": "00000000-0000-0000-0000-000000000000"
                      }
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "sourceScope": {
                      "type": "string",
                      "const": "authorised_paid_accrec_gbp"
                    },
                    "connectionId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "not": {
                        "const": "00000000-0000-0000-0000-000000000000"
                      }
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 2147483647
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "chosenAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "activeRunId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict",
                        "import_busy",
                        "import_needs_review",
                        "import_quota_exceeded",
                        "token_refresh_busy",
                        "integration_needs_reconnect",
                        "import_rate_limited"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stale_version",
                        "context_changed"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "provider_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "ChooseXeroHistorySource",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Default-off owner-only TEST accounting read scope. Closed query/body and Range validation applies; commands additionally reject If-Match and require one canonical original key/version header. GET never dispatches provider HTTP or acknowledges an unknown POST.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:0|(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7]))\"$",
              "minLength": 3,
              "maxLength": 12
            },
            "description": "Exactly one canonical quoted Int32; original value retained on replay. If-Match is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded current-authority application acknowledgement or read; never full/current Xero ledger proof.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "receiptId",
                    "requestKey",
                    "operation",
                    "replayed",
                    "settingsSnapshot"
                  ],
                  "properties": {
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "not": {
                        "const": "00000000-0000-0000-0000-000000000000"
                      }
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "not": {
                        "const": "00000000-0000-0000-0000-000000000000"
                      }
                    },
                    "operation": {
                      "type": "string",
                      "const": "settings"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "settingsSnapshot": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "businessId",
                        "environment",
                        "role",
                        "sourceScope",
                        "connectionId",
                        "version",
                        "enabled",
                        "chosenAt"
                      ],
                      "properties": {
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "role": {
                          "type": "string",
                          "const": "owner"
                        },
                        "sourceScope": {
                          "type": "string",
                          "const": "authorised_paid_accrec_gbp"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 2147483647
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "chosenAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict",
                        "import_busy",
                        "import_needs_review",
                        "import_quota_exceeded",
                        "token_refresh_busy",
                        "integration_needs_reconnect",
                        "import_rate_limited"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stale_version",
                        "context_changed"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "provider_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "4096 UTF8 bytes maximum; fatal UTF8, closed exact decoded keys, duplicate or escaped property names rejected.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "connectionId",
                  "enabled",
                  "sourceScope"
                ],
                "properties": {
                  "connectionId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                    "not": {
                      "const": "00000000-0000-0000-0000-000000000000"
                    }
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "sourceScope": {
                    "type": "string",
                    "const": "authorised_paid_accrec_gbp"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/integrations/xero/history/imports": {
      "post": {
        "operationId": "ReserveXeroHistoryImport",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Default-off owner-only TEST accounting read scope. Closed query/body and Range validation applies; commands additionally reject If-Match and require one canonical original key/version header. GET never dispatches provider HTTP or acknowledges an unknown POST.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$",
              "minLength": 3,
              "maxLength": 12
            },
            "description": "Exactly one canonical quoted Int32; original value retained on replay. If-Match is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded current-authority application acknowledgement or read; never full/current Xero ledger proof.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "receiptId",
                    "requestKey",
                    "operation",
                    "replayed",
                    "run"
                  ],
                  "properties": {
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "not": {
                        "const": "00000000-0000-0000-0000-000000000000"
                      }
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "not": {
                        "const": "00000000-0000-0000-0000-000000000000"
                      }
                    },
                    "operation": {
                      "type": "string",
                      "const": "reserve"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "run": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "runId",
                        "businessId",
                        "environment",
                        "connectionId",
                        "settingsVersion",
                        "version",
                        "nextPage",
                        "state",
                        "startedAt",
                        "deadlineAt",
                        "lastObservationAt",
                        "safeFailureCategory"
                      ],
                      "properties": {
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "settingsVersion": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "nextPage": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 10
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "reserved",
                            "reading",
                            "partial",
                            "sweep_exhausted",
                            "needs_review",
                            "cancelled"
                          ]
                        },
                        "startedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "deadlineAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "lastObservationAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "safeFailureCategory": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "provider_unavailable",
                                "provider_rejected",
                                "source_conflict",
                                "page_bound",
                                "attempt_unknown"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict",
                        "import_busy",
                        "import_needs_review",
                        "import_quota_exceeded",
                        "token_refresh_busy",
                        "integration_needs_reconnect",
                        "import_rate_limited"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stale_version",
                        "context_changed"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "provider_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "4096 UTF8 bytes maximum; fatal UTF8, closed exact decoded keys, duplicate or escaped property names rejected.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "connectionId"
                ],
                "properties": {
                  "connectionId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                    "not": {
                      "const": "00000000-0000-0000-0000-000000000000"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/integrations/xero/history/imports/{runId}": {
      "get": {
        "operationId": "ReadXeroHistoryImport",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Default-off owner-only TEST accounting read scope. Closed query/body and Range validation applies; commands additionally reject If-Match and require one canonical original key/version header. GET never dispatches provider HTTP or acknowledges an unknown POST.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded current-authority application acknowledgement or read; never full/current Xero ledger proof.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "run",
                    "pageReceipts"
                  ],
                  "properties": {
                    "run": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "runId",
                        "businessId",
                        "environment",
                        "connectionId",
                        "settingsVersion",
                        "version",
                        "nextPage",
                        "state",
                        "startedAt",
                        "deadlineAt",
                        "lastObservationAt",
                        "safeFailureCategory"
                      ],
                      "properties": {
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "settingsVersion": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "nextPage": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 10
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "reserved",
                            "reading",
                            "partial",
                            "sweep_exhausted",
                            "needs_review",
                            "cancelled"
                          ]
                        },
                        "startedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "deadlineAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "lastObservationAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "safeFailureCategory": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "provider_unavailable",
                                "provider_rejected",
                                "source_conflict",
                                "page_bound",
                                "attempt_unknown"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "pageReceipts": {
                      "type": "array",
                      "maxItems": 10,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "receiptId",
                          "requestKey",
                          "runId",
                          "page",
                          "sourceRowCount",
                          "outcome",
                          "observedAt",
                          "createdAt"
                        ],
                        "properties": {
                          "receiptId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                            "not": {
                              "const": "00000000-0000-0000-0000-000000000000"
                            }
                          },
                          "requestKey": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                            "not": {
                              "const": "00000000-0000-0000-0000-000000000000"
                            }
                          },
                          "runId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                            "not": {
                              "const": "00000000-0000-0000-0000-000000000000"
                            }
                          },
                          "page": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 10
                          },
                          "sourceRowCount": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 100
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "outcome": {
                            "type": "string",
                            "enum": [
                              "persisted",
                              "not_read",
                              "unknown",
                              "rejected"
                            ]
                          },
                          "observedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "allOf": [
                          {
                            "if": {
                              "type": "object",
                              "properties": {
                                "outcome": {
                                  "type": "string",
                                  "const": "persisted"
                                }
                              },
                              "required": [
                                "outcome"
                              ]
                            },
                            "then": {
                              "type": "object",
                              "properties": {
                                "sourceRowCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 100
                                },
                                "observedAt": {
                                  "type": "string",
                                  "format": "date-time"
                                }
                              }
                            },
                            "else": {
                              "type": "object",
                              "properties": {
                                "sourceRowCount": {
                                  "type": "null"
                                },
                                "observedAt": {
                                  "type": "null"
                                }
                              }
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict",
                        "import_busy",
                        "import_needs_review",
                        "import_quota_exceeded",
                        "token_refresh_busy",
                        "integration_needs_reconnect",
                        "import_rate_limited"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stale_version",
                        "context_changed"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "provider_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/integrations/xero/history/imports/{runId}/pages": {
      "post": {
        "operationId": "ReadNextXeroHistoryPage",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Default-off owner-only TEST accounting read scope. Closed query/body and Range validation applies; commands additionally reject If-Match and require one canonical original key/version header. GET never dispatches provider HTTP or acknowledges an unknown POST.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$",
              "minLength": 3,
              "maxLength": 12
            },
            "description": "Exactly one canonical quoted Int32; original value retained on replay. If-Match is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded current-authority application acknowledgement or read; never full/current Xero ledger proof.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "receiptId",
                    "requestKey",
                    "operation",
                    "replayed",
                    "run",
                    "pageReceipt"
                  ],
                  "properties": {
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "not": {
                        "const": "00000000-0000-0000-0000-000000000000"
                      }
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "not": {
                        "const": "00000000-0000-0000-0000-000000000000"
                      }
                    },
                    "operation": {
                      "type": "string",
                      "const": "page"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "run": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "runId",
                        "businessId",
                        "environment",
                        "connectionId",
                        "settingsVersion",
                        "version",
                        "nextPage",
                        "state",
                        "startedAt",
                        "deadlineAt",
                        "lastObservationAt",
                        "safeFailureCategory"
                      ],
                      "properties": {
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "settingsVersion": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "nextPage": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 10
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "reserved",
                            "reading",
                            "partial",
                            "sweep_exhausted",
                            "needs_review",
                            "cancelled"
                          ]
                        },
                        "startedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "deadlineAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "lastObservationAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "safeFailureCategory": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "provider_unavailable",
                                "provider_rejected",
                                "source_conflict",
                                "page_bound",
                                "attempt_unknown"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "pageReceipt": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "receiptId",
                        "requestKey",
                        "runId",
                        "page",
                        "sourceRowCount",
                        "outcome",
                        "observedAt",
                        "createdAt"
                      ],
                      "properties": {
                        "receiptId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "requestKey": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 10
                        },
                        "sourceRowCount": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 100
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "outcome": {
                          "type": "string",
                          "enum": [
                            "persisted",
                            "not_read",
                            "unknown",
                            "rejected"
                          ]
                        },
                        "observedAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "allOf": [
                        {
                          "if": {
                            "type": "object",
                            "properties": {
                              "outcome": {
                                "type": "string",
                                "const": "persisted"
                              }
                            },
                            "required": [
                              "outcome"
                            ]
                          },
                          "then": {
                            "type": "object",
                            "properties": {
                              "sourceRowCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 100
                              },
                              "observedAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          },
                          "else": {
                            "type": "object",
                            "properties": {
                              "sourceRowCount": {
                                "type": "null"
                              },
                              "observedAt": {
                                "type": "null"
                              }
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict",
                        "import_busy",
                        "import_needs_review",
                        "import_quota_exceeded",
                        "token_refresh_busy",
                        "integration_needs_reconnect",
                        "import_rate_limited"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stale_version",
                        "context_changed"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "provider_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "4096 UTF8 bytes maximum; fatal UTF8, closed exact decoded keys, duplicate or escaped property names rejected.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [],
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/integrations/xero/history/imports/{runId}/cancel": {
      "post": {
        "operationId": "CancelXeroHistoryImport",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Default-off owner-only TEST accounting read scope. Closed query/body and Range validation applies; commands additionally reject If-Match and require one canonical original key/version header. GET never dispatches provider HTTP or acknowledges an unknown POST.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$",
              "minLength": 3,
              "maxLength": 12
            },
            "description": "Exactly one canonical quoted Int32; original value retained on replay. If-Match is forbidden."
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded current-authority application acknowledgement or read; never full/current Xero ledger proof.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "receiptId",
                    "requestKey",
                    "operation",
                    "replayed",
                    "run"
                  ],
                  "properties": {
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "not": {
                        "const": "00000000-0000-0000-0000-000000000000"
                      }
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "not": {
                        "const": "00000000-0000-0000-0000-000000000000"
                      }
                    },
                    "operation": {
                      "type": "string",
                      "const": "cancel"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "run": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "runId",
                        "businessId",
                        "environment",
                        "connectionId",
                        "settingsVersion",
                        "version",
                        "nextPage",
                        "state",
                        "startedAt",
                        "deadlineAt",
                        "lastObservationAt",
                        "safeFailureCategory"
                      ],
                      "properties": {
                        "runId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "connectionId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        "settingsVersion": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "nextPage": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 10
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "reserved",
                            "reading",
                            "partial",
                            "sweep_exhausted",
                            "needs_review",
                            "cancelled"
                          ]
                        },
                        "startedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "deadlineAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "lastObservationAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "safeFailureCategory": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "provider_unavailable",
                                "provider_rejected",
                                "source_conflict",
                                "page_bound",
                                "attempt_unknown"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict",
                        "import_busy",
                        "import_needs_review",
                        "import_quota_exceeded",
                        "token_refresh_busy",
                        "integration_needs_reconnect",
                        "import_rate_limited"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stale_version",
                        "context_changed"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "provider_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "4096 UTF8 bytes maximum; fatal UTF8, closed exact decoded keys, duplicate or escaped property names rejected.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [],
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/integrations/xero/history/invoices": {
      "get": {
        "operationId": "ReadXeroHistoryObservations",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Default-off owner-only TEST accounting read scope. Closed query/body and Range validation applies; commands additionally reject If-Match and require one canonical original key/version header. GET never dispatches provider HTTP or acknowledges an unknown POST.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^(?:[1-9][0-9]?|100)$",
              "default": "50"
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
              "not": {
                "const": "00000000-0000-0000-0000-000000000000"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bounded current-authority application acknowledgement or read; never full/current Xero ledger proof.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "readOnly",
                    "sourceCoverage",
                    "snapshotConsistency",
                    "freshness",
                    "readAt",
                    "coverage",
                    "invoices",
                    "nextCursor"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                      "not": {
                        "const": "00000000-0000-0000-0000-000000000000"
                      }
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "sourceCoverage": {
                      "type": "string",
                      "const": "xero_history_observations"
                    },
                    "snapshotConsistency": {
                      "type": "string",
                      "const": "paged_observations"
                    },
                    "freshness": {
                      "type": "string",
                      "const": "observed_only"
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "coverage": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "scope",
                        "state",
                        "lastObservationAt",
                        "lastSweepExhaustedAt"
                      ],
                      "properties": {
                        "scope": {
                          "type": "string",
                          "const": "authorised_paid_accrec_gbp"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "not_started",
                            "partial",
                            "sweep_exhausted",
                            "needs_review"
                          ]
                        },
                        "lastObservationAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lastSweepExhaustedAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "invoices": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "internalRecordId",
                          "version",
                          "source",
                          "invoiceNumber",
                          "providerStatus",
                          "invoiceDate",
                          "dueDate",
                          "providerUpdatedAt",
                          "observedAt",
                          "net",
                          "vat",
                          "gross",
                          "paid",
                          "due",
                          "credited",
                          "linkState",
                          "localInvoiceId"
                        ],
                        "properties": {
                          "internalRecordId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                            "not": {
                              "const": "00000000-0000-0000-0000-000000000000"
                            }
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "source": {
                            "type": "string",
                            "const": "xero"
                          },
                          "invoiceNumber": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f]+$"
                          },
                          "providerStatus": {
                            "type": "string",
                            "enum": [
                              "AUTHORISED",
                              "PAID"
                            ]
                          },
                          "invoiceDate": {
                            "type": "string",
                            "format": "date"
                          },
                          "dueDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "providerUpdatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "observedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "net": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "currency",
                              "amount"
                            ],
                            "properties": {
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^(?:0|[1-9][0-9]{0,18})\\.[0-9]{2}$",
                                "minLength": 4,
                                "maxLength": 22
                              }
                            }
                          },
                          "vat": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "currency",
                              "amount"
                            ],
                            "properties": {
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^(?:0|[1-9][0-9]{0,18})\\.[0-9]{2}$",
                                "minLength": 4,
                                "maxLength": 22
                              }
                            }
                          },
                          "gross": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "currency",
                              "amount"
                            ],
                            "properties": {
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^(?:0|[1-9][0-9]{0,18})\\.[0-9]{2}$",
                                "minLength": 4,
                                "maxLength": 22
                              }
                            }
                          },
                          "paid": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "currency",
                              "amount"
                            ],
                            "properties": {
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^(?:0|[1-9][0-9]{0,18})\\.[0-9]{2}$",
                                "minLength": 4,
                                "maxLength": 22
                              }
                            }
                          },
                          "due": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "currency",
                              "amount"
                            ],
                            "properties": {
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^(?:0|[1-9][0-9]{0,18})\\.[0-9]{2}$",
                                "minLength": 4,
                                "maxLength": 22
                              }
                            }
                          },
                          "credited": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "currency",
                              "amount"
                            ],
                            "properties": {
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^(?:0|[1-9][0-9]{0,18})\\.[0-9]{2}$",
                                "minLength": 4,
                                "maxLength": 22
                              }
                            }
                          },
                          "linkState": {
                            "type": "string",
                            "enum": [
                              "external_only",
                              "linked_local",
                              "needs_review"
                            ]
                          },
                          "localInvoiceId": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                                "not": {
                                  "const": "00000000-0000-0000-0000-000000000000"
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "allOf": [
                          {
                            "if": {
                              "type": "object",
                              "properties": {
                                "linkState": {
                                  "type": "string",
                                  "const": "linked_local"
                                }
                              },
                              "required": [
                                "linkState"
                              ]
                            },
                            "then": {
                              "type": "object",
                              "properties": {
                                "localInvoiceId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                                  "not": {
                                    "const": "00000000-0000-0000-0000-000000000000"
                                  }
                                }
                              }
                            },
                            "else": {
                              "type": "object",
                              "properties": {
                                "localInvoiceId": {
                                  "type": "null"
                                }
                              }
                            }
                          }
                        ]
                      }
                    },
                    "nextCursor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
                          "not": {
                            "const": "00000000-0000-0000-0000-000000000000"
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict",
                        "import_busy",
                        "import_needs_review",
                        "import_quota_exceeded",
                        "token_refresh_busy",
                        "integration_needs_reconnect",
                        "import_rate_limited"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "stale_version",
                        "context_changed"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed redacted error; no provider body or token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "integration_unavailable",
                        "provider_unavailable",
                        "dependency_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-mfa": {
      "get": {
        "operationId": "readPartnerMfa",
        "tags": [
          "Partner MFA TEST"
        ],
        "summary": "readPartnerMfa",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "description": "Partners:StepUpEnabled=true and Platform:Environment=test plus genuine current owner/session and finite private25 purpose grant required. Query, Range and GET body/content/command headers are rejected. No factor enrollment, provider effect, partner consent or permission provisioning in API. API JSON body maximum1024 UTF8 bytes; old keys do not renew deadlines.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Default-off TEST current-owner read/acknowledgement. Dispatch reservation is neither provider acceptance nor MFA proof. Current directory facts never acknowledge an attempt.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "factorIds",
                    "currentElevation"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "const": "test",
                      "type": "string"
                    },
                    "role": {
                      "const": "owner",
                      "type": "string"
                    },
                    "factorIds": {
                      "type": "array",
                      "maxItems": 20,
                      "uniqueItems": true,
                      "items": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                      }
                    },
                    "currentElevation": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "verifiedAt",
                            "expiresAt"
                          ],
                          "properties": {
                            "state": {
                              "const": "not_confirmed",
                              "type": "string"
                            },
                            "verifiedAt": {
                              "type": "null"
                            },
                            "expiresAt": {
                              "type": "null"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "state",
                            "verifiedAt",
                            "expiresAt"
                          ],
                          "properties": {
                            "state": {
                              "const": "fresh_verified",
                              "type": "string"
                            },
                            "verifiedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "invalid_request",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "unauthorized",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "partner_mfa_access_denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_access_denied",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "not_found",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "partner_mfa_conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_conflict",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "partner_mfa_unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_unavailable",
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-mfa/intents": {
      "post": {
        "operationId": "reservePartnerMfaIntent",
        "tags": [
          "Partner MFA TEST"
        ],
        "summary": "reservePartnerMfaIntent",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "description": "Partners:StepUpEnabled=true and Platform:Environment=test plus genuine current owner/session and finite private25 purpose grant required. Query, Range and GET body/content/command headers are rejected. No factor enrollment, provider effect, partner consent or permission provisioning in API. API JSON body maximum1024 UTF8 bytes; old keys do not renew deadlines.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$"
            },
            "description": "One canonical quoted positive Int32. Reserve requires version1; commands compare the original current intent version. No weak/unquoted/If-Match syntax."
          }
        ],
        "responses": {
          "200": {
            "description": "Default-off TEST current-owner read/acknowledgement. Dispatch reservation is neither provider acceptance nor MFA proof. Current directory facts never acknowledge an attempt.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-4]\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "intent",
                    "receipts",
                    "replayed",
                    "dispatchAllowed"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "const": "test",
                      "type": "string"
                    },
                    "role": {
                      "const": "owner",
                      "type": "string"
                    },
                    "intent": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "intentId",
                        "factorId",
                        "version",
                        "createdAt",
                        "expiresAt",
                        "state"
                      ],
                      "properties": {
                        "intentId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "factorId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "awaiting_challenge",
                            "challenge_claimed",
                            "verification_claimed",
                            "cancelled",
                            "expired"
                          ]
                        }
                      }
                    },
                    "receipts": {
                      "type": "array",
                      "maxItems": 3,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "receiptId",
                          "requestKey",
                          "operation",
                          "intentId",
                          "version",
                          "createdAt"
                        ],
                        "properties": {
                          "receiptId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "requestKey": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "operation": {
                            "type": "string",
                            "enum": [
                              "challenge",
                              "verify",
                              "cancel"
                            ]
                          },
                          "intentId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 2,
                            "maximum": 4
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dispatchAllowed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "invalid_request",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "unauthorized",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "partner_mfa_access_denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_access_denied",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "not_found",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "partner_mfa_conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_conflict",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "partner_mfa_version_conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_version_conflict",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "428": {
            "description": "version_required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "version_required",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "partner_mfa_unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_unavailable",
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "factorId"
                ],
                "properties": {
                  "factorId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-mfa/intents/{intentId}": {
      "get": {
        "operationId": "readPartnerMfaIntent",
        "tags": [
          "Partner MFA TEST"
        ],
        "summary": "readPartnerMfaIntent",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "description": "Partners:StepUpEnabled=true and Platform:Environment=test plus genuine current owner/session and finite private25 purpose grant required. Query, Range and GET body/content/command headers are rejected. No factor enrollment, provider effect, partner consent or permission provisioning in API. API JSON body maximum1024 UTF8 bytes; old keys do not renew deadlines.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "intentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Default-off TEST current-owner read/acknowledgement. Dispatch reservation is neither provider acceptance nor MFA proof. Current directory facts never acknowledge an attempt.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-4]\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "intent",
                    "receipts",
                    "replayed",
                    "dispatchAllowed"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "const": "test",
                      "type": "string"
                    },
                    "role": {
                      "const": "owner",
                      "type": "string"
                    },
                    "intent": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "intentId",
                        "factorId",
                        "version",
                        "createdAt",
                        "expiresAt",
                        "state"
                      ],
                      "properties": {
                        "intentId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "factorId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "awaiting_challenge",
                            "challenge_claimed",
                            "verification_claimed",
                            "cancelled",
                            "expired"
                          ]
                        }
                      }
                    },
                    "receipts": {
                      "type": "array",
                      "maxItems": 3,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "receiptId",
                          "requestKey",
                          "operation",
                          "intentId",
                          "version",
                          "createdAt"
                        ],
                        "properties": {
                          "receiptId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "requestKey": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "operation": {
                            "type": "string",
                            "enum": [
                              "challenge",
                              "verify",
                              "cancel"
                            ]
                          },
                          "intentId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 2,
                            "maximum": 4
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dispatchAllowed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "invalid_request",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "unauthorized",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "partner_mfa_access_denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_access_denied",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "not_found",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "partner_mfa_conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_conflict",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "partner_mfa_unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_unavailable",
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-mfa/intents/{intentId}/claim": {
      "post": {
        "operationId": "claimPartnerMfaDispatch",
        "tags": [
          "Partner MFA TEST"
        ],
        "summary": "claimPartnerMfaDispatch",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "description": "Partners:StepUpEnabled=true and Platform:Environment=test plus genuine current owner/session and finite private25 purpose grant required. Query, Range and GET body/content/command headers are rejected. No factor enrollment, provider effect, partner consent or permission provisioning in API. API JSON body maximum1024 UTF8 bytes; old keys do not renew deadlines.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "intentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$"
            },
            "description": "One canonical quoted positive Int32. Reserve requires version1; commands compare the original current intent version. No weak/unquoted/If-Match syntax."
          }
        ],
        "responses": {
          "200": {
            "description": "Default-off TEST current-owner read/acknowledgement. Dispatch reservation is neither provider acceptance nor MFA proof. Current directory facts never acknowledge an attempt.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-4]\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "intent",
                    "receipts",
                    "replayed",
                    "dispatchAllowed"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "const": "test",
                      "type": "string"
                    },
                    "role": {
                      "const": "owner",
                      "type": "string"
                    },
                    "intent": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "intentId",
                        "factorId",
                        "version",
                        "createdAt",
                        "expiresAt",
                        "state"
                      ],
                      "properties": {
                        "intentId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "factorId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "awaiting_challenge",
                            "challenge_claimed",
                            "verification_claimed",
                            "cancelled",
                            "expired"
                          ]
                        }
                      }
                    },
                    "receipts": {
                      "type": "array",
                      "maxItems": 3,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "receiptId",
                          "requestKey",
                          "operation",
                          "intentId",
                          "version",
                          "createdAt"
                        ],
                        "properties": {
                          "receiptId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "requestKey": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "operation": {
                            "type": "string",
                            "enum": [
                              "challenge",
                              "verify",
                              "cancel"
                            ]
                          },
                          "intentId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 2,
                            "maximum": 4
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dispatchAllowed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "invalid_request",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "unauthorized",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "partner_mfa_access_denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_access_denied",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "not_found",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "partner_mfa_conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_conflict",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "partner_mfa_version_conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_version_conflict",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "428": {
            "description": "version_required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "version_required",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "partner_mfa_unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_unavailable",
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "operation",
                      "challengeId",
                      "challengeExpiresAt"
                    ],
                    "properties": {
                      "operation": {
                        "const": "challenge",
                        "type": "string"
                      },
                      "challengeId": {
                        "type": "null"
                      },
                      "challengeExpiresAt": {
                        "type": "null"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "operation",
                      "challengeId",
                      "challengeExpiresAt"
                    ],
                    "properties": {
                      "operation": {
                        "const": "verify",
                        "type": "string"
                      },
                      "challengeId": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                      },
                      "challengeExpiresAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/partner-mfa/intents/{intentId}/cancel": {
      "post": {
        "operationId": "cancelPartnerMfaIntent",
        "tags": [
          "Partner MFA TEST"
        ],
        "summary": "cancelPartnerMfaIntent",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "description": "Partners:StepUpEnabled=true and Platform:Environment=test plus genuine current owner/session and finite private25 purpose grant required. Query, Range and GET body/content/command headers are rejected. No factor enrollment, provider effect, partner consent or permission provisioning in API. API JSON body maximum1024 UTF8 bytes; old keys do not renew deadlines.",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "intentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$"
            },
            "description": "One canonical quoted positive Int32. Reserve requires version1; commands compare the original current intent version. No weak/unquoted/If-Match syntax."
          }
        ],
        "responses": {
          "200": {
            "description": "Default-off TEST current-owner read/acknowledgement. Dispatch reservation is neither provider acceptance nor MFA proof. Current directory facts never acknowledge an attempt.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-4]\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "intent",
                    "receipts",
                    "replayed",
                    "dispatchAllowed"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "environment": {
                      "const": "test",
                      "type": "string"
                    },
                    "role": {
                      "const": "owner",
                      "type": "string"
                    },
                    "intent": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "intentId",
                        "factorId",
                        "version",
                        "createdAt",
                        "expiresAt",
                        "state"
                      ],
                      "properties": {
                        "intentId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "factorId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "awaiting_challenge",
                            "challenge_claimed",
                            "verification_claimed",
                            "cancelled",
                            "expired"
                          ]
                        }
                      }
                    },
                    "receipts": {
                      "type": "array",
                      "maxItems": 3,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "receiptId",
                          "requestKey",
                          "operation",
                          "intentId",
                          "version",
                          "createdAt"
                        ],
                        "properties": {
                          "receiptId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "requestKey": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "operation": {
                            "type": "string",
                            "enum": [
                              "challenge",
                              "verify",
                              "cancel"
                            ]
                          },
                          "intentId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000$)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 2,
                            "maximum": 4
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "dispatchAllowed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "invalid_request",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "unauthorized",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "partner_mfa_access_denied",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_access_denied",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "not_found",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "partner_mfa_conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_conflict",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "partner_mfa_version_conflict",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_version_conflict",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "428": {
            "description": "version_required",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "version_required",
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "partner_mfa_unavailable",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store",
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "const": "partner_mfa_unavailable",
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [],
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/postmark/invoice-delivery": {
      "post": {
        "operationId": "ingestSandboxInvoiceDeliveryEvent",
        "summary": "Append authenticated Delivery/Bounce observations of an exact retained Sandbox message",
        "description": "Default-off TEST only. HTTPS and dedicated HTTP Basic authentication at service; trusted-edge Postmark IP allowlist separately required before activation. Postmark does not provide HMAC signatures. No human JWT or metadata tenant authority. Only unique exact sandbox_accepted MessageID/server/retained-recipient correlation; unknown/unmapped early callback503 remains retryable. Atomic immutable event/redacted audit before200. Stable trace alias and semantic dedup; collisions409; bounded events429. No send/suppression/payment/accounting commands. Raw Content/Details/Metadata discarded.",
        "security": [
          {
            "PostmarkWebhookBasic": []
          }
        ],
        "parameters": [
          {
            "name": "X-PM-Webhook-Trace-Id",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Official evolving Delivery/Bounce provider JSON, max32768bytes/depth5. Duplicate fields rejected recursively; only required normalized facts retained.",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "RecordType": {
                        "type": "string",
                        "const": "Delivery"
                      },
                      "ServerID": {
                        "type": "integer",
                        "const": 21099611
                      },
                      "MessageStream": {
                        "type": "string",
                        "const": "outbound"
                      },
                      "MessageID": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "Recipient": {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 254
                      },
                      "DeliveredAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "RecordType",
                      "ServerID",
                      "MessageStream",
                      "MessageID",
                      "Recipient",
                      "DeliveredAt"
                    ],
                    "additionalProperties": true
                  },
                  {
                    "type": "object",
                    "properties": {
                      "RecordType": {
                        "type": "string",
                        "const": "Bounce"
                      },
                      "ServerID": {
                        "type": "integer",
                        "const": 21099611
                      },
                      "MessageStream": {
                        "type": "string",
                        "const": "outbound"
                      },
                      "MessageID": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "Email": {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 254
                      },
                      "BouncedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "ID": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "TypeCode": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "RecordType",
                      "ServerID",
                      "MessageStream",
                      "MessageID",
                      "Email",
                      "BouncedAt",
                      "ID",
                      "TypeCode"
                    ],
                    "additionalProperties": true
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Durably recorded exact event or idempotent duplicate.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "received": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "received"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Permanent malformed/foreign-server event rejection.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_event"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Dedicated authentication/TLS missing; no secret details.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Ingress finite role permit unavailable.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Unambiguous correlation/recipient/identity conflict.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "delivery_event_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Bounded retained evidence capacity; no acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "delivery_event_capacity"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Disabled/dependency or early unmapped message; not acknowledged.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_delivery_events_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/delivery-timeline": {
      "get": {
        "operationId": "readSandboxInvoiceDeliveryTimeline",
        "summary": "Read scoped immutable outgoing TEST invoice communication evidence",
        "description": "Fresh current owner or finance_admin and immutable issued TEST snapshot required. Latest100 deterministic chronological entries; truncated true means older facts exist. Application preparation/submission and Postmark Sandbox delivery/bounce observations remain distinct. No real inbox/payment/accounting proof or provider effect. Existing delivery GET unchanged. Reject body/query/range/command headers.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "businessId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "invoiceId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sandbox only, read-only evidence.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "deliveryType": {
                      "type": "string",
                      "const": "sandbox"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "events": {
                      "type": "array",
                      "maxItems": 100,
                      "items": {
                        "type": "object",
                        "properties": {
                          "eventId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "preparationId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "email_prepared",
                              "sandbox_submission_reserved",
                              "sandbox_submission_accepted",
                              "sandbox_submission_unknown",
                              "sandbox_submission_failed",
                              "sandbox_delivery_observed",
                              "sandbox_bounce_observed"
                            ]
                          },
                          "occurredAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "recordedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "application",
                              "postmark_sandbox"
                            ]
                          },
                          "recipient": {
                            "type": "string",
                            "minLength": 3,
                            "maxLength": 254
                          },
                          "bounceTypeCode": {
                            "oneOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "integer",
                                "minimum": 0
                              }
                            ]
                          }
                        },
                        "required": [
                          "eventId",
                          "preparationId",
                          "kind",
                          "occurredAt",
                          "recordedAt",
                          "source",
                          "recipient",
                          "bounceTypeCode"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "truncated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "environment",
                    "deliveryType",
                    "invoiceId",
                    "events",
                    "truncated"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Malformed closed read.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Genuine current session required",
            "headers": {
              "Cache-Control": {
                "description": "Bearer middleware challenges use no-store; early service rejection may include private.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current role/session denied.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Invoice absent from current scope.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Immutable context inconsistent.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "delivery_event_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Disabled/unavailable sanitized dependency.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "Referrer-Policy": {
                "schema": {
                  "type": "string",
                  "const": "no-referrer"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "X-Robots-Tag": {
                "schema": {
                  "type": "string",
                  "const": "noindex, nofollow"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_delivery_events_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/agent-runs/{runId}/reminder-preparations/{preparationId}/communication-narrative": {
      "get": {
        "summary": "Read source-derived communication facts",
        "operationId": "readCollectionsCommunicationNarrative",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "preparationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One captured source snapshot; no permission or recipient-delivery claim.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "runId",
                    "preparationId",
                    "invoiceId",
                    "environment",
                    "role",
                    "readOnly",
                    "financialExecutionAllowed",
                    "realDeliveryAllowed",
                    "readAt",
                    "templateVersion",
                    "preparation",
                    "payment",
                    "attempt",
                    "senderPrerequisite",
                    "recipientDeliveryProof",
                    "statementCodes"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "runId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "preparationId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "finance_admin",
                        "finance_operator",
                        "bookkeeper",
                        "viewer"
                      ]
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "financialExecutionAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "realDeliveryAllowed": {
                      "type": "boolean",
                      "const": false
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "templateVersion": {
                      "type": "string",
                      "const": "COLLECTIONS_COMMUNICATION_FACTS_V1"
                    },
                    "preparation": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "preparedAt",
                            "expiresAt",
                            "sourceState",
                            "freshUntil"
                          ],
                          "properties": {
                            "preparedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "sourceState": {
                              "type": "string",
                              "const": "current"
                            },
                            "freshUntil": {
                              "type": "string",
                              "format": "date-time"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "preparedAt",
                            "expiresAt",
                            "sourceState",
                            "freshUntil"
                          ],
                          "properties": {
                            "preparedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "sourceState": {
                              "type": "string",
                              "const": "historical"
                            },
                            "freshUntil": {
                              "type": "null"
                            }
                          }
                        }
                      ]
                    },
                    "payment": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "ledgerState",
                            "paymentState",
                            "amountCondition",
                            "confirmedAllocated",
                            "outstanding"
                          ],
                          "properties": {
                            "ledgerState": {
                              "type": "string",
                              "const": "verified"
                            },
                            "paymentState": {
                              "type": "string",
                              "enum": [
                                "unpaid",
                                "partially_paid",
                                "paid"
                              ]
                            },
                            "amountCondition": {
                              "type": "string",
                              "const": "positive_total"
                            },
                            "confirmedAllocated": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "amount",
                                "currency"
                              ],
                              "properties": {
                                "amount": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                                },
                                "currency": {
                                  "type": "string",
                                  "const": "GBP"
                                }
                              }
                            },
                            "outstanding": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "amount",
                                "currency"
                              ],
                              "properties": {
                                "amount": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,18})\\.[0-9]{2}$"
                                },
                                "currency": {
                                  "type": "string",
                                  "const": "GBP"
                                }
                              }
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "ledgerState",
                            "paymentState",
                            "amountCondition",
                            "confirmedAllocated",
                            "outstanding"
                          ],
                          "properties": {
                            "ledgerState": {
                              "type": "string",
                              "const": "needs_review"
                            },
                            "paymentState": {
                              "type": "null"
                            },
                            "amountCondition": {
                              "type": "string",
                              "const": "needs_review"
                            },
                            "confirmedAllocated": {
                              "type": "null"
                            },
                            "outstanding": {
                              "type": "null"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "ledgerState",
                            "paymentState",
                            "amountCondition",
                            "confirmedAllocated",
                            "outstanding"
                          ],
                          "properties": {
                            "ledgerState": {
                              "type": "string",
                              "const": "verified"
                            },
                            "paymentState": {
                              "type": "string",
                              "const": "unpaid"
                            },
                            "amountCondition": {
                              "type": "string",
                              "const": "no_payment_due"
                            },
                            "confirmedAllocated": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "amount",
                                "currency"
                              ],
                              "properties": {
                                "amount": {
                                  "type": "string",
                                  "const": "0.00"
                                },
                                "currency": {
                                  "type": "string",
                                  "const": "GBP"
                                }
                              }
                            },
                            "outstanding": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "amount",
                                "currency"
                              ],
                              "properties": {
                                "amount": {
                                  "type": "string",
                                  "const": "0.00"
                                },
                                "currency": {
                                  "type": "string",
                                  "const": "GBP"
                                }
                              }
                            }
                          }
                        }
                      ]
                    },
                    "attempt": {
                      "anyOf": [
                        {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "submissionId",
                                "state",
                                "startedAt",
                                "finishedAt"
                              ],
                              "properties": {
                                "submissionId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                },
                                "state": {
                                  "type": "string",
                                  "const": "processing"
                                },
                                "startedAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "finishedAt": {
                                  "type": "null"
                                }
                              }
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "submissionId",
                                "state",
                                "startedAt",
                                "finishedAt"
                              ],
                              "properties": {
                                "submissionId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                },
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "failed",
                                    "sandbox_accepted"
                                  ]
                                },
                                "startedAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "finishedAt": {
                                  "type": "string",
                                  "format": "date-time"
                                }
                              }
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "submissionId",
                                "state",
                                "startedAt",
                                "finishedAt"
                              ],
                              "properties": {
                                "submissionId": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                },
                                "state": {
                                  "type": "string",
                                  "const": "unknown"
                                },
                                "startedAt": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "finishedAt": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "format": "date-time"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              }
                            }
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "senderPrerequisite": {
                      "type": "string",
                      "enum": [
                        "confirmed",
                        "unconfirmed"
                      ]
                    },
                    "recipientDeliveryProof": {
                      "type": "string",
                      "const": "not_proven"
                    },
                    "statementCodes": {
                      "type": "array",
                      "minItems": 5,
                      "maxItems": 5,
                      "uniqueItems": true,
                      "items": {
                        "type": "string",
                        "enum": [
                          "preparation_source_current",
                          "preparation_source_historical",
                          "current_balance_unverified",
                          "no_payment_due",
                          "current_balance_settled",
                          "current_balance_outstanding",
                          "no_bound_attempt",
                          "sandbox_acceptance_recorded",
                          "bound_attempt_processing",
                          "bound_attempt_unknown",
                          "bound_attempt_failed",
                          "application_sender_prerequisite_confirmed",
                          "application_sender_prerequisite_unconfirmed",
                          "recipient_delivery_not_proven"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "unauthorized"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "access_denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "access_denied"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "not_found"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "communication_narrative_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "communication_narrative_unavailable"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/workspace-account": {
      "get": {
        "operationId": "readWorkspaceAccount",
        "summary": "readWorkspaceAccount",
        "description": "Fresh verified human/current TEST session and independent finite platform-admin grant. Read-only receipt lookups never perform provider work. Unknown recovery never creates another identity. Password is request transit only, never response or storage.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]{0,9}\"$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "userId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "accountMode": {
                      "type": "string",
                      "enum": [
                        "platform_admin",
                        "managed_customer",
                        "legacy"
                      ]
                    },
                    "assignedBusinessId": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "bindingId": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "canCreateBusiness": {
                      "type": "boolean",
                      "const": false
                    },
                    "adminAccess": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "userId",
                    "environment",
                    "accountMode",
                    "assignedBusinessId",
                    "bindingId",
                    "canCreateBusiness",
                    "adminAccess"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/access": {
      "get": {
        "operationId": "readPlatformAdminAccess",
        "summary": "readPlatformAdminAccess",
        "description": "Fresh verified human/current TEST session and independent finite platform-admin grant. Read-only receipt lookups never perform provider work. Unknown recovery never creates another identity. Password is request transit only, never response or storage.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]{0,9}\"$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "userId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "platform_admin"
                    },
                    "grantRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "scopes": {
                      "oneOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "directory:read"
                          ],
                          "minItems": 1,
                          "maxItems": 1
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "accounts:create"
                          ],
                          "minItems": 1,
                          "maxItems": 1
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "accounts:lifecycle"
                          ],
                          "minItems": 1,
                          "maxItems": 1
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "directory:read",
                            "accounts:create"
                          ],
                          "minItems": 2,
                          "maxItems": 2
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "directory:read",
                            "accounts:lifecycle"
                          ],
                          "minItems": 2,
                          "maxItems": 2
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "accounts:create",
                            "directory:read"
                          ],
                          "minItems": 2,
                          "maxItems": 2
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "accounts:create",
                            "accounts:lifecycle"
                          ],
                          "minItems": 2,
                          "maxItems": 2
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "accounts:lifecycle",
                            "directory:read"
                          ],
                          "minItems": 2,
                          "maxItems": 2
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "accounts:lifecycle",
                            "accounts:create"
                          ],
                          "minItems": 2,
                          "maxItems": 2
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "directory:read",
                            "accounts:create",
                            "accounts:lifecycle"
                          ],
                          "minItems": 3,
                          "maxItems": 3
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "directory:read",
                            "accounts:lifecycle",
                            "accounts:create"
                          ],
                          "minItems": 3,
                          "maxItems": 3
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "accounts:create",
                            "directory:read",
                            "accounts:lifecycle"
                          ],
                          "minItems": 3,
                          "maxItems": 3
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "accounts:create",
                            "accounts:lifecycle",
                            "directory:read"
                          ],
                          "minItems": 3,
                          "maxItems": 3
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "accounts:lifecycle",
                            "directory:read",
                            "accounts:create"
                          ],
                          "minItems": 3,
                          "maxItems": 3
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "directory:read",
                              "accounts:create",
                              "accounts:lifecycle"
                            ]
                          },
                          "const": [
                            "accounts:lifecycle",
                            "accounts:create",
                            "directory:read"
                          ],
                          "minItems": 3,
                          "maxItems": 3
                        }
                      ]
                    }
                  },
                  "required": [
                    "userId",
                    "environment",
                    "role",
                    "grantRevision",
                    "expiresAt",
                    "scopes"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/businesses": {
      "get": {
        "operationId": "readAdminBusinesses",
        "summary": "readAdminBusinesses",
        "description": "Fresh verified human/current TEST session and independent finite platform-admin grant. Read-only receipt lookups never perform provider work. Unknown recovery never creates another identity. Password is request transit only, never response or storage.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "kind": {
                      "type": "string",
                      "const": "businesses"
                    },
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "businessId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "environment": {
                            "type": "string",
                            "const": "test"
                          },
                          "legalNameMasked": {
                            "type": "string",
                            "maxLength": 5
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "suspended"
                            ]
                          },
                          "onboardingState": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "ready"
                            ]
                          },
                          "legalName": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300,
                            "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                          }
                        },
                        "required": [
                          "businessId",
                          "environment",
                          "legalNameMasked",
                          "status",
                          "onboardingState",
                          "legalName"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 50
                    },
                    "nextAfter": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "environment",
                    "kind",
                    "entries",
                    "nextAfter",
                    "readOnly"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/customer-accounts": {
      "get": {
        "operationId": "readAdminCustomerAccounts",
        "summary": "readAdminCustomerAccounts",
        "description": "Fresh verified human/current TEST session and independent finite platform-admin grant. Read-only receipt lookups never perform provider work. Unknown recovery never creates another identity. Password is request transit only, never response or storage.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "kind": {
                      "type": "string",
                      "const": "accounts"
                    },
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "accountId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "suspended"
                            ]
                          },
                          "emailMasked": {
                            "oneOf": [
                              {
                                "type": "string",
                                "maxLength": 259
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "accountMode": {
                            "type": "string",
                            "enum": [
                              "legacy",
                              "managed_customer"
                            ]
                          },
                          "bindingId": {
                            "oneOf": [
                              {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "assignedBusinessId": {
                            "oneOf": [
                              {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "email": {
                            "oneOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 254,
                                "pattern": "^[^\\u0000-\\u001F\\u007F]+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "accountId",
                          "status",
                          "emailMasked",
                          "accountMode",
                          "bindingId",
                          "assignedBusinessId",
                          "email"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 50
                    },
                    "nextAfter": {
                      "oneOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "environment",
                    "kind",
                    "entries",
                    "nextAfter",
                    "readOnly"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createAdminCustomerAccount",
        "summary": "createAdminCustomerAccount",
        "description": "Fresh verified human/current TEST session and independent finite platform-admin grant. Read-only receipt lookups never perform provider work. Unknown recovery never creates another identity. Password is request transit only, never response or storage.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]{0,9}\"$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "enum": [
                            "invalid_request"
                          ]
                        }
                      },
                      "required": [
                        "error"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "const": "validation_failed"
                        },
                        "fields": {
                          "type": "object",
                          "properties": {
                            "legalName": {
                              "type": "string",
                              "enum": [
                                "invalid",
                                "required"
                              ]
                            },
                            "businessForm": {
                              "type": "string",
                              "enum": [
                                "invalid",
                                "required"
                              ]
                            },
                            "tradingName": {
                              "type": "string",
                              "enum": [
                                "invalid",
                                "required"
                              ]
                            },
                            "addressLine1": {
                              "type": "string",
                              "enum": [
                                "invalid",
                                "required"
                              ]
                            },
                            "addressLine2": {
                              "type": "string",
                              "enum": [
                                "invalid",
                                "required"
                              ]
                            },
                            "town": {
                              "type": "string",
                              "enum": [
                                "invalid",
                                "required"
                              ]
                            },
                            "county": {
                              "type": "string",
                              "enum": [
                                "invalid",
                                "required"
                              ]
                            },
                            "postcode": {
                              "type": "string",
                              "enum": [
                                "invalid",
                                "required"
                              ]
                            },
                            "companyNumber": {
                              "type": "string",
                              "enum": [
                                "invalid",
                                "required"
                              ]
                            },
                            "vatRegistrationStatus": {
                              "type": "string",
                              "enum": [
                                "invalid",
                                "required"
                              ]
                            },
                            "vatNumber": {
                              "type": "string",
                              "enum": [
                                "invalid",
                                "required"
                              ]
                            }
                          },
                          "required": [],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "error",
                        "fields"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "enum": [
                            "admin_command_conflict"
                          ]
                        }
                      },
                      "required": [
                        "error"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "const": "admin_account_rejected"
                        },
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        }
                      },
                      "required": [
                        "error",
                        "provisioningId"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "provisioning": {
                      "type": "object",
                      "properties": {
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "accountId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "prepared",
                            "provider_pending",
                            "provider_unknown",
                            "provider_rejected",
                            "completed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "completedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "recoveryAttempts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "provisioningId",
                        "accountId",
                        "businessId",
                        "state",
                        "version",
                        "createdAt",
                        "completedAt",
                        "recoveryAttempts"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "environment",
                    "provisioning",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "202": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "provisioning": {
                      "type": "object",
                      "properties": {
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "accountId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "prepared",
                            "provider_pending",
                            "provider_unknown",
                            "provider_rejected",
                            "completed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "completedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "recoveryAttempts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "provisioningId",
                        "accountId",
                        "businessId",
                        "state",
                        "version",
                        "createdAt",
                        "completedAt",
                        "recoveryAttempts"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "environment",
                    "provisioning",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "provisioning": {
                      "type": "object",
                      "properties": {
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "accountId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "prepared",
                            "provider_pending",
                            "provider_unknown",
                            "provider_rejected",
                            "completed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "completedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "recoveryAttempts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "provisioningId",
                        "accountId",
                        "businessId",
                        "state",
                        "version",
                        "createdAt",
                        "completedAt",
                        "recoveryAttempts"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "environment",
                    "provisioning",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 254
                  },
                  "initialPassword": {
                    "type": "string",
                    "minLength": 12,
                    "maxLength": 128
                  },
                  "businessProfile": {
                    "type": "object",
                    "properties": {
                      "legalName": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "businessForm": {
                        "type": "string",
                        "enum": [
                          "limited_company",
                          "sole_trader",
                          "partnership",
                          "other"
                        ]
                      },
                      "tradingName": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "addressLine1": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "addressLine2": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "town": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "county": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "postcode": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "companyNumber": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "vatRegistrationStatus": {
                        "type": "string",
                        "enum": [
                          "registered",
                          "not_registered",
                          "unknown"
                        ]
                      },
                      "vatNumber": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "legalName",
                      "businessForm",
                      "tradingName",
                      "addressLine1",
                      "addressLine2",
                      "town",
                      "county",
                      "postcode",
                      "companyNumber",
                      "vatRegistrationStatus",
                      "vatNumber"
                    ],
                    "additionalProperties": false
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "email",
                  "initialPassword",
                  "businessProfile",
                  "reason"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/admin/audit": {
      "get": {
        "operationId": "readAdminAudit",
        "summary": "readAdminAudit",
        "description": "Fresh verified human/current TEST session and independent finite platform-admin grant. Read-only receipt lookups never perform provider work. Unknown recovery never creates another identity. Password is request transit only, never response or storage.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "actions",
                "changes",
                "admin"
              ],
              "default": "actions"
            }
          },
          {
            "name": "businessId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "kind": {
                          "type": "string",
                          "const": "actions"
                        },
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "eventId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              "businessId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "occurredAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "actorId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "action": {
                                "type": "string",
                                "maxLength": 100
                              },
                              "resourceId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "beforeVersion": {
                                "oneOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 2147483647
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "afterVersion": {
                                "oneOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 2147483647
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "eventId",
                              "businessId",
                              "occurredAt",
                              "actorId",
                              "action",
                              "resourceId",
                              "beforeVersion",
                              "afterVersion"
                            ],
                            "additionalProperties": false
                          },
                          "maxItems": 50
                        },
                        "nextAfter": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "readOnly": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "environment",
                        "kind",
                        "entries",
                        "nextAfter",
                        "readOnly"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "kind": {
                          "type": "string",
                          "const": "changes"
                        },
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "eventId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              "businessId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "occurredAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "actorId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "source": {
                                "type": "string",
                                "maxLength": 100
                              },
                              "operation": {
                                "type": "string",
                                "enum": [
                                  "INSERT",
                                  "UPDATE",
                                  "DELETE"
                                ]
                              },
                              "resourceId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "beforeVersion": {
                                "oneOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 2147483647
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "afterVersion": {
                                "oneOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 2147483647
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "eventId",
                              "businessId",
                              "occurredAt",
                              "actorId",
                              "source",
                              "operation",
                              "resourceId",
                              "beforeVersion",
                              "afterVersion"
                            ],
                            "additionalProperties": false
                          },
                          "maxItems": 50
                        },
                        "nextAfter": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "readOnly": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "environment",
                        "kind",
                        "entries",
                        "nextAfter",
                        "readOnly"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "kind": {
                          "type": "string",
                          "const": "admin"
                        },
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "eventId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                              },
                              "businessId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "occurredAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "actorId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "actorType": {
                                "type": "string",
                                "enum": [
                                  "maintenance",
                                  "user_context"
                                ]
                              },
                              "action": {
                                "type": "string",
                                "enum": [
                                  "admin.grant_changed",
                                  "admin.recovery_requested",
                                  "admin.directory_read",
                                  "admin.account_prepared",
                                  "admin.provider_claimed",
                                  "admin.provider_unknown",
                                  "admin.provider_rejected",
                                  "admin.account_completed",
                                  "admin.account_suspended",
                                  "admin.account_restored",
                                  "admin.account_lifecycle_read",
                                  "admin.invoice_access_changed"
                                ]
                              },
                              "resourceId": {
                                "oneOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "grantRevision": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 2147483647
                              },
                              "resultCount": {
                                "oneOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 50
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "facts": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {},
                                    "required": [],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operation": {
                                        "type": "string",
                                        "enum": [
                                          "INSERT",
                                          "UPDATE",
                                          "DELETE"
                                        ]
                                      },
                                      "before": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "revision": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 2147483647
                                              },
                                              "enabled": {
                                                "type": "boolean"
                                              },
                                              "scopes": {
                                                "oneOf": [
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "directory:read"
                                                    ],
                                                    "minItems": 1,
                                                    "maxItems": 1
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:create"
                                                    ],
                                                    "minItems": 1,
                                                    "maxItems": 1
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:lifecycle"
                                                    ],
                                                    "minItems": 1,
                                                    "maxItems": 1
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "directory:read",
                                                      "accounts:create"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "directory:read",
                                                      "accounts:lifecycle"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:create",
                                                      "directory:read"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:create",
                                                      "accounts:lifecycle"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:lifecycle",
                                                      "directory:read"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:lifecycle",
                                                      "accounts:create"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "directory:read",
                                                      "accounts:create",
                                                      "accounts:lifecycle"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "directory:read",
                                                      "accounts:lifecycle",
                                                      "accounts:create"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:create",
                                                      "directory:read",
                                                      "accounts:lifecycle"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:create",
                                                      "accounts:lifecycle",
                                                      "directory:read"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:lifecycle",
                                                      "directory:read",
                                                      "accounts:create"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:lifecycle",
                                                      "accounts:create",
                                                      "directory:read"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  }
                                                ]
                                              },
                                              "issuedAt": {
                                                "type": "string",
                                                "format": "date-time"
                                              },
                                              "expiresAt": {
                                                "type": "string",
                                                "format": "date-time"
                                              },
                                              "reasonHash": {
                                                "type": "string",
                                                "pattern": "^[0-9a-f]{64}$"
                                              }
                                            },
                                            "required": [
                                              "revision",
                                              "enabled",
                                              "scopes",
                                              "issuedAt",
                                              "expiresAt",
                                              "reasonHash"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "after": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "revision": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 2147483647
                                              },
                                              "enabled": {
                                                "type": "boolean"
                                              },
                                              "scopes": {
                                                "oneOf": [
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "directory:read"
                                                    ],
                                                    "minItems": 1,
                                                    "maxItems": 1
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:create"
                                                    ],
                                                    "minItems": 1,
                                                    "maxItems": 1
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:lifecycle"
                                                    ],
                                                    "minItems": 1,
                                                    "maxItems": 1
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "directory:read",
                                                      "accounts:create"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "directory:read",
                                                      "accounts:lifecycle"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:create",
                                                      "directory:read"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:create",
                                                      "accounts:lifecycle"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:lifecycle",
                                                      "directory:read"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:lifecycle",
                                                      "accounts:create"
                                                    ],
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "directory:read",
                                                      "accounts:create",
                                                      "accounts:lifecycle"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "directory:read",
                                                      "accounts:lifecycle",
                                                      "accounts:create"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:create",
                                                      "directory:read",
                                                      "accounts:lifecycle"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:create",
                                                      "accounts:lifecycle",
                                                      "directory:read"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:lifecycle",
                                                      "directory:read",
                                                      "accounts:create"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "enum": [
                                                        "directory:read",
                                                        "accounts:create",
                                                        "accounts:lifecycle"
                                                      ]
                                                    },
                                                    "const": [
                                                      "accounts:lifecycle",
                                                      "accounts:create",
                                                      "directory:read"
                                                    ],
                                                    "minItems": 3,
                                                    "maxItems": 3
                                                  }
                                                ]
                                              },
                                              "issuedAt": {
                                                "type": "string",
                                                "format": "date-time"
                                              },
                                              "expiresAt": {
                                                "type": "string",
                                                "format": "date-time"
                                              },
                                              "reasonHash": {
                                                "type": "string",
                                                "pattern": "^[0-9a-f]{64}$"
                                              }
                                            },
                                            "required": [
                                              "revision",
                                              "enabled",
                                              "scopes",
                                              "issuedAt",
                                              "expiresAt",
                                              "reasonHash"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "operation",
                                      "before",
                                      "after"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "required": [
                              "eventId",
                              "businessId",
                              "occurredAt",
                              "actorId",
                              "actorType",
                              "action",
                              "resourceId",
                              "grantRevision",
                              "resultCount",
                              "facts"
                            ],
                            "additionalProperties": false
                          },
                          "maxItems": 50
                        },
                        "nextAfter": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "readOnly": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "environment",
                        "kind",
                        "entries",
                        "nextAfter",
                        "readOnly"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/account-provisioning/{provisioningId}": {
      "get": {
        "operationId": "readAdminProvisioning",
        "summary": "readAdminProvisioning",
        "description": "Fresh verified human/current TEST session and independent finite platform-admin grant. Read-only receipt lookups never perform provider work. Unknown recovery never creates another identity. Password is request transit only, never response or storage.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "provisioningId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "provisioning": {
                      "type": "object",
                      "properties": {
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "accountId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "prepared",
                            "provider_pending",
                            "provider_unknown",
                            "provider_rejected",
                            "completed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "completedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "recoveryAttempts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "provisioningId",
                        "accountId",
                        "businessId",
                        "state",
                        "version",
                        "createdAt",
                        "completedAt",
                        "recoveryAttempts"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "environment",
                    "provisioning",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/account-provisioning/{provisioningId}/recovery": {
      "post": {
        "operationId": "recoverAdminProvisioning",
        "summary": "recoverAdminProvisioning",
        "description": "Fresh verified human/current TEST session and independent finite platform-admin grant. Read-only receipt lookups never perform provider work. Unknown recovery never creates another identity. Password is request transit only, never response or storage.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "provisioningId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]{0,9}\"$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "enum": [
                            "admin_command_conflict"
                          ]
                        }
                      },
                      "required": [
                        "error"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "const": "admin_account_rejected"
                        },
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        }
                      },
                      "required": [
                        "error",
                        "provisioningId"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "provisioning": {
                      "type": "object",
                      "properties": {
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "accountId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "prepared",
                            "provider_pending",
                            "provider_unknown",
                            "provider_rejected",
                            "completed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "completedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "recoveryAttempts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "provisioningId",
                        "accountId",
                        "businessId",
                        "state",
                        "version",
                        "createdAt",
                        "completedAt",
                        "recoveryAttempts"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "environment",
                    "provisioning",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "202": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "provisioning": {
                      "type": "object",
                      "properties": {
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "accountId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "prepared",
                            "provider_pending",
                            "provider_unknown",
                            "provider_rejected",
                            "completed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "completedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "recoveryAttempts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "provisioningId",
                        "accountId",
                        "businessId",
                        "state",
                        "version",
                        "createdAt",
                        "completedAt",
                        "recoveryAttempts"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "environment",
                    "provisioning",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/admin/account-provisioning/by-key/{requestKey}": {
      "get": {
        "operationId": "readAdminProvisioningByKey",
        "summary": "readAdminProvisioningByKey",
        "description": "Fresh verified human/current TEST session and independent finite platform-admin grant. Read-only receipt lookups never perform provider work. Unknown recovery never creates another identity. Password is request transit only, never response or storage.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "requestKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]{0,9}\"$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "provisioning": {
                      "type": "object",
                      "properties": {
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "accountId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "prepared",
                            "provider_pending",
                            "provider_unknown",
                            "provider_rejected",
                            "completed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "completedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "recoveryAttempts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "provisioningId",
                        "accountId",
                        "businessId",
                        "state",
                        "version",
                        "createdAt",
                        "completedAt",
                        "recoveryAttempts"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "environment",
                    "provisioning",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/credit-eligibility": {
      "get": {
        "tags": [
          "Invoice credit review foundation"
        ],
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped review facts or original immutable acknowledgement; no posted credit or financial effect.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "invoiceId",
                    "environment",
                    "mode",
                    "readAt",
                    "source",
                    "approvalPolicy",
                    "grantRevision",
                    "executable"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "mode": {
                      "type": "string",
                      "const": "full"
                    },
                    "readAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "source": {
                      "anyOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "invoiceId",
                            "invoiceVersion",
                            "eligible",
                            "blocker"
                          ],
                          "properties": {
                            "invoiceId": {
                              "type": "string",
                              "format": "uuid",
                              "not": {
                                "type": "string",
                                "const": "00000000-0000-0000-0000-000000000000"
                              },
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "invoiceVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "eligible": {
                              "type": "boolean",
                              "const": false
                            },
                            "blocker": {
                              "type": "string",
                              "const": "invoice_not_issued"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "invoiceId",
                            "invoiceVersion",
                            "snapshotHash",
                            "number",
                            "currency",
                            "net",
                            "vat",
                            "gross",
                            "eligible",
                            "blocker"
                          ],
                          "properties": {
                            "invoiceId": {
                              "type": "string",
                              "format": "uuid",
                              "not": {
                                "type": "string",
                                "const": "00000000-0000-0000-0000-000000000000"
                              },
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "invoiceVersion": {
                              "type": "integer",
                              "minimum": 2,
                              "maximum": 2147483647
                            },
                            "snapshotHash": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "number": {
                              "type": "string",
                              "pattern": "^TST-[0-9]{6,10}$"
                            },
                            "currency": {
                              "type": "string",
                              "const": "GBP"
                            },
                            "net": {
                              "type": "string",
                              "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)$"
                            },
                            "vat": {
                              "type": "string",
                              "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)$"
                            },
                            "gross": {
                              "type": "string",
                              "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)$"
                            },
                            "eligible": {
                              "type": "boolean"
                            },
                            "blocker": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "no_payment_due",
                                    "payment_evidence_present",
                                    "checkout_work_present",
                                    "accounting_work_present",
                                    "delivery_work_present"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          }
                        }
                      ]
                    },
                    "approvalPolicy": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "mode",
                        "revision",
                        "source",
                        "receiptId",
                        "ownerId"
                      ],
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "independent_reviewer",
                            "single_owner"
                          ]
                        },
                        "revision": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "default",
                            "owner_decision"
                          ]
                        },
                        "receiptId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "not": {
                                "type": "string",
                                "const": "00000000-0000-0000-0000-000000000000"
                              },
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "ownerId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "not": {
                                "type": "string",
                                "const": "00000000-0000-0000-0000-000000000000"
                              },
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "grantRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "executable": {
                      "type": "boolean",
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_credit_review_disabled",
                        "invoice_credit_review_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "description": "Default-off finite explicitly granted TEST business only. No query/range/conditional headers. Genuine current admission before historical replay and publication; executable alwaysfalse."
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/credit-proposals": {
      "post": {
        "tags": [
          "Invoice credit review foundation"
        ],
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "description": "Canonical lowercase nonzero UUID; retain original operation through unknown reply."
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$",
              "description": "Exactly quoted positive Int32 <=2147483647; invoice current issued version forprepare, proposalversion1 fordecision. No weak/unquoted/alternate headers."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped review facts or original immutable acknowledgement; no posted credit or financial effect.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "const": "\"1\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "proposalId",
                    "businessId",
                    "invoiceId",
                    "environment",
                    "proposalVersion",
                    "invoiceVersion",
                    "snapshotHash",
                    "sourceHash",
                    "source",
                    "approvalPolicy",
                    "reasonCode",
                    "reason",
                    "assignedApproverId",
                    "createdAt",
                    "expiresAt",
                    "approvalState",
                    "decisionId",
                    "currentState",
                    "blockedReason",
                    "actorCanDecide",
                    "executable",
                    "receiptId",
                    "requestKey",
                    "replayed"
                  ],
                  "properties": {
                    "proposalId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "proposalVersion": {
                      "type": "integer",
                      "const": 1
                    },
                    "invoiceVersion": {
                      "type": "integer",
                      "minimum": 2,
                      "maximum": 2147483647
                    },
                    "snapshotHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "sourceHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "source": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "invoiceId",
                        "invoiceVersion",
                        "snapshotHash",
                        "number",
                        "currency",
                        "net",
                        "vat",
                        "gross",
                        "eligible",
                        "blocker"
                      ],
                      "properties": {
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "not": {
                            "type": "string",
                            "const": "00000000-0000-0000-0000-000000000000"
                          },
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceVersion": {
                          "type": "integer",
                          "minimum": 2,
                          "maximum": 2147483647
                        },
                        "snapshotHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "number": {
                          "type": "string",
                          "pattern": "^TST-[0-9]{6,10}$"
                        },
                        "currency": {
                          "type": "string",
                          "const": "GBP"
                        },
                        "net": {
                          "type": "string",
                          "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)$"
                        },
                        "vat": {
                          "type": "string",
                          "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)$"
                        },
                        "gross": {
                          "type": "string",
                          "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)$"
                        },
                        "eligible": {
                          "type": "boolean"
                        },
                        "blocker": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "no_payment_due",
                                "payment_evidence_present",
                                "checkout_work_present",
                                "accounting_work_present",
                                "delivery_work_present"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "approvalPolicy": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "mode",
                        "revision",
                        "source",
                        "receiptId",
                        "ownerId"
                      ],
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "independent_reviewer",
                            "single_owner"
                          ]
                        },
                        "revision": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "default",
                            "owner_decision"
                          ]
                        },
                        "receiptId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "not": {
                                "type": "string",
                                "const": "00000000-0000-0000-0000-000000000000"
                              },
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "ownerId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "not": {
                                "type": "string",
                                "const": "00000000-0000-0000-0000-000000000000"
                              },
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "reasonCode": {
                      "type": "string",
                      "enum": [
                        "duplicate_invoice",
                        "cancelled_service",
                        "other"
                      ]
                    },
                    "reason": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500,
                          "description": "Canonical trimmed NFC, no controls, at most500 UTF-16 code units (service stricter than JSON Schema scalar count)."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "assignedApproverId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "approvalState": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "approved",
                        "rejected"
                      ]
                    },
                    "decisionId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "not": {
                            "type": "string",
                            "const": "00000000-0000-0000-0000-000000000000"
                          },
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "currentState": {
                      "type": "string",
                      "enum": [
                        "current",
                        "blocked"
                      ]
                    },
                    "blockedReason": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "review_expired",
                            "initiator_context_unavailable",
                            "initiator_access_changed",
                            "membership_changed",
                            "grant_changed",
                            "approval_policy_changed",
                            "source_changed"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "actorCanDecide": {
                      "type": "boolean"
                    },
                    "executable": {
                      "type": "boolean",
                      "const": false
                    },
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "428": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_credit_review_disabled",
                        "invoice_credit_review_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "description": "Default-off finite explicitly granted TEST business only. No query/range/conditional headers. Genuine current admission before historical replay and publication; executable alwaysfalse.",
        "requestBody": {
          "required": true,
          "description": "Max2048 UTF-8 bytes, depth2, no duplicate/escapedkeys; unknownfields failclosed.",
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "assignedApproverId",
                      "reasonCode"
                    ],
                    "properties": {
                      "assignedApproverId": {
                        "type": "string",
                        "format": "uuid",
                        "not": {
                          "type": "string",
                          "const": "00000000-0000-0000-0000-000000000000"
                        },
                        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                      },
                      "reasonCode": {
                        "type": "string",
                        "enum": [
                          "duplicate_invoice",
                          "cancelled_service"
                        ]
                      },
                      "reason": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500,
                            "description": "Canonical trimmed NFC, no controls, at most500 UTF-16 code units (service stricter than JSON Schema scalar count)."
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "assignedApproverId",
                      "reasonCode",
                      "reason"
                    ],
                    "properties": {
                      "assignedApproverId": {
                        "type": "string",
                        "format": "uuid",
                        "not": {
                          "type": "string",
                          "const": "00000000-0000-0000-0000-000000000000"
                        },
                        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                      },
                      "reasonCode": {
                        "type": "string",
                        "const": "other"
                      },
                      "reason": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500,
                        "description": "Canonical trimmed NFC, no controls, at most500 UTF-16 code units (service stricter than JSON Schema scalar count)."
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/credit-proposals/{proposalId}": {
      "get": {
        "tags": [
          "Invoice credit review foundation"
        ],
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped review facts or original immutable acknowledgement; no posted credit or financial effect.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "const": "\"1\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "proposalId",
                    "businessId",
                    "invoiceId",
                    "environment",
                    "proposalVersion",
                    "invoiceVersion",
                    "snapshotHash",
                    "sourceHash",
                    "source",
                    "approvalPolicy",
                    "reasonCode",
                    "reason",
                    "assignedApproverId",
                    "createdAt",
                    "expiresAt",
                    "approvalState",
                    "decisionId",
                    "currentState",
                    "blockedReason",
                    "actorCanDecide",
                    "executable"
                  ],
                  "properties": {
                    "proposalId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "proposalVersion": {
                      "type": "integer",
                      "const": 1
                    },
                    "invoiceVersion": {
                      "type": "integer",
                      "minimum": 2,
                      "maximum": 2147483647
                    },
                    "snapshotHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "sourceHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "source": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "invoiceId",
                        "invoiceVersion",
                        "snapshotHash",
                        "number",
                        "currency",
                        "net",
                        "vat",
                        "gross",
                        "eligible",
                        "blocker"
                      ],
                      "properties": {
                        "invoiceId": {
                          "type": "string",
                          "format": "uuid",
                          "not": {
                            "type": "string",
                            "const": "00000000-0000-0000-0000-000000000000"
                          },
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "invoiceVersion": {
                          "type": "integer",
                          "minimum": 2,
                          "maximum": 2147483647
                        },
                        "snapshotHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "number": {
                          "type": "string",
                          "pattern": "^TST-[0-9]{6,10}$"
                        },
                        "currency": {
                          "type": "string",
                          "const": "GBP"
                        },
                        "net": {
                          "type": "string",
                          "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)$"
                        },
                        "vat": {
                          "type": "string",
                          "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)$"
                        },
                        "gross": {
                          "type": "string",
                          "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)$"
                        },
                        "eligible": {
                          "type": "boolean"
                        },
                        "blocker": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "no_payment_due",
                                "payment_evidence_present",
                                "checkout_work_present",
                                "accounting_work_present",
                                "delivery_work_present"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "approvalPolicy": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "mode",
                        "revision",
                        "source",
                        "receiptId",
                        "ownerId"
                      ],
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "independent_reviewer",
                            "single_owner"
                          ]
                        },
                        "revision": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "default",
                            "owner_decision"
                          ]
                        },
                        "receiptId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "not": {
                                "type": "string",
                                "const": "00000000-0000-0000-0000-000000000000"
                              },
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "ownerId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "not": {
                                "type": "string",
                                "const": "00000000-0000-0000-0000-000000000000"
                              },
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "reasonCode": {
                      "type": "string",
                      "enum": [
                        "duplicate_invoice",
                        "cancelled_service",
                        "other"
                      ]
                    },
                    "reason": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500,
                          "description": "Canonical trimmed NFC, no controls, at most500 UTF-16 code units (service stricter than JSON Schema scalar count)."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "assignedApproverId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "approvalState": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "approved",
                        "rejected"
                      ]
                    },
                    "decisionId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "not": {
                            "type": "string",
                            "const": "00000000-0000-0000-0000-000000000000"
                          },
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "currentState": {
                      "type": "string",
                      "enum": [
                        "current",
                        "blocked"
                      ]
                    },
                    "blockedReason": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "review_expired",
                            "initiator_context_unavailable",
                            "initiator_access_changed",
                            "membership_changed",
                            "grant_changed",
                            "approval_policy_changed",
                            "source_changed"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "actorCanDecide": {
                      "type": "boolean"
                    },
                    "executable": {
                      "type": "boolean",
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_credit_review_disabled",
                        "invoice_credit_review_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "description": "Default-off finite explicitly granted TEST business only. No query/range/conditional headers. Genuine current admission before historical replay and publication; executable alwaysfalse."
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/credit-proposals/{proposalId}/decision": {
      "post": {
        "tags": [
          "Invoice credit review foundation"
        ],
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "proposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "not": {
                "type": "string",
                "const": "00000000-0000-0000-0000-000000000000"
              },
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "description": "Canonical lowercase nonzero UUID; retain original operation through unknown reply."
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$",
              "description": "Exactly quoted positive Int32 <=2147483647; invoice current issued version forprepare, proposalversion1 fordecision. No weak/unquoted/alternate headers."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current scoped review facts or original immutable acknowledgement; no posted credit or financial effect.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "const": "\"1\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "businessId",
                    "invoiceId",
                    "proposalId",
                    "environment",
                    "proposalVersion",
                    "receiptId",
                    "decisionId",
                    "requestKey",
                    "decision",
                    "sourceHash",
                    "createdAt",
                    "replayed",
                    "executable"
                  ],
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "proposalId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "proposalVersion": {
                      "type": "integer",
                      "const": 1
                    },
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "decisionId": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "not": {
                        "type": "string",
                        "const": "00000000-0000-0000-0000-000000000000"
                      },
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "decision": {
                      "type": "string",
                      "enum": [
                        "approve",
                        "reject"
                      ]
                    },
                    "sourceHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "executable": {
                      "type": "boolean",
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "428": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed sanitized error; transport failure never acknowledges a command.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invoice_credit_review_disabled",
                        "invoice_credit_review_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "description": "Default-off finite explicitly granted TEST business only. No query/range/conditional headers. Genuine current admission before historical replay and publication; executable alwaysfalse.",
        "requestBody": {
          "required": true,
          "description": "Max2048 UTF-8 bytes, depth2, no duplicate/escapedkeys; unknownfields failclosed.",
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "sourceHash",
                      "decision"
                    ],
                    "properties": {
                      "sourceHash": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "decision": {
                        "type": "string",
                        "const": "approve"
                      },
                      "reason": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500,
                            "description": "Canonical trimmed NFC, no controls, at most500 UTF-16 code units (service stricter than JSON Schema scalar count)."
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "sourceHash",
                      "decision",
                      "reason"
                    ],
                    "properties": {
                      "sourceHash": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "decision": {
                        "type": "string",
                        "const": "reject"
                      },
                      "reason": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500,
                        "description": "Canonical trimmed NFC, no controls, at most500 UTF-16 code units (service stricter than JSON Schema scalar count)."
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/managed-setup": {
      "get": {
        "operationId": "readManagedBusinessSetup",
        "summary": "Read the assigned managed TEST business profile for its current owner",
        "description": "Default-off ManagedBusinessSetup:Enabled. Fresh genuine session and exact completed canonical managed binding. Read-only current profile, version and source hash; no business verification or financial grant. Reject query/body/range/command headers.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query",
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "managed_setup_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Current self-declared owner profile; ready is TEST profile completeness, not identity verification",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                }
              },
              "Tallylane-Read-Observation": {
                "description": "Optional server-generated opaque observation token on explicitly enabled, bounded sampled reads. Not an authority or application-instance identity; absent when disabled, unsampled or diagnostic evidence is unavailable.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{32}$",
                  "minLength": 32,
                  "maxLength": 32
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "role": {
                      "type": "string",
                      "const": "owner"
                    },
                    "setupVersion": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "profileHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "onboardingState": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "ready"
                      ]
                    },
                    "profile": {
                      "type": "object",
                      "properties": {
                        "legalName": {
                          "type": "string",
                          "maxLength": 300
                        },
                        "businessForm": {
                          "type": "string",
                          "enum": [
                            "limited_company",
                            "sole_trader",
                            "partnership",
                            "other"
                          ]
                        },
                        "tradingName": {
                          "oneOf": [
                            {
                              "type": "string",
                              "maxLength": 300
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "addressLine1": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "addressLine2": {
                          "oneOf": [
                            {
                              "type": "string",
                              "maxLength": 200
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "town": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "county": {
                          "oneOf": [
                            {
                              "type": "string",
                              "maxLength": 100
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "postcode": {
                          "type": "string",
                          "maxLength": 20
                        },
                        "companyNumber": {
                          "oneOf": [
                            {
                              "type": "string",
                              "maxLength": 30
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "vatRegistrationStatus": {
                          "type": "string",
                          "enum": [
                            "registered",
                            "not_registered",
                            "unknown"
                          ]
                        },
                        "vatNumber": {
                          "oneOf": [
                            {
                              "type": "string",
                              "maxLength": 30
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "legalName",
                        "businessForm",
                        "tradingName",
                        "addressLine1",
                        "addressLine2",
                        "town",
                        "county",
                        "postcode",
                        "companyNumber",
                        "vatRegistrationStatus",
                        "vatNumber"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "role",
                    "setupVersion",
                    "profileHash",
                    "onboardingState",
                    "profile"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "saveManagedBusinessSetup",
        "summary": "Explicitly save the assigned managed TEST business profile",
        "description": "Exact full eleven-field profile, canonical original UUID key and quoted current setup version. Normal JSON escaping is accepted; duplicate/extra fields are rejected. Existing normalization and VAT/address/company checks apply. Known VAT and complete profile sets TEST ready; unknown VAT stays draft. Original actor/session/normalized profile/version replay returns historical receipt; fetch current profile separately. Atomic redacted change/action audit and final current session recheck. No issuance policy or financial/provider/model permission is created.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]*\"$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "legalName": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "businessForm": {
                    "type": "string",
                    "enum": [
                      "limited_company",
                      "sole_trader",
                      "partnership",
                      "other"
                    ]
                  },
                  "tradingName": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "addressLine1": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "addressLine2": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "town": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "county": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 100
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "postcode": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "companyNumber": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "vatRegistrationStatus": {
                    "type": "string",
                    "enum": [
                      "registered",
                      "not_registered",
                      "unknown"
                    ]
                  },
                  "vatNumber": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "legalName",
                  "businessForm",
                  "tradingName",
                  "addressLine1",
                  "addressLine2",
                  "town",
                  "county",
                  "postcode",
                  "companyNumber",
                  "vatRegistrationStatus",
                  "vatNumber"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Closed malformed request or known profile validation errors",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "enum": [
                            "invalid_request",
                            "invalid_query",
                            "invalid_idempotency_key"
                          ]
                        }
                      },
                      "required": [
                        "error"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "string",
                          "const": "invalid_profile"
                        },
                        "fields": {
                          "type": "object",
                          "properties": {
                            "legalName": {
                              "type": "string",
                              "enum": [
                                "required",
                                "invalid"
                              ]
                            },
                            "businessForm": {
                              "type": "string",
                              "enum": [
                                "required",
                                "invalid"
                              ]
                            },
                            "tradingName": {
                              "type": "string",
                              "enum": [
                                "required",
                                "invalid"
                              ]
                            },
                            "addressLine1": {
                              "type": "string",
                              "enum": [
                                "required",
                                "invalid"
                              ]
                            },
                            "addressLine2": {
                              "type": "string",
                              "enum": [
                                "required",
                                "invalid"
                              ]
                            },
                            "town": {
                              "type": "string",
                              "enum": [
                                "required",
                                "invalid"
                              ]
                            },
                            "county": {
                              "type": "string",
                              "enum": [
                                "required",
                                "invalid"
                              ]
                            },
                            "postcode": {
                              "type": "string",
                              "enum": [
                                "required",
                                "invalid"
                              ]
                            },
                            "companyNumber": {
                              "type": "string",
                              "enum": [
                                "required",
                                "invalid"
                              ]
                            },
                            "vatRegistrationStatus": {
                              "type": "string",
                              "enum": [
                                "required",
                                "invalid"
                              ]
                            },
                            "vatNumber": {
                              "type": "string",
                              "enum": [
                                "required",
                                "invalid"
                              ]
                            }
                          },
                          "required": [],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "error",
                        "fields"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "managed_setup_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Original command or current setup precondition failed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict",
                        "profile_unchanged"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Original command or current setup precondition failed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Original command or current setup precondition failed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Immutable historical save receipt; current access and source are checked before replay",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]*\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "setupVersion": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "profileHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "onboardingState": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "ready"
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "receiptId",
                    "setupVersion",
                    "profileHash",
                    "onboardingState",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/businesses/{businessId}/test-invoice-access": {
      "get": {
        "operationId": "readAdminManagedInvoiceAccess",
        "summary": "Read finite TEST invoice access for one canonical managed business",
        "description": "Default-off Admin:InvoiceAccess:Enabled and existing Admin:Enabled. Fresh signed admin session, current accounts:create grant and exact completed managed binding. Version header is current admin grant revision; invoiceAccess.revision is a separate command precondition. Active means only unexpired TEST invoice access, not issuance readiness or verified identity. Profile readiness and human approval policy remain separate gates. Reject query/body/range/command headers.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query",
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_invoice_access_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Current admin epoch changed during this read; no facts disclosed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Fresh TEST access and separate profile/approval facts; absence has revision0 disabled/null expiry/inactive",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "adminGrantRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "profileState": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "ready"
                      ]
                    },
                    "vatStatus": {
                      "type": "string",
                      "enum": [
                        "registered",
                        "not_registered",
                        "unknown"
                      ]
                    },
                    "approvalMode": {
                      "type": "string",
                      "enum": [
                        "independent_reviewer",
                        "single_owner"
                      ]
                    },
                    "invoiceAccess": {
                      "type": "object",
                      "properties": {
                        "revision": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 2147483647
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "expiresAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,7})?(Z|\\+00:00)$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "policyVersion": {
                          "type": "string",
                          "const": "UK_DOMESTIC_SERVICES_TEST_V1"
                        },
                        "active": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "revision",
                        "enabled",
                        "expiresAt",
                        "policyVersion",
                        "active"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "adminGrantRevision",
                    "profileState",
                    "vatStatus",
                    "approvalMode",
                    "invoiceAccess"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "saveAdminManagedInvoiceAccess",
        "summary": "Deliberately enable or disable finite TEST invoice access",
        "description": "Exact four-field body plus original canonical UUID key and quoted current admin grant revision. Expected invoice access revision is a distinct CAS. It must be a raw canonical nonnegative Int32 decimal JSON number (not 1.0, 1e0 or -0). Quoted version header is canonical positive Int32 (maximum2147483647). Enable expires strictly in future within24hours of database current time; disable input expiry is null. Current exact admin/session/canonical managed scope before replay and after audit. Original replay returns historical receipt without renewing expiry. A disabled receipt retains the original nonnull grant expiry, and contains no current active assertion. No profile/policy/provider/Stripe/Xero/agent/communication authority is created.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "const": true
                      },
                      "expiresAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?Z$"
                      },
                      "confirmed": {
                        "type": "boolean",
                        "const": true
                      },
                      "expectedAccessRevision": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 2147483647
                      }
                    },
                    "required": [
                      "enabled",
                      "expiresAt",
                      "confirmed",
                      "expectedAccessRevision"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "const": false
                      },
                      "expiresAt": {
                        "type": "null"
                      },
                      "confirmed": {
                        "type": "boolean",
                        "const": true
                      },
                      "expectedAccessRevision": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 2147483647
                      }
                    },
                    "required": [
                      "enabled",
                      "expiresAt",
                      "confirmed",
                      "expectedAccessRevision"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Closed malformed input or finite deadline validation",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_query",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied",
                        "test_environment_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current TEST response",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_invoice_access_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Original command or current access precondition failed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict",
                        "access_unchanged",
                        "access_version_exhausted"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Original command or current access precondition failed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_version_conflict",
                        "access_version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Original command or current access precondition failed",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Immutable historical TEST access receipt; fresh GET establishes current active state",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store",
                    "private, no-store"
                  ]
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "adminGrantRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "invoiceAccess": {
                      "type": "object",
                      "properties": {
                        "revision": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,7})?(Z|\\+00:00)$"
                        },
                        "policyVersion": {
                          "type": "string",
                          "const": "UK_DOMESTIC_SERVICES_TEST_V1"
                        }
                      },
                      "required": [
                        "revision",
                        "enabled",
                        "expiresAt",
                        "policyVersion"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "businessId",
                    "environment",
                    "receiptId",
                    "adminGrantRevision",
                    "invoiceAccess",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/customer-accounts/{accountId}/lifecycle": {
      "parameters": [
        {
          "name": "accountId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          }
        }
      ],
      "get": {
        "operationId": "readAdminManagedAccountLifecycle",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "description": "Default-off TEST managed account app lifecycle; new finite accounts:lifecycle scope. Provider sessions, business automation, financial grants unchanged. no-store. GET never acknowledges unknown POST; receipt is historical.",
        "responses": {
          "200": {
            "description": "Current authorized read",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "accountId",
                    "businessId",
                    "environment",
                    "adminGrantRevision",
                    "lifecycle",
                    "membership"
                  ],
                  "properties": {
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "adminGrantRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "lifecycle": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "version",
                        "status",
                        "suspendedByReceiptId"
                      ],
                      "properties": {
                        "version": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 2147483647
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "suspended"
                          ]
                        },
                        "suspendedByReceiptId": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    },
                    "membership": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "membershipId",
                        "role",
                        "status",
                        "version"
                      ],
                      "properties": {
                        "membershipId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "finance_admin",
                            "finance_operator",
                            "approver",
                            "bookkeeper",
                            "viewer"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "revoked"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        }
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Tallylane-Version": {
                "description": "Canonical quoted positive Int32 current admin grant revision, <=2147483647. Distinct from target lifecycle/member CAS.",
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]{0,9}\"$",
                  "maxLength": 12
                }
              }
            }
          },
          "400": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query",
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "test_environment_required",
                        "access_denied"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_version_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_account_lifecycle_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "changeAdminManagedAccountLifecycle",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "description": "Default-off TEST managed account app lifecycle; new finite accounts:lifecycle scope. Provider sessions, business automation, financial grants unchanged. no-store. GET never acknowledges unknown POST; receipt is historical. Body bytes<=1024/depth2; decoded duplicate JSON keys/extra fields rejected. Integer values require canonical decimal lexemes (not 0.0,1e0,-0), UUIDs canonical lowercase nonzero. Current actor/session/key/body/admin epoch before historical replay; original versions retained.",
        "responses": {
          "200": {
            "description": "Historical receipt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "accountId",
                    "businessId",
                    "environment",
                    "adminGrantRevision",
                    "receipt",
                    "replayed"
                  ],
                  "properties": {
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "adminGrantRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "receipt": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "receiptId",
                            "requestKey",
                            "command",
                            "restoreOfReceiptId",
                            "accountId",
                            "businessId",
                            "bindingId",
                            "membershipId",
                            "role",
                            "previousVersion",
                            "version",
                            "previousStatus",
                            "status",
                            "previousMembershipStatus",
                            "membershipStatus",
                            "previousMembershipVersion",
                            "membershipVersion",
                            "createdAt"
                          ],
                          "properties": {
                            "receiptId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "requestKey": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "command": {
                              "type": "string",
                              "const": "suspend"
                            },
                            "restoreOfReceiptId": {
                              "type": "null"
                            },
                            "accountId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "businessId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "bindingId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "membershipId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "owner",
                                "finance_admin",
                                "finance_operator",
                                "approver",
                                "bookkeeper",
                                "viewer"
                              ]
                            },
                            "previousVersion": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 2147483647
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "previousStatus": {
                              "type": "string",
                              "const": "active"
                            },
                            "status": {
                              "type": "string",
                              "const": "suspended"
                            },
                            "previousMembershipStatus": {
                              "type": "string",
                              "const": "active"
                            },
                            "membershipStatus": {
                              "type": "string",
                              "const": "revoked"
                            },
                            "previousMembershipVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "membershipVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,7})?(Z|\\+00:00)$"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "receiptId",
                            "requestKey",
                            "command",
                            "restoreOfReceiptId",
                            "accountId",
                            "businessId",
                            "bindingId",
                            "membershipId",
                            "role",
                            "previousVersion",
                            "version",
                            "previousStatus",
                            "status",
                            "previousMembershipStatus",
                            "membershipStatus",
                            "previousMembershipVersion",
                            "membershipVersion",
                            "createdAt"
                          ],
                          "properties": {
                            "receiptId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "requestKey": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "command": {
                              "type": "string",
                              "const": "restore"
                            },
                            "restoreOfReceiptId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "accountId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "businessId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "bindingId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "membershipId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "owner",
                                "finance_admin",
                                "finance_operator",
                                "approver",
                                "bookkeeper",
                                "viewer"
                              ]
                            },
                            "previousVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "previousStatus": {
                              "type": "string",
                              "const": "suspended"
                            },
                            "status": {
                              "type": "string",
                              "const": "active"
                            },
                            "previousMembershipStatus": {
                              "type": "string",
                              "const": "revoked"
                            },
                            "membershipStatus": {
                              "type": "string",
                              "const": "active"
                            },
                            "previousMembershipVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "membershipVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,7})?(Z|\\+00:00)$"
                            }
                          }
                        }
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            },
            "headers": {
              "Tallylane-Version": {
                "description": "Canonical quoted positive Int32 current admin grant revision, <=2147483647. Distinct from target lifecycle/member CAS.",
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]{0,9}\"$",
                  "maxLength": 12
                }
              }
            }
          },
          "400": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query",
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "test_environment_required",
                        "access_denied"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_version_conflict",
                        "lifecycle_version_conflict",
                        "membership_version_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_account_lifecycle_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict",
                        "lifecycle_unchanged",
                        "restore_source_changed",
                        "version_exhausted"
                      ]
                    }
                  }
                }
              }
            }
          },
          "428": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"[1-9][0-9]{0,9}\"$",
              "maxLength": 12
            },
            "description": "Canonical quoted current admin grant Int32, <=2147483647; weak/unquoted/If-Match rejected."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "command",
                      "confirmed",
                      "expectedLifecycleVersion",
                      "expectedMembershipVersion",
                      "restoreOfReceiptId"
                    ],
                    "properties": {
                      "command": {
                        "type": "string",
                        "const": "suspend"
                      },
                      "confirmed": {
                        "type": "boolean",
                        "const": true
                      },
                      "expectedLifecycleVersion": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 2147483647
                      },
                      "expectedMembershipVersion": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 2147483647
                      },
                      "restoreOfReceiptId": {
                        "type": "null"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "command",
                      "confirmed",
                      "expectedLifecycleVersion",
                      "expectedMembershipVersion",
                      "restoreOfReceiptId"
                    ],
                    "properties": {
                      "command": {
                        "type": "string",
                        "const": "restore"
                      },
                      "confirmed": {
                        "type": "boolean",
                        "const": true
                      },
                      "expectedLifecycleVersion": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 2147483647
                      },
                      "expectedMembershipVersion": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 2147483647
                      },
                      "restoreOfReceiptId": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/admin/customer-accounts/{accountId}/lifecycle/receipts/{receiptId}": {
      "parameters": [
        {
          "name": "accountId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          }
        },
        {
          "name": "receiptId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid",
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          }
        }
      ],
      "get": {
        "operationId": "readAdminManagedAccountLifecycleReceipt",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "description": "Default-off TEST managed account app lifecycle; new finite accounts:lifecycle scope. Provider sessions, business automation, financial grants unchanged. no-store. GET never acknowledges unknown POST; receipt is historical.",
        "responses": {
          "200": {
            "description": "Current authorized read",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "accountId",
                    "businessId",
                    "environment",
                    "adminGrantRevision",
                    "receipt"
                  ],
                  "properties": {
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "adminGrantRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "receipt": {
                      "oneOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "receiptId",
                            "requestKey",
                            "command",
                            "restoreOfReceiptId",
                            "accountId",
                            "businessId",
                            "bindingId",
                            "membershipId",
                            "role",
                            "previousVersion",
                            "version",
                            "previousStatus",
                            "status",
                            "previousMembershipStatus",
                            "membershipStatus",
                            "previousMembershipVersion",
                            "membershipVersion",
                            "createdAt"
                          ],
                          "properties": {
                            "receiptId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "requestKey": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "command": {
                              "type": "string",
                              "const": "suspend"
                            },
                            "restoreOfReceiptId": {
                              "type": "null"
                            },
                            "accountId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "businessId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "bindingId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "membershipId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "owner",
                                "finance_admin",
                                "finance_operator",
                                "approver",
                                "bookkeeper",
                                "viewer"
                              ]
                            },
                            "previousVersion": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 2147483647
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "previousStatus": {
                              "type": "string",
                              "const": "active"
                            },
                            "status": {
                              "type": "string",
                              "const": "suspended"
                            },
                            "previousMembershipStatus": {
                              "type": "string",
                              "const": "active"
                            },
                            "membershipStatus": {
                              "type": "string",
                              "const": "revoked"
                            },
                            "previousMembershipVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "membershipVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,7})?(Z|\\+00:00)$"
                            }
                          }
                        },
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "receiptId",
                            "requestKey",
                            "command",
                            "restoreOfReceiptId",
                            "accountId",
                            "businessId",
                            "bindingId",
                            "membershipId",
                            "role",
                            "previousVersion",
                            "version",
                            "previousStatus",
                            "status",
                            "previousMembershipStatus",
                            "membershipStatus",
                            "previousMembershipVersion",
                            "membershipVersion",
                            "createdAt"
                          ],
                          "properties": {
                            "receiptId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "requestKey": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "command": {
                              "type": "string",
                              "const": "restore"
                            },
                            "restoreOfReceiptId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "accountId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "businessId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "bindingId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "membershipId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "owner",
                                "finance_admin",
                                "finance_operator",
                                "approver",
                                "bookkeeper",
                                "viewer"
                              ]
                            },
                            "previousVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "previousStatus": {
                              "type": "string",
                              "const": "suspended"
                            },
                            "status": {
                              "type": "string",
                              "const": "active"
                            },
                            "previousMembershipStatus": {
                              "type": "string",
                              "const": "revoked"
                            },
                            "membershipStatus": {
                              "type": "string",
                              "const": "active"
                            },
                            "previousMembershipVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "membershipVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,7})?(Z|\\+00:00)$"
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            },
            "headers": {
              "Tallylane-Version": {
                "description": "Canonical quoted positive Int32 current admin grant revision, <=2147483647. Distinct from target lifecycle/member CAS.",
                "schema": {
                  "type": "string",
                  "pattern": "^\"[1-9][0-9]{0,9}\"$",
                  "maxLength": 12
                }
              }
            }
          },
          "400": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_query",
                        "invalid_request"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "test_environment_required",
                        "access_denied"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_version_conflict"
                      ]
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Closed failure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "admin_account_lifecycle_unavailable"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/account-api/businesses/{businessId}/customers": {
      "get": {
        "operationId": "listAccountTestCustomers",
        "summary": "Current scoped TEST customers page",
        "description": "Default-off managed-account machine credential and separate restricted DB role. Fresh canonical assignment, account/membership/business, finite grant, scope, quota and audit checks. No human JWT/partner credential substitution, no request body/condition/idempotency headers. Customer rows contain scoped PII; invoice detail is a bounded directory projection, not a PDF/payment/accounting claim. Hosted deployment/activation acceptance remains separate.",
        "security": [
          {
            "AccountTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            },
            "description": "Canonical assigned TEST business; selector alone grants no access."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Canonical integer, no repeated/unknown query keys."
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            },
            "description": "Exclusive lowercase nonzero UUID keyset cursor."
          }
        ],
        "responses": {
          "200": {
            "description": "Current machine read; unresolved totals are null, exact account/business envelope",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "ACCOUNT_MACHINE_READ_V1"
                    },
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "actorType": {
                      "type": "string",
                      "const": "account_machine"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "customers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "customerId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "customerType": {
                            "type": "string",
                            "enum": [
                              "company",
                              "individual"
                            ]
                          },
                          "legalName": {
                            "type": "string",
                            "maxLength": 300
                          },
                          "contactName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 200
                          },
                          "email": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 254
                          },
                          "addressLine1": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 200
                          },
                          "addressLine2": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 200
                          },
                          "town": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 100
                          },
                          "county": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 100
                          },
                          "postcode": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 10
                          },
                          "country": {
                            "type": "string",
                            "const": "GB"
                          },
                          "vatNumber": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 12
                          },
                          "paymentTermsDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 365
                          },
                          "deliveryPreference": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "email"
                            ]
                          },
                          "collectionsPaused": {
                            "type": "boolean"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "archived"
                            ]
                          }
                        },
                        "required": [
                          "customerId",
                          "version",
                          "customerType",
                          "legalName",
                          "contactName",
                          "email",
                          "addressLine1",
                          "addressLine2",
                          "town",
                          "county",
                          "postcode",
                          "country",
                          "vatNumber",
                          "paymentTermsDays",
                          "deliveryPreference",
                          "collectionsPaused",
                          "status"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 100
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "accountId",
                    "businessId",
                    "environment",
                    "actorType",
                    "readOnly",
                    "customers",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "read_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "rate_limited"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "account_api_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createAccountTestCustomer",
        "summary": "Create scoped TEST customer",
        "description": "Default-off Account48 machine create, with corresponding customers:create or invoices:draft:create scope. One caller-retained canonical Idempotency-Key shared across operations in the same assigned account/business; exact canonical payload replay survives credential rotation with fresh authority. Backend validates/calculates and atomically writes resource, immutable receipt and machine audit. Initial201/replay200 ACK version1 is historical creation, not current detail. Any lost/malformed/unavailable POST ACK is outcome unknown: retain original key and recover its operation-specific command receipt; never automatically retry or replace UUID. Draft creation does not approve/issue/email/collect/export. Customer JSON body <=16KiB; draft<=64KiB; no query/conditional headers. Repository contract does not activate hosted flags/roles/grants.",
        "security": [
          {
            "AccountTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            },
            "description": "Persist before sending; never replace after unknown outcome."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerType": {
                    "type": "string",
                    "enum": [
                      "company",
                      "individual"
                    ]
                  },
                  "legalName": {
                    "type": "string"
                  },
                  "contactName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "paymentTermsDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  },
                  "deliveryPreference": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "manual",
                      "email"
                    ]
                  },
                  "collectionsPaused": {
                    "type": "boolean"
                  },
                  "addressLine1": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "addressLine2": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "town": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "county": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "postcode": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "vatNumber": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "country": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "const": "GB"
                  }
                },
                "required": [
                  "customerType",
                  "legalName"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Committed new resource at version1",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "const": "\"1\""
                }
              },
              "Location": {
                "schema": {
                  "type": "string",
                  "pattern": "^/v1/account-api/businesses/[0-9a-f-]{36}/customers/[0-9a-f-]{36}(?![\\s\\S])"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "ACCOUNT_MACHINE_CREATE_V1"
                    },
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "actorType": {
                      "type": "string",
                      "const": "account_machine"
                    },
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "state": {
                      "type": "string",
                      "const": "committed"
                    },
                    "version": {
                      "type": "integer",
                      "const": 1
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "command": {
                      "type": "string",
                      "const": "customers:create"
                    },
                    "created": {
                      "type": "boolean",
                      "const": true
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": false
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "accountId",
                    "businessId",
                    "environment",
                    "actorType",
                    "receiptId",
                    "requestKey",
                    "state",
                    "version",
                    "createdAt",
                    "command",
                    "created",
                    "replayed",
                    "customerId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Historical exact-command replay; no Location",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "const": "\"1\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "ACCOUNT_MACHINE_CREATE_V1"
                    },
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "actorType": {
                      "type": "string",
                      "const": "account_machine"
                    },
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "state": {
                      "type": "string",
                      "const": "committed"
                    },
                    "version": {
                      "type": "integer",
                      "const": 1
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "command": {
                      "type": "string",
                      "const": "customers:create"
                    },
                    "created": {
                      "type": "boolean",
                      "const": false
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": true
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "accountId",
                    "businessId",
                    "environment",
                    "actorType",
                    "receiptId",
                    "requestKey",
                    "state",
                    "version",
                    "createdAt",
                    "command",
                    "created",
                    "replayed",
                    "customerId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "rate_limited"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "account_api_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "source_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/account-api/businesses/{businessId}/customers/{resourceId}": {
      "get": {
        "operationId": "getAccountTestCustomers",
        "summary": "Current scoped TEST customers detail",
        "description": "Default-off managed-account machine credential and separate restricted DB role. Fresh canonical assignment, account/membership/business, finite grant, scope, quota and audit checks. No human JWT/partner credential substitution, no request body/condition/idempotency headers. Customer rows contain scoped PII; invoice detail is a bounded directory projection, not a PDF/payment/accounting claim. Hosted deployment/activation acceptance remains separate.",
        "security": [
          {
            "AccountTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            },
            "description": "Canonical assigned TEST business; selector alone grants no access."
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current machine read; unresolved totals are null, exact account/business envelope",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "ACCOUNT_MACHINE_READ_V1"
                    },
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "actorType": {
                      "type": "string",
                      "const": "account_machine"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "customers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "customerId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "customerType": {
                            "type": "string",
                            "enum": [
                              "company",
                              "individual"
                            ]
                          },
                          "legalName": {
                            "type": "string",
                            "maxLength": 300
                          },
                          "contactName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 200
                          },
                          "email": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 254
                          },
                          "addressLine1": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 200
                          },
                          "addressLine2": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 200
                          },
                          "town": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 100
                          },
                          "county": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 100
                          },
                          "postcode": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 10
                          },
                          "country": {
                            "type": "string",
                            "const": "GB"
                          },
                          "vatNumber": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "maxLength": 12
                          },
                          "paymentTermsDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 365
                          },
                          "deliveryPreference": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "email"
                            ]
                          },
                          "collectionsPaused": {
                            "type": "boolean"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "archived"
                            ]
                          }
                        },
                        "required": [
                          "customerId",
                          "version",
                          "customerType",
                          "legalName",
                          "contactName",
                          "email",
                          "addressLine1",
                          "addressLine2",
                          "town",
                          "county",
                          "postcode",
                          "country",
                          "vatNumber",
                          "paymentTermsDays",
                          "deliveryPreference",
                          "collectionsPaused",
                          "status"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 1,
                      "minItems": 1
                    },
                    "nextCursor": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "accountId",
                    "businessId",
                    "environment",
                    "actorType",
                    "readOnly",
                    "customers",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "read_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "rate_limited"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "account_api_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/account-api/businesses/{businessId}/customer-commands/{requestKey}": {
      "get": {
        "operationId": "getAccountTestCustomerCreateCommand",
        "summary": "Recover original TEST create receipt",
        "description": "Current same-operation write scope required; account/business/original UUID receipt namespace survives key rotation. Historical version1 ACK does not prove current resource state. No body/Idempotency-Key/conditional headers.404 is no current matching receipt and does not permit a new UUID or automatic POST. Finite shared account quota/current authority and machine audit remain enforced.",
        "security": [
          {
            "AccountTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            }
          },
          {
            "name": "requestKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            },
            "description": "Original POST Idempotency-Key, unchanged."
          }
        ],
        "responses": {
          "200": {
            "description": "Current authorized read of historical creation receipt",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "ACCOUNT_MACHINE_CREATE_V1"
                    },
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "actorType": {
                      "type": "string",
                      "const": "account_machine"
                    },
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "state": {
                      "type": "string",
                      "const": "committed"
                    },
                    "version": {
                      "type": "integer",
                      "const": 1
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "command": {
                      "type": "string",
                      "const": "customers:create"
                    },
                    "created": {
                      "type": "boolean",
                      "const": false
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": true
                    },
                    "customerId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "accountId",
                    "businessId",
                    "environment",
                    "actorType",
                    "receiptId",
                    "requestKey",
                    "state",
                    "version",
                    "createdAt",
                    "command",
                    "created",
                    "replayed",
                    "customerId"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "rate_limited"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "account_api_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "source_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/account-api/businesses/{businessId}/invoices": {
      "get": {
        "operationId": "listAccountTestInvoices",
        "summary": "Current scoped TEST invoices page",
        "description": "Default-off managed-account machine credential and separate restricted DB role. Fresh canonical assignment, account/membership/business, finite grant, scope, quota and audit checks. No human JWT/partner credential substitution, no request body/condition/idempotency headers. Customer rows contain scoped PII; invoice detail is a bounded directory projection, not a PDF/payment/accounting claim. Hosted deployment/activation acceptance remains separate.",
        "security": [
          {
            "AccountTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            },
            "description": "Canonical assigned TEST business; selector alone grants no access."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Canonical integer, no repeated/unknown query keys."
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            },
            "description": "Exclusive lowercase nonzero UUID keyset cursor."
          }
        ],
        "responses": {
          "200": {
            "description": "Current machine read; unresolved totals are null, exact account/business envelope",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "ACCOUNT_MACHINE_READ_V1"
                    },
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "actorType": {
                      "type": "string",
                      "const": "account_machine"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "invoices": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "version": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 2147483647
                              },
                              "customerId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "net": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "documentState": {
                                "type": "string",
                                "const": "draft"
                              },
                              "calculationState": {
                                "type": "string",
                                "const": "unresolved"
                              },
                              "vat": {
                                "type": "null"
                              },
                              "gross": {
                                "type": "null"
                              },
                              "invoiceNumber": {
                                "type": "null"
                              }
                            },
                            "required": [
                              "invoiceId",
                              "version",
                              "customerId",
                              "currency",
                              "net",
                              "documentState",
                              "calculationState",
                              "vat",
                              "gross",
                              "invoiceNumber"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "version": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 2147483647
                              },
                              "customerId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "net": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "documentState": {
                                "type": "string",
                                "const": "draft"
                              },
                              "calculationState": {
                                "type": "string",
                                "const": "calculated"
                              },
                              "vat": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "gross": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "invoiceNumber": {
                                "type": "null"
                              }
                            },
                            "required": [
                              "invoiceId",
                              "version",
                              "customerId",
                              "currency",
                              "net",
                              "documentState",
                              "calculationState",
                              "vat",
                              "gross",
                              "invoiceNumber"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "version": {
                                "type": "integer",
                                "minimum": 2,
                                "maximum": 2147483647
                              },
                              "customerId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "net": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "documentState": {
                                "type": "string",
                                "const": "issued"
                              },
                              "calculationState": {
                                "type": "string",
                                "const": "calculated"
                              },
                              "vat": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "gross": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "invoiceNumber": {
                                "type": "string",
                                "pattern": "^TST-[0-9]{6,10}(?![\\s\\S])"
                              }
                            },
                            "required": [
                              "invoiceId",
                              "version",
                              "customerId",
                              "currency",
                              "net",
                              "documentState",
                              "calculationState",
                              "vat",
                              "gross",
                              "invoiceNumber"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "maxItems": 100
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "accountId",
                    "businessId",
                    "environment",
                    "actorType",
                    "readOnly",
                    "invoices",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "read_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "rate_limited"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "account_api_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createAccountTestInvoiceDraft",
        "summary": "Create scoped TEST invoice draft",
        "description": "Default-off Account48 machine create, with corresponding customers:create or invoices:draft:create scope. One caller-retained canonical Idempotency-Key shared across operations in the same assigned account/business; exact canonical payload replay survives credential rotation with fresh authority. Backend validates/calculates and atomically writes resource, immutable receipt and machine audit. Initial201/replay200 ACK version1 is historical creation, not current detail. Any lost/malformed/unavailable POST ACK is outcome unknown: retain original key and recover its operation-specific command receipt; never automatically retry or replace UUID. Draft creation does not approve/issue/email/collect/export. Customer JSON body <=16KiB; draft<=64KiB; no query/conditional headers. Repository contract does not activate hosted flags/roles/grants.",
        "security": [
          {
            "AccountTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            },
            "description": "Persist before sending; never replace after unknown outcome."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customerId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                  },
                  "currency": {
                    "type": "string",
                    "const": "GBP"
                  },
                  "supplyDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "intendedIssueDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "dueDate": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "supplyScenario": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "domestic_b2b_services",
                      "unknown",
                      "unsupported"
                    ]
                  },
                  "purchaseOrderReference": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "notes": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "unit": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 40
                        },
                        "quantity": {
                          "type": "string",
                          "maxLength": 12,
                          "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,4})?$"
                        },
                        "unitNetAmount": {
                          "type": "string",
                          "maxLength": 12,
                          "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,4})?$"
                        },
                        "taxCode": {
                          "type": "string",
                          "maxLength": 64,
                          "pattern": "^[A-Z][A-Z0-9_]{0,63}$"
                        }
                      },
                      "required": [
                        "description",
                        "quantity",
                        "unitNetAmount",
                        "taxCode"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100,
                    "minItems": 1
                  }
                },
                "required": [
                  "customerId",
                  "currency",
                  "lines"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Committed new resource at version1",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "const": "\"1\""
                }
              },
              "Location": {
                "schema": {
                  "type": "string",
                  "pattern": "^/v1/account-api/businesses/[0-9a-f-]{36}/invoices/[0-9a-f-]{36}(?![\\s\\S])"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "ACCOUNT_MACHINE_CREATE_V1"
                    },
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "actorType": {
                      "type": "string",
                      "const": "account_machine"
                    },
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "state": {
                      "type": "string",
                      "const": "committed"
                    },
                    "version": {
                      "type": "integer",
                      "const": 1
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "command": {
                      "type": "string",
                      "const": "invoices:draft:create"
                    },
                    "created": {
                      "type": "boolean",
                      "const": true
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": false
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "documentState": {
                      "type": "string",
                      "const": "draft"
                    },
                    "issueAvailable": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "accountId",
                    "businessId",
                    "environment",
                    "actorType",
                    "receiptId",
                    "requestKey",
                    "state",
                    "version",
                    "createdAt",
                    "command",
                    "created",
                    "replayed",
                    "invoiceId",
                    "documentState",
                    "issueAvailable"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Historical exact-command replay; no Location",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "Tallylane-Version": {
                "schema": {
                  "type": "string",
                  "const": "\"1\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "ACCOUNT_MACHINE_CREATE_V1"
                    },
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "actorType": {
                      "type": "string",
                      "const": "account_machine"
                    },
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "state": {
                      "type": "string",
                      "const": "committed"
                    },
                    "version": {
                      "type": "integer",
                      "const": 1
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "command": {
                      "type": "string",
                      "const": "invoices:draft:create"
                    },
                    "created": {
                      "type": "boolean",
                      "const": false
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": true
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "documentState": {
                      "type": "string",
                      "const": "draft"
                    },
                    "issueAvailable": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "accountId",
                    "businessId",
                    "environment",
                    "actorType",
                    "receiptId",
                    "requestKey",
                    "state",
                    "version",
                    "createdAt",
                    "command",
                    "created",
                    "replayed",
                    "invoiceId",
                    "documentState",
                    "issueAvailable"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request",
                        "invalid_idempotency_key"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "rate_limited"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "account_api_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "source_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/account-api/businesses/{businessId}/invoices/{resourceId}": {
      "get": {
        "operationId": "getAccountTestInvoices",
        "summary": "Current scoped TEST invoices detail",
        "description": "Default-off managed-account machine credential and separate restricted DB role. Fresh canonical assignment, account/membership/business, finite grant, scope, quota and audit checks. No human JWT/partner credential substitution, no request body/condition/idempotency headers. Customer rows contain scoped PII; invoice detail is a bounded directory projection, not a PDF/payment/accounting claim. Hosted deployment/activation acceptance remains separate.",
        "security": [
          {
            "AccountTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            },
            "description": "Canonical assigned TEST business; selector alone grants no access."
          },
          {
            "name": "resourceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current machine read; unresolved totals are null, exact account/business envelope",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "ACCOUNT_MACHINE_READ_V1"
                    },
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "actorType": {
                      "type": "string",
                      "const": "account_machine"
                    },
                    "readOnly": {
                      "type": "boolean",
                      "const": true
                    },
                    "invoices": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "version": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 2147483647
                              },
                              "customerId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "net": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "documentState": {
                                "type": "string",
                                "const": "draft"
                              },
                              "calculationState": {
                                "type": "string",
                                "const": "unresolved"
                              },
                              "vat": {
                                "type": "null"
                              },
                              "gross": {
                                "type": "null"
                              },
                              "invoiceNumber": {
                                "type": "null"
                              }
                            },
                            "required": [
                              "invoiceId",
                              "version",
                              "customerId",
                              "currency",
                              "net",
                              "documentState",
                              "calculationState",
                              "vat",
                              "gross",
                              "invoiceNumber"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "version": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 2147483647
                              },
                              "customerId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "net": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "documentState": {
                                "type": "string",
                                "const": "draft"
                              },
                              "calculationState": {
                                "type": "string",
                                "const": "calculated"
                              },
                              "vat": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "gross": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "invoiceNumber": {
                                "type": "null"
                              }
                            },
                            "required": [
                              "invoiceId",
                              "version",
                              "customerId",
                              "currency",
                              "net",
                              "documentState",
                              "calculationState",
                              "vat",
                              "gross",
                              "invoiceNumber"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "version": {
                                "type": "integer",
                                "minimum": 2,
                                "maximum": 2147483647
                              },
                              "customerId": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                              },
                              "currency": {
                                "type": "string",
                                "const": "GBP"
                              },
                              "net": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "documentState": {
                                "type": "string",
                                "const": "issued"
                              },
                              "calculationState": {
                                "type": "string",
                                "const": "calculated"
                              },
                              "vat": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "gross": {
                                "type": "string",
                                "pattern": "^(?:(?:0|[1-9][0-9]{0,8})\\.[0-9]{2}|1000000000\\.00)(?![\\s\\S])",
                                "maxLength": 13
                              },
                              "invoiceNumber": {
                                "type": "string",
                                "pattern": "^TST-[0-9]{6,10}(?![\\s\\S])"
                              }
                            },
                            "required": [
                              "invoiceId",
                              "version",
                              "customerId",
                              "currency",
                              "net",
                              "documentState",
                              "calculationState",
                              "vat",
                              "gross",
                              "invoiceNumber"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "maxItems": 1,
                      "minItems": 1
                    },
                    "nextCursor": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "accountId",
                    "businessId",
                    "environment",
                    "actorType",
                    "readOnly",
                    "invoices",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "read_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "rate_limited"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "account_api_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/account-api/businesses/{businessId}/invoice-draft-commands/{requestKey}": {
      "get": {
        "operationId": "getAccountTestInvoiceDraftCreateCommand",
        "summary": "Recover original TEST create receipt",
        "description": "Current same-operation write scope required; account/business/original UUID receipt namespace survives key rotation. Historical version1 ACK does not prove current resource state. No body/Idempotency-Key/conditional headers.404 is no current matching receipt and does not permit a new UUID or automatic POST. Finite shared account quota/current authority and machine audit remain enforced.",
        "security": [
          {
            "AccountTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            }
          },
          {
            "name": "requestKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            },
            "description": "Original POST Idempotency-Key, unchanged."
          }
        ],
        "responses": {
          "200": {
            "description": "Current authorized read of historical creation receipt",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "ACCOUNT_MACHINE_CREATE_V1"
                    },
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "actorType": {
                      "type": "string",
                      "const": "account_machine"
                    },
                    "receiptId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "requestKey": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "state": {
                      "type": "string",
                      "const": "committed"
                    },
                    "version": {
                      "type": "integer",
                      "const": 1
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "command": {
                      "type": "string",
                      "const": "invoices:draft:create"
                    },
                    "created": {
                      "type": "boolean",
                      "const": false
                    },
                    "replayed": {
                      "type": "boolean",
                      "const": true
                    },
                    "invoiceId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "documentState": {
                      "type": "string",
                      "const": "draft"
                    },
                    "issueAvailable": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "accountId",
                    "businessId",
                    "environment",
                    "actorType",
                    "receiptId",
                    "requestKey",
                    "state",
                    "version",
                    "createdAt",
                    "command",
                    "created",
                    "replayed",
                    "invoiceId",
                    "documentState",
                    "issueAvailable"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "429": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "rate_limited"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "account_api_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "source_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/admin/customer-accounts/{accountId}/api-credentials": {
      "get": {
        "operationId": "getAdminAccountTestCredentials",
        "summary": "Read credential metadata without secrets",
        "description": "Default-off TEST administrator credential lifecycle. Human Supabase session and current global admin plus explicit finite per-account management grant/canonical assigned business are required; a global administrator grant alone is insufficient. No customer machine key or partner token substitutes for the human management session. Token returned once after new committed create/rotate, never retrievable from metadata/replay. Unknown secret outcome: preserve key, inspect metadata and explicitly revoke/rotate; never imply replay recovers the token. Scope list unique; canonical versions/numbers and <=2KiB exact closed JSON, no query/If-Match. Hosted activation is separate.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current canonical account credential metadata and finite management scope; no secret",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "ACCOUNT_API_CREDENTIALS_V1"
                    },
                    "accountId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "businessId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                    },
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "adminGrantRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "managementRevision": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647
                    },
                    "allowedScopes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "customers:read",
                          "invoices:read",
                          "customers:create",
                          "invoices:draft:create"
                        ]
                      },
                      "minItems": 1,
                      "maxItems": 4
                    },
                    "managementExpiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "credentials": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "credentialId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                          },
                          "accountId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                          },
                          "businessId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                          },
                          "environment": {
                            "type": "string",
                            "const": "test"
                          },
                          "scopes": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "customers:read",
                                "invoices:read",
                                "customers:create",
                                "invoices:draft:create"
                              ]
                            },
                            "minItems": 1,
                            "maxItems": 4
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "revoked"
                            ]
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "managementRevision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 2147483647
                          },
                          "issuedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "expiresAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "revokedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "credentialId",
                          "accountId",
                          "businessId",
                          "environment",
                          "scopes",
                          "status",
                          "revision",
                          "managementRevision",
                          "issuedAt",
                          "expiresAt",
                          "revokedAt"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 20
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "accountId",
                    "businessId",
                    "environment",
                    "adminGrantRevision",
                    "managementRevision",
                    "allowedScopes",
                    "managementExpiresAt",
                    "credentials"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "account_api_management_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "manageAdminAccountTestCredential",
        "summary": "Create, rotate or revoke scoped TEST account credential",
        "description": "Default-off TEST administrator credential lifecycle. Human Supabase session and current global admin plus explicit finite per-account management grant/canonical assigned business are required; a global administrator grant alone is insufficient. No customer machine key or partner token substitutes for the human management session. Token returned once after new committed create/rotate, never retrievable from metadata/replay. Unknown secret outcome: preserve key, inspect metadata and explicitly revoke/rotate; never imply replay recovers the token. Scope list unique; canonical versions/numbers and <=2KiB exact closed JSON, no query/If-Match. Hosted activation is separate.",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
            }
          },
          {
            "name": "Tallylane-If-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\"(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])\"$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "confirmed": {
                        "type": "boolean",
                        "const": true
                      },
                      "expectedManagementRevision": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 2147483647
                      },
                      "command": {
                        "type": "string",
                        "const": "create"
                      },
                      "scopes": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "customers:read",
                            "invoices:read",
                            "customers:create",
                            "invoices:draft:create"
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 4
                      },
                      "ttlSeconds": {
                        "type": "integer",
                        "minimum": 60,
                        "maximum": 86400
                      },
                      "credentialId": {
                        "type": "null"
                      },
                      "expectedCredentialRevision": {
                        "type": "null"
                      }
                    },
                    "required": [
                      "confirmed",
                      "expectedManagementRevision",
                      "command",
                      "scopes",
                      "ttlSeconds",
                      "credentialId",
                      "expectedCredentialRevision"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "confirmed": {
                        "type": "boolean",
                        "const": true
                      },
                      "expectedManagementRevision": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 2147483647
                      },
                      "command": {
                        "type": "string",
                        "const": "rotate"
                      },
                      "scopes": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "customers:read",
                            "invoices:read",
                            "customers:create",
                            "invoices:draft:create"
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 4
                      },
                      "ttlSeconds": {
                        "type": "integer",
                        "minimum": 60,
                        "maximum": 86400
                      },
                      "credentialId": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                      },
                      "expectedCredentialRevision": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 2147483647
                      }
                    },
                    "required": [
                      "confirmed",
                      "expectedManagementRevision",
                      "command",
                      "scopes",
                      "ttlSeconds",
                      "credentialId",
                      "expectedCredentialRevision"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "confirmed": {
                        "type": "boolean",
                        "const": true
                      },
                      "expectedManagementRevision": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 2147483647
                      },
                      "command": {
                        "type": "string",
                        "const": "revoke"
                      },
                      "scopes": {
                        "type": "null"
                      },
                      "ttlSeconds": {
                        "type": "integer",
                        "const": 0
                      },
                      "credentialId": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                      },
                      "expectedCredentialRevision": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 2147483647
                      }
                    },
                    "required": [
                      "confirmed",
                      "expectedManagementRevision",
                      "command",
                      "scopes",
                      "ttlSeconds",
                      "credentialId",
                      "expectedCredentialRevision"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New one-time secret or metadata-only replay/revoke",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "string",
                          "const": "ACCOUNT_API_CREDENTIAL_COMMAND_V1"
                        },
                        "credential": {
                          "type": "object",
                          "properties": {
                            "credentialId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                            },
                            "accountId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                            },
                            "businessId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                            },
                            "environment": {
                              "type": "string",
                              "const": "test"
                            },
                            "scopes": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "customers:read",
                                  "invoices:read",
                                  "customers:create",
                                  "invoices:draft:create"
                                ]
                              },
                              "minItems": 1,
                              "maxItems": 4
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "revoked"
                              ]
                            },
                            "revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "managementRevision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "issuedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "revokedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          },
                          "required": [
                            "credentialId",
                            "accountId",
                            "businessId",
                            "environment",
                            "scopes",
                            "status",
                            "revision",
                            "managementRevision",
                            "issuedAt",
                            "expiresAt",
                            "revokedAt"
                          ],
                          "additionalProperties": false
                        },
                        "replayed": {
                          "type": "boolean",
                          "const": false
                        },
                        "secretAvailable": {
                          "type": "boolean",
                          "const": true
                        },
                        "token": {
                          "type": "string",
                          "pattern": "^tla_test\\.[0-9a-f-]{36}\\.[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048](?![\\s\\S])"
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "credential",
                        "replayed",
                        "secretAvailable",
                        "token"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "schemaVersion": {
                          "type": "string",
                          "const": "ACCOUNT_API_CREDENTIAL_COMMAND_V1"
                        },
                        "credential": {
                          "type": "object",
                          "properties": {
                            "credentialId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                            },
                            "accountId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                            },
                            "businessId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^(?!00000000-0000-0000-0000-000000000000(?![\\s\\S]))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?![\\s\\S])"
                            },
                            "environment": {
                              "type": "string",
                              "const": "test"
                            },
                            "scopes": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "customers:read",
                                  "invoices:read",
                                  "customers:create",
                                  "invoices:draft:create"
                                ]
                              },
                              "minItems": 1,
                              "maxItems": 4
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "revoked"
                              ]
                            },
                            "revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "managementRevision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "issuedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "revokedAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            }
                          },
                          "required": [
                            "credentialId",
                            "accountId",
                            "businessId",
                            "environment",
                            "scopes",
                            "status",
                            "revision",
                            "managementRevision",
                            "issuedAt",
                            "expiresAt",
                            "revokedAt"
                          ],
                          "additionalProperties": false
                        },
                        "replayed": {
                          "type": "boolean"
                        },
                        "secretAvailable": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "schemaVersion",
                        "credential",
                        "replayed",
                        "secretAvailable"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "invalid_request"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "unauthorized"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "access_denied"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "not_found"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "command_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "412": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_conflict"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "428": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "version_required"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Closed current authority/validation/quota denial or unavailable source",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "account_api_management_unavailable"
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/embedded/companies/{companyId}/account": {
      "get": {
        "security": [
          {
            "EmbeddedTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "operationId": "getEmbeddedCompanyAccount",
        "summary": "Read the Tallylane account bound to an external company",
        "description": "Read-only receipt. Does not dispatch provider recovery or create an identity. Client grant is checked before any lookup. Current TEST mapping only.",
        "responses": {
          "400": {
            "description": "Closed body or header validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked or expired integration credential",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current integration/company permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "No bound account",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Command or account binding conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Feature/configuration/database/provider unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Current account receipt or explicit null",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "const": "test",
                      "type": "string"
                    },
                    "account": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "provisioningId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "accountId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "businessId": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "prepared",
                                "provider_pending",
                                "provider_unknown",
                                "provider_rejected",
                                "completed"
                              ]
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 2147483647
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "completedAt": {
                              "oneOf": [
                                {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "recoveryAttempts": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5
                            }
                          },
                          "required": [
                            "provisioningId",
                            "accountId",
                            "businessId",
                            "state",
                            "version",
                            "createdAt",
                            "completedAt",
                            "recoveryAttempts"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "legalName": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "environment",
                    "account"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "security": [
          {
            "EmbeddedTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "operationId": "createEmbeddedCompanyAccount",
        "summary": "Create a TEST account and one business for a permitted external company",
        "description": "Explicit create action. Uses the dedicated client principal and company allowlist, never a human admin session. Finite grant, bounded quota, durable reservation/lease, provider exact-ID readback and atomic platform completion. Replays retain the original key/content; unknown outcomes recover the reserved provider identity by read, never create a second one. Server-generated password is transit-only and is never stored/returned. Creates an owner account, not a legally issued invoice.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "externalUserId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "businessProfile": {
                    "type": "object",
                    "properties": {
                      "legalName": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "businessForm": {
                        "type": "string",
                        "enum": [
                          "limited_company",
                          "sole_trader",
                          "partnership",
                          "other"
                        ]
                      },
                      "tradingName": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "addressLine1": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "addressLine2": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "town": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "county": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "postcode": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "companyNumber": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "vatRegistrationStatus": {
                        "type": "string",
                        "enum": [
                          "registered",
                          "not_registered",
                          "unknown"
                        ]
                      },
                      "vatNumber": {
                        "oneOf": [
                          {
                            "type": "string",
                            "maxLength": 300
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "legalName",
                      "businessForm",
                      "tradingName",
                      "addressLine1",
                      "addressLine2",
                      "town",
                      "county",
                      "postcode",
                      "companyNumber",
                      "vatRegistrationStatus",
                      "vatNumber"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "email",
                  "externalUserId",
                  "businessProfile"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Closed body or header validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked or expired integration credential",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current integration/company permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "No bound account",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Command or account binding conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Feature/configuration/database/provider unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "200": {
            "description": "Existing canonical receipt/recovery result",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "provisioning": {
                      "type": "object",
                      "properties": {
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "accountId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "prepared",
                            "provider_pending",
                            "provider_unknown",
                            "provider_rejected",
                            "completed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "completedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "recoveryAttempts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "provisioningId",
                        "accountId",
                        "businessId",
                        "state",
                        "version",
                        "createdAt",
                        "completedAt",
                        "recoveryAttempts"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "environment",
                    "provisioning",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "Confirmed new TEST account and business",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "provisioning": {
                      "type": "object",
                      "properties": {
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "accountId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "prepared",
                            "provider_pending",
                            "provider_unknown",
                            "provider_rejected",
                            "completed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "completedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "recoveryAttempts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "provisioningId",
                        "accountId",
                        "businessId",
                        "state",
                        "version",
                        "createdAt",
                        "completedAt",
                        "recoveryAttempts"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "environment",
                    "provisioning",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "202": {
            "description": "Prepared or unknown provider result; preserve original request",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string",
                      "const": "test"
                    },
                    "provisioning": {
                      "type": "object",
                      "properties": {
                        "provisioningId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "accountId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "prepared",
                            "provider_pending",
                            "provider_unknown",
                            "provider_rejected",
                            "completed"
                          ]
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483647
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "completedAt": {
                          "oneOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "recoveryAttempts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "provisioningId",
                        "accountId",
                        "businessId",
                        "state",
                        "version",
                        "createdAt",
                        "completedAt",
                        "recoveryAttempts"
                      ],
                      "additionalProperties": false
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "environment",
                    "provisioning",
                    "replayed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/embedded/companies/{companyId}/credentials": {
      "post": {
        "security": [
          {
            "EmbeddedTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "operationId": "issueEmbeddedCompanyCredential",
        "summary": "Issue a finite server-only API credential for a completed embedded account",
        "description": "Explicit non-idempotent credential mint, maximum twenty active credentials per account. Only a currently authorized client for the bound company can request one; completed provider/account/business/membership identity is independently rechecked. Account token is returned once and must be encrypted in the partner BFF; metadata/replays never recover a lost secret. Unknown mint may be explicitly repeated subject to quota. Credential expiry <=1 hour and <=current grant deadline. Other active sessions are preserved. Client revocation/deadline/removed company allowlist also invalidates account API access.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "externalUserId": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "externalUserId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Closed body or header validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked or expired integration credential",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Current integration/company permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "No bound account",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Command or account binding conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "503": {
            "description": "Feature/configuration/database/provider unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "New finite credential; secret returned exactly once",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "credential": {
                      "type": "object",
                      "properties": {
                        "credentialId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "accountId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "businessId": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "legalName": {
                          "type": "string"
                        },
                        "environment": {
                          "type": "string",
                          "const": "test"
                        },
                        "expiresAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "customers:read",
                              "customers:create",
                              "invoices:read",
                              "invoices:draft:create"
                            ]
                          }
                        }
                      },
                      "required": [
                        "credentialId",
                        "accountId",
                        "businessId",
                        "legalName",
                        "environment",
                        "expiresAt",
                        "scopes"
                      ],
                      "additionalProperties": false
                    },
                    "token": {
                      "type": "string",
                      "pattern": "^tla_test\\.[0-9a-f-]{36}\\.[A-Za-z0-9_-]{43}$"
                    }
                  },
                  "required": [
                    "credential",
                    "token"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/embedded/companies/{companyId}/owner-session": {
      "post": {
        "tags": [
          "Mars embedded TEST accounting"
        ],
        "operationId": "createMarsOwnerSession",
        "summary": "Exchange the bound original Mars owner proof for a finite native TEST session (trusted BFF only)",
        "description": "Requires explicit finite embedded-client owner-session permission and the signed original Cognito access token. No browser token, password, email link or refresh token is returned. Native Tallylane roles, policy, TEST issue grants and Xero demo gates remain authoritative. A proof is accepted once; an unconfirmed outcome requires a new Mars session.",
        "security": [
          {
            "EmbeddedTestBearer": []
          }
        ],
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-Mars-Authorization",
            "in": "header",
            "required": true,
            "description": "Bearer followed by the current signed Mars access token; server-only.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Finite session and server-only accessToken"
          },
          "400": {
            "description": "Closed request shape required"
          },
          "401": {
            "description": "Invalid integration or Mars proof"
          },
          "403": {
            "description": "Not the original bound owner or permission revoked"
          },
          "404": {
            "description": "No bound account"
          },
          "409": {
            "description": "Proof used or quota; refresh Mars session"
          },
          "503": {
            "description": "Provider or configuration unavailable"
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoice-workflow-commands/{requestKey}": {
      "get": {
        "tags": [
          "Mars embedded TEST accounting"
        ],
        "operationId": "readInvoiceWorkflowCommand",
        "summary": "Read the original actor-owned financial command receipt without repeating a write",
        "security": [
          {
            "SupabaseUserSession": []
          }
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "requestKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Committed original command receipt"
          },
          "401": {
            "description": "Session expired or revoked"
          },
          "403": {
            "description": "Role denied"
          },
          "404": {
            "description": "No receipt for this actor, business and key"
          },
          "503": {
            "description": "Read unavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "SupabaseUserSession": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Supabase user access token verified using public asymmetric keys, issuer, authenticated audience, expiry and current provider session. Anonymous/service tokens rejected. Current database memberships determine access."
      },
      "InvoicePayerCapability": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Tallylane-Payer-Token",
        "description": "Opaque 43-character base64url capability received only through the private share URL fragment and request header. UUID alone grants no access. Expiry, revocation, current owner/business/private grant and immutable issued context are rechecked; no query token or anonymous writes."
      },
      "PartnerTestBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "tlp_test.<credential UUID>.<base64url32>",
        "description": "Operator-provisioned TEST machine credential only; canonical nonzero lowercase UUID and 32-byte base64url secret. Separate restricted machine DB context; no Supabase JWT, human membership or public MFA consent bridge. Current named client/credential/link/grant/genuine consenting owner and finite deadlines rechecked per request; default-off."
      },
      "PostmarkWebhookBasic": {
        "type": "http",
        "scheme": "basic",
        "description": "Dedicated server-only Postmark webhook credential, separate from provider API token and human JWT. HTTPS plus separately verified trusted-edge IP allowlist prerequisite; never trust caller forwarding headers."
      },
      "AccountTestBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "tla_test.<credentialUUID>.<canonicalBase64url32ByteSecret>",
        "description": "Environment-only scoped TEST managed-account machine credential. Canonical assigned account/business, fresh finite authority and registered restricted DB role; never a human JWT/session or partner key."
      },
      "EmbeddedTestBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "tle_test.<client UUID>.<base64url32>",
        "description": "Server-only embedded TEST client. Current finite database grant, company allowlist and a separate restricted embedded database role are checked on every operation. No human JWT/session or administrator role. Account/customer/invoice identities are scoped to the external company. Hosted activation is separate."
      }
    }
  }
}
