"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProviderFactory = void 0;
const azure_provider_1 = require("./azure.provider");
const gcs_provider_1 = require("./gcs.provider");
const local_provider_1 = require("./local.provider");
const provider_enum_1 = require("./provider.enum");
const s3_provider_1 = require("./s3.provider");
const spaces_provider_1 = require("./spaces.provider");
class ProviderFactory {
    static async create(providerType, setting, jwtService) {
        let provider;
        switch (providerType) {
            case provider_enum_1.EnumProvider.S3:
                provider = new s3_provider_1.S3Provider(setting);
                break;
            case provider_enum_1.EnumProvider.LOCAL:
                provider = new local_provider_1.LocalProvider(setting, jwtService);
                break;
            case provider_enum_1.EnumProvider.AZURE:
                provider = new azure_provider_1.AzureProvider(setting);
                break;
            case provider_enum_1.EnumProvider.GCS:
                provider = new gcs_provider_1.GCSProvider(setting);
                break;
            case provider_enum_1.EnumProvider.SPACES:
                provider = new spaces_provider_1.SpacesProvider(setting);
                break;
            default:
                throw new Error(`Unsupported provider type: ${providerType}`);
        }
        await provider.initValidation();
        return provider;
    }
}
exports.ProviderFactory = ProviderFactory;
//# sourceMappingURL=provider.factory.js.map