{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pyai-com/json-schema/pyai-com-number-compliance-case-schema.json",
  "title": "NumberComplianceCase",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pyai-com-openapi.json#/components/schemas/NumberComplianceCase",
  "type": "object",
  "required": [
    "id",
    "object",
    "project_id",
    "kind",
    "country",
    "state",
    "rules_snapshot",
    "document_requests",
    "uploads",
    "extractions",
    "timeline",
    "version"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "type": "string",
      "const": "telephony.compliance_case"
    },
    "project_id": {
      "type": "string"
    },
    "provisioning_ready": {
      "type": "boolean",
      "description": "A saved operator-reviewed live number approval is bound to this exact application and project. Network validity is checked again before ordering."
    },
    "provisioning_approved_at": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Unix milliseconds of the saved operator approval, or null when ordering is not eligible."
    },
    "kind": {
      "type": "string",
      "enum": [
        "new_number",
        "port_in"
      ]
    },
    "country": {
      "type": "string",
      "enum": [
        "US",
        "CA",
        "IN",
        "GB",
        "AU"
      ]
    },
    "number_type": {
      "type": "string"
    },
    "capabilities": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "use_case": {
      "type": "string"
    },
    "network_status": {
      "type": "string"
    },
    "state": {
      "type": "string",
      "enum": [
        "collecting_evidence",
        "extracting",
        "needs_review",
        "ready_for_submission",
        "submitted",
        "cancelled"
      ]
    },
    "continuation_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "terminal_reason": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "network_review_submitted",
        "cancelled_by_customer",
        null
      ]
    },
    "rules_snapshot": {
      "type": "object",
      "description": "Immutable rules, source identifiers, thresholds, retry caps, parallelism, wall-clock, cost, and retention configuration frozen when the case started.",
      "properties": {
        "available": {
          "type": "boolean"
        },
        "registry_version": {
          "type": "string"
        },
        "source_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "frozen_at": {
          "type": "integer"
        },
        "config": {
          "type": "object",
          "additionalProperties": true
        }
      }
    },
    "document_requests": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "document_type": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "accepted_mime_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "max_bytes": {
            "type": "integer"
          }
        }
      }
    },
    "attestation_requests": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          }
        }
      }
    },
    "uploads": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "document_request_id": {
            "type": "string"
          },
          "object_ref": {
            "type": "string",
            "description": "Opaque object reference."
          },
          "generation": {
            "type": [
              "string",
              "null"
            ]
          },
          "file_name": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer"
          },
          "sha256": {
            "type": "string"
          },
          "malware_status": {
            "type": "string",
            "enum": [
              "pending",
              "clean",
              "infected",
              "scan_failed"
            ]
          },
          "uploaded_at": {
            "type": "integer"
          },
          "retention_delete_at": {
            "type": "integer"
          }
        }
      }
    },
    "extractions": {
      "type": "array",
      "description": "Terminal processing attempts. Extracted personal values are masked in API views.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "upload_id": {
            "type": "string"
          },
          "processing_profile": {
            "type": "string",
            "const": "standard"
          },
          "status": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "failure_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "attempts": {
            "type": "integer"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string"
                },
                "value": {
                  "type": "string",
                  "description": "Extracted value; personal values are masked."
                },
                "confidence": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                },
                "provenance": {
                  "type": "object"
                },
                "pii_class": {
                  "type": "string"
                },
                "redacted": {
                  "type": "boolean"
                }
              }
            }
          },
          "cost_micros": {
            "type": "integer"
          },
          "model_version": {
            "type": [
              "string",
              "null"
            ]
          },
          "latency_ms": {
            "type": "integer",
            "minimum": 0
          },
          "started_at": {
            "type": "integer"
          },
          "completed_at": {
            "type": "integer"
          }
        }
      }
    },
    "corrections": {
      "type": "array",
      "description": "Correction audit metadata. Corrected PII values are intentionally omitted from API views.",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "matches": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "attestations": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "timeline": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "created_at": {
      "type": "integer"
    },
    "updated_at": {
      "type": "integer"
    },
    "retention_delete_at": {
      "type": "integer"
    },
    "version": {
      "type": "integer",
      "minimum": 1
    }
  }
}