using ScadaLink.Commons.Entities.Security;

namespace ScadaLink.Commons.Interfaces.Repositories;

public interface ISecurityRepository
{
    // LdapGroupMapping
    Task<LdapGroupMapping?> GetMappingByIdAsync(int id, CancellationToken cancellationToken = default);
    Task<IReadOnlyList<LdapGroupMapping>> GetAllMappingsAsync(CancellationToken cancellationToken = default);
    Task<IReadOnlyList<LdapGroupMapping>> GetMappingsByRoleAsync(string role, CancellationToken cancellationToken = default);
    Task AddMappingAsync(LdapGroupMapping mapping, CancellationToken cancellationToken = default);
    Task UpdateMappingAsync(LdapGroupMapping mapping, CancellationToken cancellationToken = default);
    Task DeleteMappingAsync(int id, CancellationToken cancellationToken = default);

    // SiteScopeRule
    Task<SiteScopeRule?> GetScopeRuleByIdAsync(int id, CancellationToken cancellationToken = default);
    Task<IReadOnlyList<SiteScopeRule>> GetScopeRulesForMappingAsync(int ldapGroupMappingId, CancellationToken cancellationToken = default);
    Task AddScopeRuleAsync(SiteScopeRule rule, CancellationToken cancellationToken = default);
    Task UpdateScopeRuleAsync(SiteScopeRule rule, CancellationToken cancellationToken = default);
    Task DeleteScopeRuleAsync(int id, CancellationToken cancellationToken = default);

    Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
}
