/**
 * 密码配置接口
 */
export interface PasswordConfig {
  minLength: number;
  minTypeCount: number;
  historyCount: number;
  validityDays: number;
  maxRetryCount: number;
  lockDuration: number;
  strengthLevels?: {
    weak: { threshold: number; label: string; color: string };
    medium: { threshold: number; label: string; color: string };
    strong: { threshold: number; label: string; color: string };
  };
  strengthWeights?: {
    length: number;
    uppercase: number;
    lowercase: number;
    number: number;
    specialChar: number;
    noUsername: number;
  };
}

/**
 * 密码验证结果接口
 */
export interface PasswordValidateResult {
  valid: boolean;
  errorMessage?: string;
  lengthValid: boolean;
  uppercaseValid: boolean;
  lowercaseValid: boolean;
  numberValid: boolean;
  specialCharValid: boolean;
  containsUsername: boolean;
  minTypesMet: boolean;
  historyValid?: boolean;
  strengthScore: number;
  strengthLevel: string;
  strengthColor?: string;
  rules?: PasswordRule[];
  config?: Record<string, any>;
}

/**
 * 密码规则接口
 */
export interface PasswordRule {
  key: string;
  label: string;
  valid: boolean;
  icon: string;
  message?: string;
}

/**
 * 密码验证请求接口
 */
export interface PasswordValidateRequest {
  userId?: string;
  password: string;
  userName?: string;
  checkHistory?: boolean;
  isNewUser?: boolean;
}

/**
 * 安全验证请求接口
 */
export interface SecurityVerifyRequest {
  authCodeType: number; // 1-短信 2-邮件 3-密码
  authCode?: string; // 验证码
  password?: string; // 密码
  safeType?: string; // 安全验证类型
  timeout?: number; // 超时时间
}

/**
 * 密码修改请求接口
 */
export interface PasswordChangeRequest {
  userId?: string;
  oldPassword?: string; // 旧密码
  password?: string; // 当前密码（用于验证）
  newPassword: string; // 新密码
  confirmPassword: string; // 确认密码
  isForceChange?: boolean; // 是否为强制修改密码（管理员重置后）
  userName?: string; //用户名
}

/**
 * 安全状态接口
 */
export interface SecurityStatus {
  userId: string;
  userName: string;
  nickName?: string;

  // 密码状态
  passwordExpired: boolean;
  passwordSoonExpire?: boolean;
  lastPwdUpdateTime?: string;
  pwdExpireTime?: string;

  // 账户状态
  accountLocked: boolean;
  needChangePassword: boolean;
  realNameAuthenticated: boolean;
  retryCount?: number;

  // 安全设置
  bindIp?: string;
  accessStartTime?: string;
  accessEndTime?: string;
  faceAuthRequired: boolean;
  roleType?: string;
  branchType?: string;

  // 认证设置
  smsAuthEnabled?: boolean;
  emailAuthEnabled?: boolean;
  phonenumber?: string;
  email?: string;
}

/**
 * 安全日志接口
 */
export interface SecurityLog {
  operation: string;
  operationDesc: string;
  operationTime: string;
  clientIp: string;
  result: string;
  remark?: string;
}
