import { useMemo } from 'react';
/**
 * 注册方式相关的逻辑hook
 */
export function useRegistrationMethods(isRegistrationMethodEnabled) {
  // 获取所有启用的注册方式
  var enabledMethods = useMemo(function () {
    var methods = [];
    if (isRegistrationMethodEnabled('email')) methods.push('email');
    if (isRegistrationMethodEnabled('phone')) methods.push('phone');
    if (isRegistrationMethodEnabled('google')) methods.push('google');
    if (isRegistrationMethodEnabled('facebook')) methods.push('facebook');
    if (isRegistrationMethodEnabled('apple')) methods.push('apple');
    return methods;
  }, [isRegistrationMethodEnabled]);

  // 是否应该显示分隔线（超过一种注册方式时显示）
  var shouldShowDivider = useMemo(function () {
    return enabledMethods.length > 1;
  }, [enabledMethods.length]);

  // 是否同时启用了邮箱和手机注册
  var hasEmailAndPhone = useMemo(function () {
    return isRegistrationMethodEnabled('email') && isRegistrationMethodEnabled('phone');
  }, [isRegistrationMethodEnabled]);
  return {
    enabledMethods: enabledMethods,
    shouldShowDivider: shouldShowDivider,
    hasEmailAndPhone: hasEmailAndPhone
  };
}