/**
 * 企业微信配置策略
 */
import { NotificationChannelType, isWeworkConfig } from '../../types';
import type { ConfigStrategy, ConfigState } from './types';

export class WeworkConfigStrategy implements ConfigStrategy {
  type = NotificationChannelType.WEWORK;

  getDefaultConfig() {
    return {
      channelType: NotificationChannelType.WEWORK,
      key: '',
    };
  }

  validateConfig(config: any): boolean {
    return config && 
           config.channelType === NotificationChannelType.WEWORK && 
           typeof config.key === 'string' && 
           config.key.length > 0;
  }

  loadFromData(data: any): ConfigState {
    // 企业微信配置不再需要额外的状态管理
    return {};
  }

  buildConfig(state: ConfigState, formConfig: any): any {
    return {
      ...formConfig,
      channelType: NotificationChannelType.WEWORK,
    };
  }
}
