using e_suite.Database.Audit;
using e_suite.Database.Audit.Models;
using e_suite.Database.Core;
using e_suite.Database.Core.Helpers;
using e_suite.Database.Core.Tables.CustomFields;
using e_suite.Database.Core.Tables.Glossaries;
using eSuite.Core.Miscellaneous;

namespace e_suite.API.Common.repository;

public interface IGlossariesManagerRepository : IRepository
{
    Task AddGlossaryItem(AuditUserDetails auditUserDetails, Glossary glossary, CancellationToken cancellationToken);
    Task AddGlossaryItems(AuditUserDetails auditUserDetails, IEnumerable<Glossary> items, CancellationToken cancellationToken);
    Task EditGlossaryItem(AuditUserDetails auditUserDetails, Glossary glossaryItem, CancellationToken cancellationToken);
    Task<Glossary?> FindGlossary(IGeneralIdRef glossaryItem, CancellationToken cancellationToken);
    Task<IEnumerable<Glossary>> FindGlossaryChildren(long parentId, CancellationToken cancellationToken);
    Task<List<CustomField>> GetCustomFieldDefinitions(IEnumerable<IGeneralIdRef> customFieldIdRefs, CancellationToken cancellationToken);
    Task<Glossary?> GetParentGlossary(IGeneralIdRef? glossaryItemParent, CancellationToken cancellationToken);
    IQueryable<GlossaryCustomField> GetGlossaryCustomFields(long glossaryId);
    Task SaveChildCustomFieldDefinitions(AuditUserDetails auditUserDetails, IReadOnlyList<GlossaryCustomField> removalList, IReadOnlyList<GlossaryCustomField> additionList, CancellationToken cancellationToken);
    Task<List<GlossaryCustomFieldValue>> GetGlossaryCustomValues(IId glossary, CancellationToken cancellationToken);
    Task SaveCustomFieldValues(AuditUserDetails auditUserDetails, Delta<GlossaryCustomFieldValue> delta, CancellationToken cancellationToken);
    Task SaveCustomFieldValues(AuditUserDetails auditUserDetails, IEnumerable<Delta<GlossaryCustomFieldValue>> deltas, CancellationToken cancellationToken);
}