// Sovereign Digital Identity Passport (SDIP) - Type Definitions

export enum EntityType {
  SCB = 'SCB',
  BANK = 'BANK',
  PERSON = 'PERSON',
  INSTITUTION = 'INSTITUTION',
  CONTRACT = 'CONTRACT',
}

export enum TrustLevel {
  TL0 = 'TL0', // Anonymous/Unverified
  TL1 = 'TL1', // Verified KYC/Bank
  TL2 = 'TL2', // Sovereign Verified
  TL3 = 'TL3', // SCB/High Authority
  TL4 = 'TL4', // DBIS Governance-Level Access
}

export enum PassportStatus {
  ACTIVE = 'ACTIVE',
  REVOKED = 'REVOKED',
  EXPIRED = 'EXPIRED',
  PENDING = 'PENDING',
}

export interface SDIPStructure {
  entityType: EntityType;
  sovereignIssuer: string; // SCB code
  rootCert: string; // HSM signature
  pqSignature: string; // Dilithium signature
  expiry: string; // YYYY-MM-DD
  revocationStatus: 'ACTIVE' | 'REVOKED';
  attributes: Record<string, unknown>;
}

export interface SDIPPassport {
  id: string;
  passportId: string;
  entityType: EntityType;
  entityId: string; // Reference to GBIG identity
  sovereignIssuer: string;
  rootCert: string;
  pqSignature: string;
  trustLevel: TrustLevel;
  expiry: Date;
  revocationStatus: PassportStatus;
  attributes: Record<string, unknown>;
  createdAt: Date;
  updatedAt: Date;
}

export interface SDIPIssuanceRequest {
  entityType: EntityType;
  entityId: string;
  sovereignIssuer: string;
  trustLevel: TrustLevel;
  attributes?: Record<string, unknown>;
  validityYears?: number;
}

export interface SDIPVerificationResult {
  valid: boolean;
  passport: SDIPPassport | null;
  trustLevel: TrustLevel;
  errors: string[];
  warnings: string[];
}

export interface SDIPRevocationRequest {
  passportId: string;
  reason: string;
  revokedBy: string;
}

