const testcontainerFileForDB = {
    mariadb: 'MariadbTestContainer.java',
    mssql: 'MsSqlTestContainer.java',
    mysql: 'MysqlTestContainer.java',
    postgresql: 'PostgreSqlTestContainer.java',
};
export const javaSqlDatabaseArtifacts = {
    mariadb: {
        jdbc: { groupId: 'org.mariadb.jdbc', artifactId: 'mariadb-java-client' },
        r2dbc: { groupId: 'io.asyncer', artifactId: 'r2dbc-mysql' },
        testContainer: { groupId: 'org.testcontainers', artifactId: 'mariadb', scope: 'test' },
    },
    mssql: {
        jdbc: { groupId: 'com.microsoft.sqlserver', artifactId: 'mssql-jdbc' },
        r2dbc: { groupId: 'io.r2dbc', artifactId: 'r2dbc-mssql' },
        testContainer: { groupId: 'org.testcontainers', artifactId: 'mssqlserver', scope: 'test' },
    },
    mysql: {
        jdbc: { groupId: 'com.mysql', artifactId: 'mysql-connector-j' },
        r2dbc: { groupId: 'io.asyncer', artifactId: 'r2dbc-mysql' },
        testContainer: { groupId: 'org.testcontainers', artifactId: 'mysql', scope: 'test' },
    },
    postgresql: {
        jdbc: { groupId: 'org.postgresql', artifactId: 'postgresql' },
        r2dbc: { groupId: 'org.postgresql', artifactId: 'r2dbc-postgresql' },
        testContainer: { groupId: 'org.testcontainers', artifactId: 'postgresql', scope: 'test' },
    },
    oracle: {
        jdbc: { groupId: 'com.oracle.database.jdbc', artifactId: 'ojdbc8' },
        testContainer: { groupId: 'org.testcontainers', artifactId: 'oracle-xe', scope: 'test' },
    },
    h2: {
        jdbc: { groupId: 'com.h2database', artifactId: 'h2' },
        r2dbc: { groupId: 'io.r2dbc', artifactId: 'r2dbc-h2' },
    },
};
export const getDatabaseDriverForDatabase = (databaseType) => javaSqlDatabaseArtifacts[databaseType];
export const getH2MavenDefinition = ({ prodDatabaseType, packageFolder, }) => {
    const testcontainerFile = testcontainerFileForDB[prodDatabaseType];
    const excludeContainerPlugin = testcontainerFile
        ? [
            {
                inProfile: 'dev',
                groupId: 'org.apache.maven.plugins',
                artifactId: 'maven-compiler-plugin',
                additionalContent: `
<configuration>
  <testExcludes>
    <testExclude>${packageFolder}config/${testcontainerFile}</testExclude>
  </testExcludes>
</configuration>
`,
            },
        ]
        : [];
    return {
        jdbc: {
            dependencies: [{ inProfile: 'dev', ...javaSqlDatabaseArtifacts.h2.jdbc }],
            plugins: excludeContainerPlugin,
        },
        r2dbc: {
            dependencies: [{ inProfile: 'dev', ...javaSqlDatabaseArtifacts.h2.r2dbc }],
        },
    };
};
export const getDatabaseTypeMavenDefinition = (databaseType, { inProfile }) => {
    const dependenciesForType = {
        mariadb: {
            jdbc: {
                dependencies: [
                    { inProfile, ...javaSqlDatabaseArtifacts.mariadb.jdbc },
                    { inProfile, ...javaSqlDatabaseArtifacts.mariadb.testContainer },
                ],
            },
            r2dbc: {
                dependencies: [{ inProfile, ...javaSqlDatabaseArtifacts.mariadb.r2dbc }],
            },
        },
        mssql: {
            jdbc: {
                dependencies: [
                    { inProfile, ...javaSqlDatabaseArtifacts.mssql.jdbc },
                    { inProfile, ...javaSqlDatabaseArtifacts.mssql.testContainer },
                ],
            },
            r2dbc: {
                dependencies: [{ inProfile, ...javaSqlDatabaseArtifacts.mssql.r2dbc }],
            },
        },
        mysql: {
            jdbc: {
                dependencies: [
                    { inProfile, ...javaSqlDatabaseArtifacts.mysql.jdbc },
                    { inProfile, ...javaSqlDatabaseArtifacts.mysql.testContainer },
                ],
            },
            r2dbc: {
                dependencies: [{ inProfile, ...javaSqlDatabaseArtifacts.mysql.r2dbc }],
            },
        },
        oracle: {
            jdbc: {
                dependencies: [
                    { inProfile, ...javaSqlDatabaseArtifacts.oracle.jdbc },
                    { inProfile, ...javaSqlDatabaseArtifacts.oracle.testContainer },
                ],
            },
            r2dbc: {},
        },
        postgresql: {
            jdbc: {
                dependencies: [
                    { inProfile, ...javaSqlDatabaseArtifacts.postgresql.jdbc },
                    { inProfile, ...javaSqlDatabaseArtifacts.postgresql.testContainer },
                ],
            },
            r2dbc: {
                dependencies: [{ inProfile, ...javaSqlDatabaseArtifacts.postgresql.r2dbc }],
            },
        },
    };
    return dependenciesForType[databaseType];
};
