{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peoplescourt-ai/json-schema/peoplescourt-ai-account-authorizations-schema.json",
  "title": "AccountAuthorizations",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peoplescourt-ai-authorizations-api-openapi.yml#/components/schemas/AccountAuthorizations",
  "type": "object",
  "properties": {
    "clients": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AccountOAuthClient"
      }
    },
    "grants": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AccountAuthorityGrant"
      }
    },
    "notices": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "grantId": {
            "type": "string"
          },
          "caseId": {
            "type": "string"
          },
          "termsDigest": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "grantId",
          "caseId",
          "termsDigest",
          "createdAt"
        ]
      }
    }
  },
  "required": [
    "clients",
    "grants",
    "notices"
  ],
  "$defs": {
    "AccountAuthorityGrant": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "principalId": {
          "type": "string"
        },
        "clientId": {
          "type": "string"
        },
        "delegatePartnerId": {
          "type": "string"
        },
        "scope": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "cases:read",
              "fees:agentic:write",
              "executions:report",
              "filings:write",
              "answers:write",
              "submissions:write",
              "records:confirm",
              "records:write",
              "invitations:write",
              "messages:write",
              "remedies:write",
              "representatives:manage",
              "procedural:request",
              "termination:write",
              "consents:write",
              "offline_access"
            ]
          }
        },
        "resource": {
          "type": "string"
        },
        "terms": {
          "$ref": "#/$defs/AccountOAuthTerms"
        },
        "caseId": {
          "type": "string"
        },
        "caseBinding": {
          "type": "object",
          "properties": {
            "disputeId": {
              "type": "string"
            },
            "membershipId": {
              "type": "string"
            },
            "side": {
              "type": "string",
              "enum": [
                "claimant",
                "respondent"
              ]
            }
          },
          "required": [
            "disputeId",
            "membershipId",
            "side"
          ]
        },
        "standing": {
          "$ref": "#/$defs/AccountStandingBounds"
        },
        "approvedAt": {
          "type": "string"
        },
        "expiresAt": {
          "type": "string"
        },
        "revokedAt": {
          "type": "string"
        },
        "source": {
          "type": "string",
          "enum": [
            "authorization_code",
            "hosted_link",
            "agent_registration",
            "connector"
          ]
        },
        "termsChange": {
          "type": "string",
          "enum": [
            "hold_writes"
          ],
          "description": "Set on a connector grant approved through a consent screen that states the hold. A later Rules or disclosure change holds the grant, allowing only cases:read, until the person re-accepts."
        },
        "termsHistory": {
          "type": "array",
          "description": "Terms this grant carried before each re-acceptance, oldest first.",
          "items": {
            "type": "object",
            "properties": {
              "terms": {
                "$ref": "#/$defs/AccountOAuthTerms"
              },
              "acceptedAt": {
                "type": "string"
              },
              "supersededAt": {
                "type": "string"
              },
              "via": {
                "type": "string",
                "enum": [
                  "consent_screen",
                  "account_reacceptance"
                ]
              }
            },
            "required": [
              "terms",
              "acceptedAt",
              "supersededAt",
              "via"
            ]
          }
        },
        "reacceptance": {
          "type": "object",
          "description": "The latest re-acceptance of the current terms from the person's account.",
          "properties": {
            "at": {
              "type": "string"
            },
            "sessionId": {
              "type": "string"
            },
            "statementSha256": {
              "type": "string"
            }
          },
          "required": [
            "at",
            "sessionId",
            "statementSha256"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "expired",
            "revoked",
            "reacceptance_required",
            "held"
          ]
        }
      },
      "required": [
        "id",
        "principalId",
        "clientId",
        "scope",
        "resource",
        "terms",
        "approvedAt",
        "expiresAt",
        "source"
      ]
    },
    "AccountOAuthClient": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": [
            "personal",
            "agent",
            "partner"
          ]
        },
        "partnerId": {
          "type": "string"
        },
        "mcpCaseId": {
          "type": "string"
        },
        "redirectUris": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "cases:read",
              "fees:agentic:write",
              "executions:report",
              "filings:write",
              "answers:write",
              "submissions:write",
              "records:confirm",
              "records:write",
              "invitations:write",
              "messages:write",
              "remedies:write",
              "representatives:manage",
              "procedural:request",
              "termination:write",
              "consents:write",
              "offline_access"
            ]
          }
        },
        "createdAt": {
          "type": "string"
        },
        "revokedAt": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name",
        "kind",
        "redirectUris",
        "scopes",
        "createdAt"
      ]
    },
    "AccountOAuthTerms": {
      "type": "object",
      "properties": {
        "rulesVersion": {
          "type": "string"
        },
        "rulesHash": {
          "type": "string"
        },
        "disclosureVersion": {
          "type": "string"
        },
        "disclosureHash": {
          "type": "string"
        }
      },
      "required": [
        "rulesVersion",
        "rulesHash",
        "disclosureVersion",
        "disclosureHash"
      ]
    },
    "AccountStandingBounds": {
      "type": "object",
      "properties": {
        "acts": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "file_dispute",
              "answer"
            ]
          }
        },
        "maximumAmount": {
          "type": "object",
          "properties": {
            "currency": {
              "type": "string",
              "const": "USD"
            },
            "minorUnits": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,14}$"
            }
          },
          "required": [
            "currency",
            "minorUnits"
          ]
        },
        "transactionIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        },
        "procedure": {
          "type": "string",
          "const": "standard"
        },
        "clock": {
          "type": "string",
          "const": "ordinary"
        }
      },
      "required": [
        "acts",
        "maximumAmount",
        "expiresAt",
        "procedure",
        "clock"
      ]
    }
  }
}