{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/infinihash-com/json-schema/infinihash-com-rekyc-prefill-schema.json",
  "title": "RekycPrefill",
  "description": "The prior submission, pre-filled for the next review cycle.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/infinihash-com-periodic-review-api-openapi.yml#/components/schemas/RekycPrefill",
  "type": "object",
  "required": [
    "parentSubmissionId",
    "prefill",
    "documents",
    "documentsRequiringRefresh",
    "instructions"
  ],
  "properties": {
    "parentSubmissionId": {
      "type": "string"
    },
    "prefill": {
      "type": "object",
      "properties": {
        "entityType": {
          "type": "string"
        },
        "entityName": {
          "type": "string"
        },
        "riskTier": {
          "type": "string"
        },
        "metadata": {
          "type": "object",
          "additionalProperties": true,
          "description": "Parsed prior submission metadata (free-form)."
        }
      }
    },
    "priorSummary": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "description": "Parsed prior final summary (free-form); null if absent or unparseable."
    },
    "priorStatus": {
      "type": "string"
    },
    "priorRiskScore": {
      "type": [
        "integer",
        "null"
      ]
    },
    "priorCompletedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "documents": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RekycDocument"
      }
    },
    "documentsRequiringRefresh": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "docType": {
            "type": "string"
          },
          "ageDays": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      }
    },
    "reviewSchedule": {
      "allOf": [
        {
          "$ref": "#/$defs/RekycReviewSchedule"
        }
      ]
    },
    "instructions": {
      "type": "string"
    }
  },
  "$defs": {
    "RekycDocument": {
      "type": "object",
      "required": [
        "id",
        "docType",
        "provider",
        "createdAt",
        "ageDays",
        "requiresRefresh"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "docType": {
          "type": "string"
        },
        "provider": {
          "type": [
            "string",
            "null"
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "ageDays": {
          "type": [
            "integer",
            "null"
          ]
        },
        "requiresRefresh": {
          "type": "boolean",
          "description": "true when the document is older than 12 months."
        }
      }
    },
    "RekycReviewSchedule": {
      "type": "object",
      "required": [
        "id",
        "submissionId",
        "apiKeyId",
        "riskTier",
        "reviewFrequencyDays",
        "nextReviewDate",
        "status",
        "createdAt"
      ],
      "description": "Periodic-review schedule for a submission (one row per submission).",
      "properties": {
        "id": {
          "type": "string"
        },
        "submissionId": {
          "type": "string"
        },
        "apiKeyId": {
          "type": "string"
        },
        "riskTier": {
          "type": "string",
          "description": "Submission risk tier at scheduling time (default low)."
        },
        "reviewFrequencyDays": {
          "type": "integer",
          "description": "Review interval derived from the tier: low 365, medium 180, high 90, critical 30 (unknown tiers 365)."
        },
        "nextReviewDate": {
          "type": "string",
          "format": "date-time"
        },
        "lastReviewDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "status": {
          "type": "string",
          "description": "scheduled | completed | superseded."
        },
        "notes": {
          "type": [
            "string",
            "null"
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}