using IamService.Domain.SeedWork;

namespace IamService.Domain.AggregatesModel.UserAggregate;

/// <summary>
/// EN: Repository interface for ApplicationUser aggregate.
/// VI: Interface repository cho ApplicationUser aggregate.
/// </summary>
public interface IUserRepository : IRepository<ApplicationUser>
{
    /// <summary>
    /// EN: Find user by email.
    /// VI: Tìm user theo email.
    /// </summary>
    Task<ApplicationUser?> FindByEmailAsync(string email, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Find user by ID.
    /// VI: Tìm user theo ID.
    /// </summary>
    Task<ApplicationUser?> FindByIdAsync(Guid id, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get all users with pagination.
    /// VI: Lấy tất cả users với phân trang.
    /// </summary>
    Task<(IEnumerable<ApplicationUser> Users, int TotalCount)> GetAllAsync(
        int pageNumber, 
        int pageSize, 
        CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Add new user.
    /// VI: Thêm user mới.
    /// </summary>
    ApplicationUser Add(ApplicationUser user);

    /// <summary>
    /// EN: Update existing user.
    /// VI: Cập nhật user hiện có.
    /// </summary>
    void Update(ApplicationUser user);
}
