/**
 * 配置策略工厂
 */
import { NotificationChannelType } from '../../types';
import type { ConfigStrategy } from './types';
import { WeworkConfigStrategy } from './WeworkConfigStrategy';
import { EmailConfigStrategy } from './EmailConfigStrategy';

export class ConfigStrategyFactory {
  private static strategies = new Map<NotificationChannelType, ConfigStrategy>([
    [NotificationChannelType.WEWORK, new WeworkConfigStrategy()],
    [NotificationChannelType.EMAIL, new EmailConfigStrategy()],
  ]);

  static getStrategy(type: NotificationChannelType): ConfigStrategy {
    const strategy = this.strategies.get(type);
    if (!strategy) {
      throw new Error(`Unsupported channel type: ${type}`);
    }
    return strategy;
  }

  static getAllStrategies(): ConfigStrategy[] {
    return Array.from(this.strategies.values());
  }

  static getSupportedTypes(): NotificationChannelType[] {
    return Array.from(this.strategies.keys());
  }
}
