using MktZaloService.Domain.SeedWork;

namespace MktZaloService.Domain.AggregatesModel.CustomerAggregate;

/// <summary>
/// EN: Repository interface for ZaloCustomer aggregate.
/// VI: Interface repository cho ZaloCustomer aggregate.
/// </summary>
public interface ICustomerRepository : IRepository<ZaloCustomer>
{
    /// <summary>
    /// EN: Get customer by ID.
    /// VI: Lấy khách hàng theo ID.
    /// </summary>
    Task<ZaloCustomer?> GetByIdAsync(Guid id, CancellationToken ct = default);

    /// <summary>
    /// EN: Find customer by Zalo user ID.
    /// VI: Tìm khách hàng theo Zalo user ID.
    /// </summary>
    Task<ZaloCustomer?> FindByZaloUserIdAsync(
        string zaloUserId,
        CancellationToken ct = default);

    /// <summary>
    /// EN: Get or create customer by Zalo user info.
    /// VI: Lấy hoặc tạo khách hàng theo thông tin Zalo user.
    /// </summary>
    Task<ZaloCustomer> GetOrCreateAsync(
        string zaloUserId,
        string displayName,
        string? avatarUrl = null,
        CancellationToken ct = default);

    /// <summary>
    /// EN: Add a new customer.
    /// VI: Thêm khách hàng mới.
    /// </summary>
    ZaloCustomer Add(ZaloCustomer customer);

    /// <summary>
    /// EN: Update an existing customer.
    /// VI: Cập nhật khách hàng hiện có.
    /// </summary>
    void Update(ZaloCustomer customer);
}
