/**
 * 配置表单工厂
 */
import React from 'react';
import { NotificationChannelType } from '../../types';
import type { ConfigComponentProps } from '../config-strategies/types';
import { WeworkConfigForm } from './WeworkConfigForm';
import { EmailConfigForm } from './EmailConfigForm';

export class ConfigFormFactory {
  static createConfigForm(
    type: NotificationChannelType,
    props: ConfigComponentProps
  ): React.ReactElement | null {
    switch (type) {
      case NotificationChannelType.WEWORK:
        return <WeworkConfigForm {...props} />;
      
      case NotificationChannelType.EMAIL:
        return <EmailConfigForm {...props} />;
      
      default:
        return null;
    }
  }

  static getSupportedTypes(): NotificationChannelType[] {
    return [
      NotificationChannelType.WEWORK,
      NotificationChannelType.EMAIL,
    ];
  }
}
