/**
 * 凭证管理器工厂
 */

import { CredentialManagerOptions } from './types';
import { ICredentialManager, CredentialManager } from './CredentialManager';
import { PacificaSigner } from '@/platforms/pacifica/PacificaSigner';
import { PacificaDetector } from '@/platforms/pacifica/PacificaDetector';
import { AsterDetector } from '@/platforms/aster/AsterDetector';
import { BinanceDetector } from '@/platforms/binance/BinanceDetector';

export interface ICredentialManagerFactory {
  create(options?: CredentialManagerOptions): Promise<ICredentialManager>;
}

export class CredentialManagerFactory implements ICredentialManagerFactory {
  public async create(options?: CredentialManagerOptions): Promise<ICredentialManager> {
    const manager = new CredentialManager(options);

    // 注册平台检测器
    manager.registerPlatformDetectors();

    // 注册签名策略
    manager.registerSignerStrategies();

    return manager;
  }
}