{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peoplescourt-ai/json-schema/peoplescourt-ai-account-answer-input-schema.json",
  "title": "AccountAnswerInput",
  "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/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
        }
      }
    }
  },
  "$defs": {
    "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
        }
      }
    }
  }
}