{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/giljo-ai/json-schema/giljo-ai-account-deletion-status-schema.json",
  "title": "AccountDeletionStatus",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/giljo-ai-account-deletion-api-openapi.yml#/components/schemas/AccountDeletionStatus",
  "properties": {
    "state": {
      "$ref": "#/$defs/DeletionState"
    },
    "request_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Request Id"
    },
    "grace_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Grace Expires At"
    },
    "attempt_count": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Attempt Count",
      "default": 0
    },
    "failure_code": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64,
          "pattern": "^[a-z0-9_.:-]+$"
        },
        {
          "type": "null"
        }
      ],
      "title": "Failure Code"
    },
    "receipt": {
      "anyOf": [
        {
          "$ref": "#/$defs/DeletionReceipt"
        },
        {
          "type": "null"
        }
      ]
    },
    "completion_email": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "accepted",
            "unknown",
            "unavailable"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Completion Email"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "state"
  ],
  "$defs": {
    "ClassifiedErasureCount": {
      "properties": {
        "artifact": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "pattern": "^[a-z0-9_.:-]+$",
          "title": "Artifact"
        },
        "disposition": {
          "$ref": "#/$defs/DataDisposition"
        },
        "count": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Count"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "artifact",
        "disposition",
        "count"
      ],
      "title": "ClassifiedErasureCount"
    },
    "CleanupStatus": {
      "type": "string",
      "enum": [
        "pending",
        "complete",
        "retryable_failure",
        "terminal_failure",
        "retained_with_legal_basis",
        "not_applicable"
      ],
      "title": "CleanupStatus"
    },
    "DataDisposition": {
      "type": "string",
      "enum": [
        "erase",
        "retain_with_legal_basis",
        "external_cleanup",
        "non_personal"
      ],
      "title": "DataDisposition"
    },
    "DeletionReceipt": {
      "properties": {
        "payload": {
          "$ref": "#/$defs/DeletionReceiptPayload"
        },
        "key_id": {
          "type": "string",
          "maxLength": 64,
          "minLength": 1,
          "pattern": "^[A-Za-z0-9_.:-]+$",
          "title": "Key Id"
        },
        "signature": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "title": "Signature"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "payload",
        "key_id",
        "signature"
      ],
      "title": "DeletionReceipt"
    },
    "DeletionReceiptPayload": {
      "properties": {
        "receipt_id": {
          "type": "string",
          "format": "uuid",
          "title": "Receipt Id"
        },
        "receipt_version": {
          "type": "string",
          "maxLength": 8,
          "pattern": "^v[1-9][0-9]{0,2}$",
          "title": "Receipt Version",
          "default": "v1"
        },
        "subject_digest": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "title": "Subject Digest"
        },
        "completed_at": {
          "type": "string",
          "format": "date-time",
          "title": "Completed At"
        },
        "policy_version": {
          "type": "string",
          "maxLength": 32,
          "minLength": 1,
          "pattern": "^[a-z0-9_.:-]+$",
          "title": "Policy Version"
        },
        "counts": {
          "items": {
            "$ref": "#/$defs/ClassifiedErasureCount"
          },
          "type": "array",
          "maxItems": 128,
          "title": "Counts"
        },
        "external_cleanup": {
          "items": {
            "$ref": "#/$defs/ExternalCleanupResult"
          },
          "type": "array",
          "maxItems": 32,
          "title": "External Cleanup"
        },
        "legal_evidence": {
          "anyOf": [
            {
              "$ref": "#/$defs/LegalAcceptanceEvidence"
            },
            {
              "type": "null"
            }
          ]
        },
        "retention_expires_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Retention Expires At"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "receipt_id",
        "subject_digest",
        "completed_at",
        "policy_version",
        "counts",
        "external_cleanup"
      ],
      "title": "DeletionReceiptPayload"
    },
    "DeletionState": {
      "type": "string",
      "enum": [
        "none",
        "pending_confirmation",
        "confirmed/grace",
        "queued",
        "purging",
        "retryable_failure",
        "terminal_failure",
        "cancelled",
        "complete"
      ],
      "title": "DeletionState"
    },
    "ExternalCleanupResult": {
      "properties": {
        "system": {
          "type": "string",
          "maxLength": 64,
          "minLength": 1,
          "pattern": "^[a-z0-9_.:-]+$",
          "title": "System"
        },
        "status": {
          "$ref": "#/$defs/CleanupStatus"
        },
        "policy_code": {
          "type": "string",
          "maxLength": 64,
          "minLength": 1,
          "pattern": "^[a-z0-9_.:-]+$",
          "title": "Policy Code"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "system",
        "status",
        "policy_code"
      ],
      "title": "ExternalCleanupResult"
    },
    "LegalAcceptanceEvidence": {
      "properties": {
        "terms_version": {
          "type": "string",
          "maxLength": 32,
          "minLength": 1,
          "title": "Terms Version"
        },
        "privacy_version": {
          "type": "string",
          "maxLength": 32,
          "minLength": 1,
          "title": "Privacy Version"
        },
        "accepted_at": {
          "type": "string",
          "format": "date-time",
          "title": "Accepted At"
        },
        "method": {
          "type": "string",
          "maxLength": 32,
          "minLength": 1,
          "pattern": "^[a-z0-9_]+$",
          "title": "Method"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "terms_version",
        "privacy_version",
        "accepted_at",
        "method"
      ],
      "title": "LegalAcceptanceEvidence"
    }
  }
}