import { JwtService } from '@nestjs/jwt';
import { AbstractProvider } from './abstract.provider';
import { AzureProvider } from './azure.provider';
import { GCSProvider } from './gcs.provider';
import { LocalProvider } from './local.provider';
import { EnumProvider } from './provider.enum';
import { S3Provider } from './s3.provider';

export class ProviderFactory {
  static create(
    providerType: EnumProvider,
    setting: Record<string, string>,
    jwtService: JwtService,
  ): AbstractProvider {
    switch (providerType) {
      case EnumProvider.S3:
        return new S3Provider(setting);
      case EnumProvider.LOCAL:
        return new LocalProvider(setting, jwtService);
      case EnumProvider.AZURE:
        return new AzureProvider(setting);
      case EnumProvider.GCS:
        return new GCSProvider(setting);
    }
  }
}
