/**
 * GDPR data subject request types
 */
export type GdprRequestType = 'export' | 'delete' | 'rectify';

/**
 * GDPR request status
 */
export type GdprRequestStatus =
  | 'pending'
  | 'processing'
  | 'completed'
  | 'failed'
  | 'cancelled';

/**
 * GDPR data subject request
 */
export interface GdprRequest {
  id: string;
  type: GdprRequestType;
  subjectId: string;
  subjectEmail?: string;
  status: GdprRequestStatus;
  createdAt: Date;
  processedAt?: Date;
  completedAt?: Date;
  errorMessage?: string;
}

/**
 * GDPR export data structure
 */
export interface GdprExportData {
  subjectId: string;
  exportedAt: Date;
  data: {
    sessions: GdprSessionExport[];
    events: GdprEventExport[];
    attributionData?: GdprAttributionExport;
  };
}

/**
 * Session export for GDPR
 */
export interface GdprSessionExport {
  sessionId: string;
  startedAt: Date;
  endedAt?: Date;
  pageViews: number;
  country?: string;
  deviceType?: string;
}

/**
 * Event export for GDPR
 */
export interface GdprEventExport {
  timestamp: Date;
  type: string;
  page?: string;
  properties: Record<string, unknown>;
}

/**
 * Attribution export for GDPR
 */
export interface GdprAttributionExport {
  firstTouch?: {
    source?: string;
    medium?: string;
    campaign?: string;
    timestamp: Date;
  };
  lastTouch?: {
    source?: string;
    medium?: string;
    campaign?: string;
    timestamp: Date;
  };
}

/**
 * GDPR deletion audit log
 */
export interface GdprDeletionAudit {
  id: string;
  subjectId: string;
  deletedAt: Date;
  tablesAffected: string[];
  rowsDeleted: number;
  requestId: string;
}

/**
 * Data retention policy
 */
export interface DataRetentionPolicy {
  name: string;
  tableName: string;
  retentionDays: number;
  enabled: boolean;
  lastRunAt?: Date;
  rowsDeleted?: number;
}

/**
 * Consent record
 */
export interface ConsentRecord {
  subjectId: string;
  consentedAt: Date;
  withdrawnAt?: Date;
  purposes: ConsentPurpose[];
  source: string;
}

/**
 * Consent purpose
 */
export type ConsentPurpose =
  | 'analytics'
  | 'marketing'
  | 'personalization'
  | 'functional';

/**
 * DoNotTrack status
 */
export interface DoNotTrackStatus {
  enabled: boolean;
  source: 'browser' | 'gpc' | 'cookie' | 'explicit';
}
