using IWS5.DatabaseAccess.Interfaces.Importer;
using IWS5.DatabaseAccess.IwsDataContext;
using Microsoft.EntityFrameworkCore;

namespace IWS5.DatabaseAccess.Repositories.Importer;

public class DocumentCabinetRepository(IDbContextFactory<GreenfieldPd2015Context> contextFactory)
    : IDocumentCabinetRepository
{
    public async Task<Dictionary<string, int>> GetCabinetDataAsync()
    {
        await using var context = await contextFactory.CreateDbContextAsync();

        return await context.AtdocumentCabinets
            .ToDictionaryAsync(
                c => c.CabinetName,
                c => c.CabinetId
            );
    }
}
