import { AzurePATConnectionModel, SonarConnectionModel, ConnectionModel, } from './mongoose-models/ConnectionModel.js';
export function getConnections(type) {
    if (!type)
        return ConnectionModel.find().lean();
    if (type === 'azure-pat') {
        return AzurePATConnectionModel.find().lean();
    }
    if (type === 'sonar') {
        return SonarConnectionModel.find().lean();
    }
}
export const getConnectionById = (id) => ConnectionModel.findOne({ _id: id }).lean();
export const createAzurePATConnection = (connection) => AzurePATConnectionModel.create(connection);
export const createSonarConnection = (connection) => SonarConnectionModel.create(connection);
export const modifyConnection = (connection) => ConnectionModel.replaceOne({ _id: connection._id }, connection).lean();
export const deleteConnection = (id) => ConnectionModel.deleteOne({ _id: id }).lean();
