import React from 'react';
import { MailOutlined, PhoneOutlined, FacebookOutlined, AppleOutlined, UserOutlined, LockOutlined } from '@ant-design/icons';
import { locales } from '@pisell/utils';
import { AuthMethodType, AuthMethodCategory } from "./types";

/**
 * 获取默认的认证方法列表（支持多语言）
 * 每次调用都会根据当前语言设置返回对应的文本
 * @returns 认证方法数组
 */
export var getDefaultAuthMethods = function getDefaultAuthMethods() {
  return [{
    id: 'email',
    type: AuthMethodType.EMAIL,
    title: locales.getText('auth.method.email.title') || 'Email',
    category: AuthMethodCategory.GENERAL,
    description: locales.getText('auth.method.email.description') || 'Register and log in via email',
    icon: /*#__PURE__*/React.createElement(MailOutlined, {
      style: {
        fontSize: 20,
        color: '#4096ff'
      }
    }),
    enabled: false,
    hasSettings: true
  }, {
    id: 'phone',
    type: AuthMethodType.PHONE,
    title: locales.getText('auth.method.phone.title') || 'Phone Number',
    category: AuthMethodCategory.GENERAL,
    description: locales.getText('auth.method.phone.description') || 'Register and log in via phone number',
    icon: /*#__PURE__*/React.createElement(PhoneOutlined, {
      style: {
        fontSize: 20,
        color: '#4096ff'
      }
    }),
    enabled: false,
    hasSettings: true
  }, {
    id: 'facebook',
    type: AuthMethodType.FACEBOOK,
    title: locales.getText('auth.method.facebook.title') || 'Facebook',
    category: AuthMethodCategory.OAUTH,
    description: locales.getText('auth.method.facebook.description') || 'Log in with Facebook account',
    icon: /*#__PURE__*/React.createElement(FacebookOutlined, {
      style: {
        fontSize: 20,
        color: '#1877f2'
      }
    }),
    enabled: false,
    hasSettings: false,
    requiresOAuthConfig: true,
    configLink: 'auth.oauth.config.message'
  }, {
    id: 'apple',
    type: AuthMethodType.APPLE,
    title: locales.getText('auth.method.apple.title') || 'Apple',
    category: AuthMethodCategory.OAUTH,
    description: locales.getText('auth.method.apple.description') || 'Log in with Apple ID',
    icon: /*#__PURE__*/React.createElement(AppleOutlined, {
      style: {
        fontSize: 20,
        color: '#000000'
      }
    }),
    enabled: false,
    hasSettings: false,
    requiresOAuthConfig: true,
    configLink: 'auth.oauth.config.message'
  }, {
    id: 'guest',
    type: AuthMethodType.GUEST,
    title: locales.getText('auth.method.guest.title') || 'Guest',
    category: AuthMethodCategory.AUTH_FREE,
    description: locales.getText('auth.method.guest.description') || 'Allow guests to access without registration process',
    icon: /*#__PURE__*/React.createElement(UserOutlined, {
      style: {
        fontSize: 20,
        color: '#8c8c8c'
      }
    }),
    enabled: false,
    hasSettings: false
  }];
};

/**
 * 默认认证方法列表（已废弃，仅保留用于向后兼容）
 * @deprecated 请使用 getDefaultAuthMethods() 函数以获取实时的多语言支持
 * 
 * 注意：此常量在模块加载时初始化，使用模块首次加载时的语言设置
 * 如果需要响应语言切换，请直接调用 getDefaultAuthMethods() 函数
 */
export var DEFAULT_AUTH_METHODS = getDefaultAuthMethods();

/**
 * 获取密码规则设置项（支持多语言）
 * 每次调用都会根据当前语言设置返回对应的文本
 * @param id - 密码规则的唯一标识符，用于区分不同场景下的密码规则
 * @returns 密码规则设置数组
 */
export var getPasswordRulesSetting = function getPasswordRulesSetting() {
  var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'password_rules';
  return [{
    id: id,
    type: AuthMethodType.PASSWORD_RULES,
    title: locales.getText('auth.password.rules.title') || 'Password Rules',
    category: AuthMethodCategory.GENERAL,
    description: locales.getText('auth.password.rules.description') || 'Define password complexity requirements for accounts',
    icon: /*#__PURE__*/React.createElement(LockOutlined, {
      style: {
        fontSize: 20,
        color: '#4096ff'
      }
    }),
    enabled: true,
    hasSettings: true
  }];
};