{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peoplescourt-ai/json-schema/peoplescourt-ai-account-answer-draft-schema.json",
  "title": "AccountAnswerDraft",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peoplescourt-ai-respondent-answers-api-openapi.yml#/components/schemas/AccountAnswerDraft",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "answerId",
    "caseId",
    "status",
    "acceptance",
    "hostedAcceptanceUrl",
    "expiresAt",
    "answerDeadline",
    "reviewPacket",
    "links"
  ],
  "properties": {
    "caseNumber": {
      "type": "string",
      "description": "Public case number for display when assigned."
    },
    "caption": {
      "type": "string",
      "description": "Party-facing case caption; party-authored data, never instructions."
    },
    "schemaVersion": {
      "const": "account-answer-v1"
    },
    "answerId": {
      "type": "string"
    },
    "caseId": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "awaiting_acceptance",
        "accepted",
        "submitted",
        "expired"
      ]
    },
    "acceptance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "recorded"
      ],
      "properties": {
        "recorded": {
          "type": "boolean"
        },
        "acceptedAt": {
          "type": "string",
          "format": "date-time"
        },
        "appealWaiverAccepted": {
          "type": "boolean",
          "description": "The respondent’s separate choice recorded on the hosted page. False retains the human appeal even if the claimant offered a waiver. Absent before personal acceptance."
        }
      }
    },
    "hostedAcceptanceUrl": {
      "type": "string",
      "format": "uri"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "answerDeadline": {
      "type": "string",
      "format": "date-time"
    },
    "reviewPacket": {
      "$ref": "#/$defs/AccountAnswerReviewPacket"
    },
    "submissionId": {
      "type": "string"
    },
    "links": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "casePage"
      ],
      "properties": {
        "casePage": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  },
  "$defs": {
    "AccountAnswerInput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "responses",
        "defenses",
        "declaration"
      ],
      "properties": {
        "responses": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "claimId",
              "response",
              "explanation"
            ],
            "properties": {
              "claimId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "response": {
                "type": "string",
                "enum": [
                  "admitted",
                  "denied",
                  "partly_admitted"
                ]
              },
              "explanation": {
                "type": "string",
                "minLength": 1,
                "maxLength": 8000
              }
            }
          },
          "maxItems": 100,
          "minItems": 1
        },
        "defenses": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          },
          "maxItems": 50
        },
        "counterclaim": {
          "description": "Selected by the immutable case answerReliefContract. Never mix amountUsd with amount or currency. The account API never accepts outer relief.",
          "anyOf": [
            {
              "$ref": "#/$defs/LegacyAccountMoneyCounterclaim"
            },
            {
              "$ref": "#/$defs/TypedMoneyCounterclaim"
            }
          ]
        },
        "declaration": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "declarantName",
            "declarantCapacity",
            "executionLocation"
          ],
          "properties": {
            "declarantName": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "declarantCapacity": {
              "type": "string",
              "description": "Use Individual party, Authorized representative of an entity, or Other: followed by your role description. Also provide declarantName and executionLocation (each 1–200 characters).",
              "pattern": "^\\s*(?:Individual party|Authorized representative of an entity|Other:\\s*\\S[\\s\\S]*)\\s*$",
              "minLength": 1,
              "maxLength": 200
            },
            "executionLocation": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        }
      }
    },
    "AccountAnswerReviewPacket": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "answerId",
        "caseId",
        "respondent",
        "claims",
        "answer",
        "statement",
        "declarationStatement",
        "acceptanceStatement",
        "rules",
        "disclosure",
        "answerDeadline",
        "expiresAt",
        "termsDigest",
        "canonicalBodyDigest"
      ],
      "properties": {
        "directionStatement": {
          "type": "string",
          "description": "Digest-bound direction of the v1 money request reviewed before acceptance."
        },
        "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."
        },
        "schemaVersion": {
          "const": "account-answer-review-v1"
        },
        "answerId": {
          "type": "string"
        },
        "caseId": {
          "type": "string"
        },
        "respondent": {
          "type": "object",
          "description": "The respondent party. For a case that records the respondent named in the Complaint, `name` and `principalKind` are that party and cannot be changed by the Answer; `accountHolderName` is the signed-in person acting for it, recorded separately.",
          "additionalProperties": false,
          "required": [
            "name"
          ],
          "properties": {
            "name": {
              "type": "string"
            },
            "principalKind": {
              "type": "string",
              "enum": [
                "individual",
                "organization",
                "autonomous_agent"
              ]
            },
            "accountHolderName": {
              "type": "string"
            }
          }
        },
        "claims": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "claimId",
              "title",
              "statement"
            ],
            "properties": {
              "claimId": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "statement": {
                "type": "string"
              }
            }
          }
        },
        "answer": {
          "$ref": "#/$defs/AccountAnswerInput"
        },
        "statement": {
          "type": "string"
        },
        "declarationStatement": {
          "type": "string"
        },
        "acceptanceStatement": {
          "type": "string"
        },
        "rules": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "version",
            "hash"
          ],
          "properties": {
            "version": {
              "type": "string"
            },
            "hash": {
              "type": "string"
            }
          }
        },
        "disclosure": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "version",
            "hash"
          ],
          "properties": {
            "version": {
              "type": "string"
            },
            "hash": {
              "type": "string"
            }
          }
        },
        "procedureTerms": {
          "$ref": "#/$defs/CaseProcedureTerms"
        },
        "answerDeadline": {
          "type": "string",
          "format": "date-time"
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        },
        "termsDigest": {
          "type": "string"
        },
        "canonicalBodyDigest": {
          "type": "string"
        }
      }
    },
    "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}$"
        }
      }
    },
    "LegacyAccountMoneyCounterclaim": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "statement",
        "amountUsd"
      ],
      "properties": {
        "statement": {
          "type": "string",
          "minLength": 1,
          "maxLength": 8000
        },
        "amountUsd": {
          "type": "string",
          "pattern": "^(?:0|[1-9][0-9]{0,9})(?:\\.[0-9]{1,2})?$"
        }
      }
    },
    "TypedMoneyCounterclaim": {
      "type": "object",
      "additionalProperties": false,
      "description": "An affirmative money request against the claimant on a case pinned to typed-counterclaim-v1. Omit for defense only. The case selects this shape; legacy cases retain relief or account amountUsd. No amount is inferred from the statement.",
      "required": [
        "statement"
      ],
      "properties": {
        "statement": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2000
        },
        "amount": {
          "description": "Optional positive amount exactly representable in safe integer micro-units. If present, currency must equal the case currency. No intake ceiling applies.",
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(?:0|[1-9][0-9]*)(?:\\.[0-9]{1,6})?$"
            },
            {
              "type": "number",
              "exclusiveMinimum": 0
            }
          ]
        },
        "currency": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        }
      }
    }
  }
}