import configService from '../services/config.service.js';
import { getProvider } from '../services/providers.js';
export const createConfigSeeds = async (env) => {
    const googleProvider = getProvider('google');
    if (!googleProvider) {
        throw new Error('createConfigSeeds: google provider not found');
    }
    const notionProvider = getProvider('notion');
    if (!notionProvider) {
        throw new Error('createConfigSeeds: notion provider not found');
    }
    await configService.createProviderConfig({
        unique_key: Math.random().toString(36).substring(7),
        provider: 'google',
        environment_id: env.id
    }, googleProvider);
    await configService.createProviderConfig({
        unique_key: Math.random().toString(36).substring(7),
        provider: 'google',
        environment_id: env.id
    }, googleProvider);
    await configService.createProviderConfig({
        unique_key: Math.random().toString(36).substring(7),
        provider: 'google',
        environment_id: env.id
    }, googleProvider);
    await configService.createProviderConfig({
        unique_key: Math.random().toString(36).substring(7),
        provider: 'notion',
        environment_id: env.id
    }, notionProvider);
};
export async function createConfigSeed(env, unique_key, providerName, rest) {
    const provider = getProvider(providerName);
    if (!provider) {
        throw new Error(`createConfigSeed: ${providerName} provider not found`);
    }
    const created = await configService.createProviderConfig({
        unique_key,
        provider: providerName,
        environment_id: env.id,
        ...rest
    }, provider);
    if (!created) {
        throw new Error('failed to created to provider config');
    }
    return created;
}
//# sourceMappingURL=config.seeder.js.map