using StorageService.Domain.SeedWork;

namespace StorageService.Domain.AggregatesModel.FileShareAggregate;

/// <summary>
/// EN: Repository interface for FileShare aggregate.
/// VI: Interface repository cho FileShare aggregate.
/// </summary>
public interface IFileShareRepository : IRepository<FileShare>
{
    /// <summary>
    /// EN: Get file share by ID.
    /// VI: Lấy file share theo ID.
    /// </summary>
    Task<FileShare?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get file share by token.
    /// VI: Lấy file share theo token.
    /// </summary>
    Task<FileShare?> GetByTokenAsync(string token, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get all shares for a file.
    /// VI: Lấy tất cả shares cho một file.
    /// </summary>
    Task<IEnumerable<FileShare>> GetByFileIdAsync(Guid fileId, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get all shares by a user.
    /// VI: Lấy tất cả shares bởi một user.
    /// </summary>
    Task<IEnumerable<FileShare>> GetBySharedByAsync(string userId, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get all shares with a user.
    /// VI: Lấy tất cả shares với một user.
    /// </summary>
    Task<IEnumerable<FileShare>> GetSharedWithAsync(string userId, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Add a new file share.
    /// VI: Thêm file share mới.
    /// </summary>
    Task<FileShare> AddAsync(FileShare fileShare, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Update a file share.
    /// VI: Cập nhật file share.
    /// </summary>
    void Update(FileShare fileShare);
}
