using SocialService.Domain.SeedWork;

namespace SocialService.Domain.AggregatesModel.UserBlockAggregate;

/// <summary>
/// EN: Repository interface for UserBlock aggregate.
/// VI: Interface repository cho UserBlock aggregate.
/// </summary>
public interface IUserBlockRepository : IRepository<UserBlock>
{
    /// <summary>
    /// EN: Add a new user block.
    /// VI: Thêm một block mới.
    /// </summary>
    UserBlock Add(UserBlock block);

    /// <summary>
    /// EN: Remove a user block.
    /// VI: Xóa một block.
    /// </summary>
    void Remove(UserBlock block);

    /// <summary>
    /// EN: Get block by ID.
    /// VI: Lấy block theo ID.
    /// </summary>
    Task<UserBlock?> GetByIdAsync(Guid id);

    /// <summary>
    /// EN: Get block between two users.
    /// VI: Lấy block giữa hai users.
    /// </summary>
    Task<UserBlock?> GetByUsersAsync(Guid blockerId, Guid blockedId);

    /// <summary>
    /// EN: Get all users blocked by a user.
    /// VI: Lấy tất cả users bị block bởi một user.
    /// </summary>
    Task<IEnumerable<UserBlock>> GetBlockedByUserAsync(Guid blockerId, int skip = 0, int take = 20);

    /// <summary>
    /// EN: Check if a user has blocked another user.
    /// VI: Kiểm tra user có block user khác không.
    /// </summary>
    Task<bool> IsBlockedAsync(Guid blockerId, Guid blockedId);

    /// <summary>
    /// EN: Check if either user has blocked the other.
    /// VI: Kiểm tra một trong hai user có block lẫn nhau không.
    /// </summary>
    Task<bool> HasBlockBetweenAsync(Guid userId1, Guid userId2);

    /// <summary>
    /// EN: Get count of blocked users by a user.
    /// VI: Lấy số lượng users bị block bởi user.
    /// </summary>
    Task<int> GetBlockedCountAsync(Guid blockerId);

    #region Admin Methods

    /// <summary>
    /// EN: Get all blocks with pagination (admin).
    /// VI: Lấy tất cả blocks với phân trang (admin).
    /// </summary>
    Task<IEnumerable<UserBlock>> GetAllAsync(int skip, int take);

    /// <summary>
    /// EN: Get total count of all blocks (admin).
    /// VI: Lấy tổng số tất cả blocks (admin).
    /// </summary>
    Task<int> GetTotalCountAsync();

    /// <summary>
    /// EN: Get IDs of users blocked by a user.
    /// VI: Lấy danh sách ID users bị block bởi user.
    /// </summary>
    Task<IEnumerable<Guid>> GetBlockedUserIdsAsync(Guid blockerId);

    #endregion
}

