using StorageService.Domain.SeedWork;

namespace StorageService.Domain.AggregatesModel.FolderAggregate;

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

    /// <summary>EN: Get all root folders for user / VI: Lấy tất cả root folders của user</summary>
    Task<IEnumerable<Folder>> GetRootFoldersAsync(string userId, CancellationToken cancellationToken = default);

    /// <summary>EN: Get child folders / VI: Lấy folders con</summary>
    Task<IEnumerable<Folder>> GetChildFoldersAsync(Guid parentId, CancellationToken cancellationToken = default);

    /// <summary>EN: Get folder by path / VI: Lấy folder theo path</summary>
    Task<Folder?> GetByPathAsync(string userId, string path, CancellationToken cancellationToken = default);

    /// <summary>EN: Get all descendant folders / VI: Lấy tất cả folders con cháu</summary>
    Task<IEnumerable<Folder>> GetDescendantsAsync(Guid folderId, CancellationToken cancellationToken = default);

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

    /// <summary>EN: Update folder / VI: Cập nhật folder</summary>
    void Update(Folder folder);

    /// <summary>EN: Check if folder name exists in parent / VI: Kiểm tra tên folder đã tồn tại trong parent</summary>
    Task<bool> ExistsAsync(string userId, Guid? parentId, string name, CancellationToken cancellationToken = default);
}
