using StorageService.Domain.SeedWork;

namespace StorageService.Domain.AggregatesModel.FileVersionAggregate;

/// <summary>
/// EN: Repository interface for FileVersion entity.
/// VI: Interface repository cho entity FileVersion.
/// </summary>
public interface IFileVersionRepository
{
    IUnitOfWork UnitOfWork { get; }
    /// <summary>
    /// EN: Get version by ID.
    /// VI: Lấy version theo ID.
    /// </summary>
    Task<FileVersion?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get all versions of a file ordered by version number descending.
    /// VI: Lấy tất cả versions của file sắp xếp theo số version giảm dần.
    /// </summary>
    Task<IEnumerable<FileVersion>> GetByFileIdAsync(Guid fileId, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get specific version of a file.
    /// VI: Lấy version cụ thể của file.
    /// </summary>
    Task<FileVersion?> GetByFileIdAndVersionAsync(Guid fileId, int versionNumber, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get current version of a file.
    /// VI: Lấy version hiện tại của file.
    /// </summary>
    Task<FileVersion?> GetCurrentVersionAsync(Guid fileId, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get latest version number for a file.
    /// VI: Lấy số version mới nhất của file.
    /// </summary>
    Task<int> GetLatestVersionNumberAsync(Guid fileId, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Add new version.
    /// VI: Thêm version mới.
    /// </summary>
    Task<FileVersion> AddAsync(FileVersion version, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Update version.
    /// VI: Cập nhật version.
    /// </summary>
    void Update(FileVersion version);
}
