/**
 * Type definitions for user identity and OAuth provider management
 */

export interface UserIdentity {
  id: string;
  user_id: string;
  identity_data: {
    email?: string;
    full_name?: string;
    avatar_url?: string;
    [key: string]: unknown;
  };
  provider: 'google' | 'discord' | 'email' | 'github' | string;
  created_at: string;
  updated_at: string;
  last_sign_in_at: string;
}

export type OAuthProvider = 'google' | 'discord';

export interface IdentitySafetyCheck {
  canDisconnect: boolean;
  reason?: 'last_identity' | 'no_password_backup' | 'safe';
  hasPasswordAuth: boolean;
  totalIdentities: number;
  oauthIdentities: number;
}

export interface IdentityOperationResult {
  success: boolean;
  error?: string;
  needsRelogin?: boolean;
  needsEmailConfirmation?: boolean;
  email?: string;
  requiresAAL2?: boolean;
}
