using e_suite.Service.EFlowSync.Repository;
using e_suite.UnitTestCore;

namespace e_suite.Service.EFlowSync.UnitTests.FakeRepositories;

public class FakeEFlowSyncRepository : FakeRepository, IEFlowSyncRepository
{
    public Dictionary<(string, string), string> ExternalIds = new();

    public Task<string?> GetEFlowExternalId(string entityName, string primaryKeyJson)
    {
        if (ExternalIds.ContainsKey((entityName, primaryKeyJson)))
            return Task.FromResult(ExternalIds[(entityName, primaryKeyJson)])!;

        return Task.FromResult<string?>(null);
    }

    public Task AddEflowExternalId(string entityName, string primaryKeyJson, string childId, CancellationToken cancellationToken)
    {
        ExternalIds[(entityName, primaryKeyJson)] = childId;
        return Task.CompletedTask;
    }
}