using IamService.Domain.SeedWork;

namespace IamService.Domain.AggregatesModel.PrivilegedAccessAggregate;

/// <summary>
/// EN: Repository interface for PrivilegedAccessGrant aggregate.
/// VI: Interface repository cho PrivilegedAccessGrant aggregate.
/// </summary>
public interface IPrivilegedAccessRepository : IRepository<PrivilegedAccessGrant>
{
    PrivilegedAccessGrant Add(PrivilegedAccessGrant grant);
    void Update(PrivilegedAccessGrant grant);
    Task<PrivilegedAccessGrant?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);
    Task<IEnumerable<PrivilegedAccessGrant>> GetActiveByUserIdAsync(Guid userId, CancellationToken cancellationToken = default);
    Task<IEnumerable<PrivilegedAccessGrant>> GetExpiredGrantsAsync(CancellationToken cancellationToken = default);
    Task<bool> HasActiveGrantAsync(Guid userId, Guid roleId, CancellationToken cancellationToken = default);
}
