using StorageService.Domain.SeedWork;

namespace StorageService.Domain.AggregatesModel.QuotaAggregate;

/// <summary>
/// EN: Repository interface for UserStorageQuota aggregate.
/// VI: Interface repository cho UserStorageQuota aggregate.
/// </summary>
public interface IQuotaRepository : IRepository<UserStorageQuota>
{
    /// <summary>
    /// EN: Add a new quota.
    /// VI: Thêm quota mới.
    /// </summary>
    Task<UserStorageQuota> AddAsync(UserStorageQuota quota, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// EN: Update an existing quota.
    /// VI: Cập nhật quota.
    /// </summary>
    void Update(UserStorageQuota quota);
    
    /// <summary>
    /// EN: Get quota by ID.
    /// VI: Lấy quota theo ID.
    /// </summary>
    Task<UserStorageQuota?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// EN: Get quota by user ID.
    /// VI: Lấy quota theo user ID.
    /// </summary>
    Task<UserStorageQuota?> GetByUserIdAsync(string userId, CancellationToken cancellationToken = default);
    
    /// <summary>
    /// EN: Get or create quota for user.
    /// VI: Lấy hoặc tạo quota cho user.
    /// </summary>
    Task<UserStorageQuota> GetOrCreateAsync(string userId, CancellationToken cancellationToken = default);
}
