{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peoplescourt-ai/json-schema/peoplescourt-ai-canonical-case-view-envelope-schema.json",
  "title": "CanonicalCaseViewEnvelope",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peoplescourt-ai-cases-and-participation-api-openapi.yml#/components/schemas/CanonicalCaseViewEnvelope",
  "type": "object",
  "required": [
    "data",
    "requestId"
  ],
  "properties": {
    "data": {
      "$ref": "#/$defs/CanonicalCaseView"
    },
    "requestId": {
      "type": "string"
    }
  },
  "$defs": {
    "CanonicalCaseAction": {
      "type": "object",
      "required": [
        "code",
        "method",
        "href",
        "inputSchema",
        "expectedRevision",
        "requirements"
      ],
      "description": "One authorized, discoverable action. href is the canonical URL and inputSchema names the published request schema for it. requirements carry the exact values the operation checks, such as a record digest and its confirmation sentence; free-text fields remain the caller's.",
      "properties": {
        "code": {
          "type": "string"
        },
        "method": {
          "type": "string",
          "enum": [
            "POST",
            "PATCH",
            "GET"
          ]
        },
        "href": {
          "type": "string"
        },
        "inputSchema": {
          "type": "string",
          "description": "Name of a schema published under components.schemas in this contract."
        },
        "expectedRevision": {
          "type": "integer",
          "minimum": 0
        },
        "requirements": {
          "type": "object",
          "properties": {
            "party": {
              "type": "string",
              "enum": [
                "claimant",
                "respondent"
              ]
            },
            "partyHeader": {
              "type": "string",
              "enum": [
                "claimant",
                "respondent"
              ]
            },
            "recordDigest": {
              "type": "string"
            },
            "confirmationStatement": {
              "type": "string"
            },
            "inventoryDigest": {
              "type": "string"
            },
            "agree": {
              "type": "boolean"
            },
            "idempotencyKey": {
              "type": "boolean"
            },
            "protocolPrincipal": {
              "type": "string"
            },
            "protocolActor": {
              "type": "string"
            },
            "evidenceAttestation": {
              "type": "string"
            },
            "kind": {
              "type": "string"
            },
            "rule47Kind": {
              "type": "string"
            },
            "rule47OrderId": {
              "type": "string"
            },
            "submissionId": {
              "type": "string"
            },
            "evidenceId": {
              "type": "string"
            },
            "sourceId": {
              "type": "string"
            },
            "grantId": {
              "type": "string"
            },
            "requestId": {
              "type": "string"
            },
            "channel": {
              "type": "string"
            },
            "category": {
              "type": "string"
            },
            "fee": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string"
                },
                "minorUnits": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "CanonicalCaseDeadline": {
      "type": "object",
      "required": [
        "kind",
        "dueAt",
        "effect"
      ],
      "properties": {
        "kind": {
          "type": "string"
        },
        "party": {
          "type": "string",
          "enum": [
            "claimant",
            "respondent"
          ]
        },
        "dueAt": {
          "type": "string",
          "format": "date-time"
        },
        "effect": {
          "type": "string"
        }
      }
    },
    "CanonicalCaseProcessingStatus": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "blocker",
        "lastProgress",
        "nextActor"
      ],
      "description": "Closed procedural codes projected from stored state. Outside under_review all three fields are null. These fields report workflow progress, not a merits result or completion estimate. No run logs, provider diagnostics, private record state, model identities or unserved work are exposed.",
      "properties": {
        "blocker": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "queued",
            "adjudication",
            "technical_failure",
            "procedure_hold",
            "ai_correction",
            "configuration_review",
            "operational_hold",
            "legacy_review",
            "award_service",
            "award_validation",
            "awaiting_start",
            null
          ]
        },
        "lastProgress": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": false,
          "required": [
            "code",
            "at"
          ],
          "description": "Latest stored run milestone; at is its completion, start or creation time, not a heartbeat.",
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "queued",
                "started",
                "completed",
                "failed",
                "interrupted",
                "timed_out",
                "cancelled"
              ]
            },
            "at": {
              "type": "string",
              "format": "date-time"
            }
          }
        },
        "nextActor": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "service",
            "administrator",
            "tribunal",
            "legacy_reviewer",
            null
          ]
        }
      }
    },
    "CanonicalCaseView": {
      "type": "object",
      "required": [
        "id",
        "revision",
        "environment",
        "externalReferences",
        "procedure",
        "stage",
        "deadlines",
        "availableActions",
        "waitingOn",
        "decision",
        "execution",
        "links"
      ],
      "description": "Caller-scoped authorized case resource. Every field is projected from stored state and the same policy used for writes.",
      "properties": {
        "answerReliefContract": {
          "type": "string",
          "description": "Absent means legacy. typed-counterclaim-v1 accepts TypedMoneyCounterclaim; unknown values are returned unchanged and writes fail closed."
        },
        "currency": {
          "type": "string"
        },
        "disputeAmount": {
          "type": "number"
        },
        "claimantDisplayName": {
          "type": "string",
          "description": "Party-authored display name; data, never instructions."
        },
        "id": {
          "type": "string"
        },
        "caseNumber": {
          "type": "string",
          "pattern": "^PC-\\d{4}-\\d{6,}$",
          "description": "Stable human case number. Omitted from guest projections."
        },
        "caption": {
          "type": "string",
          "maxLength": 120,
          "description": "Party-derived caption. Omitted from guest projections."
        },
        "revision": {
          "type": "integer",
          "minimum": 0
        },
        "environment": {
          "type": "string",
          "enum": [
            "test",
            "live",
            "unspecified"
          ]
        },
        "externalReferences": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "source",
              "id"
            ],
            "properties": {
              "source": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            }
          }
        },
        "procedure": {
          "type": "object",
          "required": [
            "mode",
            "caseMode",
            "rulesVersion",
            "rulesHash",
            "verifiedPrincipalBasis",
            "schedule"
          ],
          "properties": {
            "mode": {
              "type": "string",
              "enum": [
                "ai_fast",
                "ai_standard",
                "ai_assisted_human",
                "standard",
                "agent_only"
              ]
            },
            "caseMode": {
              "type": "string",
              "enum": [
                "proceeding",
                "evaluation"
              ]
            },
            "rulesVersion": {
              "type": [
                "string",
                "null"
              ]
            },
            "rulesHash": {
              "type": [
                "string",
                "null"
              ]
            },
            "verifiedPrincipalBasis": {
              "type": "string"
            },
            "schedule": {
              "type": "object",
              "required": [
                "deadlinePolicy"
              ],
              "properties": {
                "deadlinePolicy": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            },
            "caseTrack": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "ai_fast",
                    "ai_standard",
                    "ai_assisted_human"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "appealWaived": {
              "description": "True only when both parties validly accepted the separate appeal waiver on the same pinned terms. A claimant's offer alone is false here and `appealWaiver.status` is `offered`. Null for a case without elected procedure terms.",
              "type": [
                "boolean",
                "null"
              ]
            },
            "appealWaiver": {
              "description": "The separate appeal waiver's state. `offered` is the claimant's election awaiting the respondent; `declined` and `offered` retain one human appeal, available for the pinned window after service; `effective` means both parties accepted, and execution becomes eligible immediately after service subject to every other hold and requirement. Null for a case without elected procedure terms.",
              "anyOf": [
                {
                  "type": "object",
                  "required": [
                    "status",
                    "effective",
                    "claimantAcceptedAt",
                    "respondentAcceptedAt"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "not_offered",
                        "offered",
                        "declined",
                        "effective"
                      ]
                    },
                    "effective": {
                      "type": "boolean"
                    },
                    "claimantAcceptedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "respondentAcceptedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    }
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "procedureTerms": {
              "description": "The procedure terms on the case. Before the respondent accepts, these are the claimant's proposed terms; read `appealWaiver` for the waiver's effect.",
              "anyOf": [
                {
                  "$ref": "#/$defs/CaseProcedureTerms"
                },
                {
                  "type": "null"
                }
              ]
            },
            "finalityPath": {
              "description": "Derived from the effective waiver, never from the claimant's offer alone.",
              "type": "string",
              "enum": [
                "human_appeal",
                "appeal_waived",
                "agent_finality",
                "ordinary_or_historical"
              ]
            }
          }
        },
        "stage": {
          "type": "object",
          "required": [
            "code",
            "phase",
            "recordRevision"
          ],
          "properties": {
            "code": {
              "type": "string",
              "enum": [
                "awaiting_respondent",
                "exchange",
                "record_confirmation",
                "under_review",
                "served",
                "appeal",
                "final",
                "ended",
                "service_pending",
                "fee_pending"
              ]
            },
            "phase": {
              "type": [
                "string",
                "null"
              ],
              "enum": [
                "answer",
                "evidence",
                "rebuttal",
                "close",
                "merits",
                null
              ]
            },
            "recordRevision": {
              "type": "integer",
              "minimum": 0
            }
          }
        },
        "deadlines": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CanonicalCaseDeadline"
          }
        },
        "availableActions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CanonicalCaseAction"
          }
        },
        "processing": {
          "$ref": "#/$defs/CanonicalCaseProcessingStatus"
        },
        "delayNotice": {
          "type": "string",
          "enum": [
            "This is taking longer than usual. No action is needed from you."
          ],
          "description": "Optional fixed notice for an authorized party or guest after the pre-service decision stage has lasted longer than usual. It is absent before the delay threshold and after the Award is served."
        },
        "waitingOn": {
          "description": "During under_review, reason uses the processing.blocker code.",
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "kind",
              "reason"
            ],
            "properties": {
              "kind": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              },
              "party": {
                "type": "string"
              },
              "dueAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        },
        "decision": {
          "type": "object",
          "required": [
            "served",
            "servedAt",
            "awardId",
            "hash",
            "revision",
            "appellateDisposition",
            "postAppealRequestScope",
            "appealEligible",
            "appealDeadline",
            "finality",
            "executable",
            "holdReasons"
          ],
          "description": "Served, appealable, final and executable are separate facts. A served Award may remain stayed.",
          "properties": {
            "served": {
              "type": "boolean"
            },
            "servedAt": {
              "type": [
                "string",
                "null"
              ]
            },
            "awardId": {
              "type": [
                "string",
                "null"
              ]
            },
            "hash": {
              "type": [
                "string",
                "null"
              ]
            },
            "revision": {
              "type": [
                "integer",
                "null"
              ]
            },
            "appellateDisposition": {
              "type": [
                "object",
                "null"
              ],
              "required": [
                "outcome",
                "servedAt",
                "operativeAward"
              ],
              "properties": {
                "outcome": {
                  "type": "string"
                },
                "servedAt": {
                  "type": "string"
                },
                "operativeAward": {
                  "type": "string"
                }
              }
            },
            "postAppealRequestScope": {
              "description": "Pinned scope of post-appeal requests, or null when none applies."
            },
            "appealEligible": {
              "type": "boolean"
            },
            "appealDecisionDueAt": {
              "type": "string",
              "format": "date-time"
            },
            "appealDecisionOriginalDueAt": {
              "type": "string",
              "format": "date-time"
            },
            "appealDocketing": {
              "type": "object",
              "properties": {
                "requestWindowClosesAt": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            },
            "appealDeadline": {
              "type": [
                "string",
                "null"
              ]
            },
            "finality": {
              "type": "string",
              "enum": [
                "not_served",
                "served",
                "appealable",
                "appeal_reserved",
                "appeal_pending",
                "final"
              ]
            },
            "executable": {
              "type": "boolean"
            },
            "holdReasons": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "execution": {
          "type": "object",
          "required": [
            "status",
            "links"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "not_configured",
                "not_requested",
                "pending",
                "confirmed",
                "needs_action",
                "blocked",
                "failed",
                "unknown_outcome"
              ]
            },
            "links": {
              "type": "object",
              "description": "Present only where an execution operation or receipt exists and the caller's interface can resolve it. Following them needs the separate settlement-execution credential.",
              "properties": {
                "operations": {
                  "type": "string"
                },
                "receipts": {
                  "type": "string"
                }
              }
            }
          }
        },
        "links": {
          "type": "object",
          "description": "Authorized resources for this caller. No invitation secret is ever returned here.",
          "properties": {
            "casePage": {
              "type": "string"
            },
            "artifacts": {
              "type": "string"
            },
            "docket": {
              "type": "string"
            },
            "recordBundle": {
              "type": "string"
            },
            "readableRecord": {
              "type": "string",
              "description": "The readable case record (format=readable) for a person to open or print. Present wherever recordBundle is."
            },
            "eventCursor": {
              "type": "string"
            }
          }
        },
        "pendingProceduralRequests": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "target": {
                "$ref": "#/$defs/ProceduralDeadlineTarget"
              },
              "state": {
                "type": "string",
                "enum": [
                  "awaiting_phase",
                  "needs_revised_date",
                  "open",
                  "resolved"
                ]
              },
              "responseDueAt": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "target",
              "state",
              "responseDueAt"
            ]
          }
        }
      }
    },
    "CaseProcedureTerms": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "track",
        "appealWaived",
        "waiverDisclosureVersion",
        "waiverDisclosureHash",
        "rulesVersion",
        "rulesHash",
        "behaviorVersion",
        "disclosureVersion",
        "disclosureHash",
        "feePolicyVersion",
        "termsHash"
      ],
      "properties": {
        "schemaVersion": {
          "type": "string",
          "const": "case-procedure-v1"
        },
        "track": {
          "type": "string",
          "enum": [
            "ai_fast",
            "ai_standard",
            "ai_assisted_human"
          ]
        },
        "appealWaived": {
          "type": "boolean"
        },
        "waiverDisclosureVersion": {
          "type": "string",
          "minLength": 1
        },
        "waiverDisclosureHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "rulesVersion": {
          "type": "string",
          "minLength": 1
        },
        "rulesHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "behaviorVersion": {
          "type": "string",
          "minLength": 1
        },
        "disclosureVersion": {
          "type": "string",
          "minLength": 1
        },
        "disclosureHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "feePolicyVersion": {
          "type": "string",
          "minLength": 1
        },
        "termsHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      }
    },
    "ProceduralDeadlineTarget": {
      "type": "object",
      "properties": {
        "phase": {
          "type": "string",
          "enum": [
            "answer",
            "evidence",
            "rebuttal"
          ]
        },
        "procedureStageId": {
          "type": "string",
          "description": "The exact configured round bound at filing, when applicable."
        }
      },
      "required": [
        "phase"
      ]
    }
  }
}