using WhatsAppService.Domain.SeedWork;

namespace WhatsAppService.Domain.AggregatesModel.AutomationFlowAggregate;

/// <summary>
/// EN: Repository interface for AutomationFlow aggregate root.
/// VI: Interface repository cho AutomationFlow aggregate root.
/// </summary>
public interface IAutomationFlowRepository : IRepository<AutomationFlow>
{
    /// <summary>
    /// EN: Add a new automation flow.
    /// VI: Thêm một automation flow mới.
    /// </summary>
    Task<AutomationFlow> AddAsync(AutomationFlow flow, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Update an existing automation flow.
    /// VI: Cập nhật một automation flow đã tồn tại.
    /// </summary>
    void Update(AutomationFlow flow);

    /// <summary>
    /// EN: Get an automation flow by ID with steps.
    /// VI: Lấy một automation flow theo ID kèm steps.
    /// </summary>
    Task<AutomationFlow?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get active flows by shop ID.
    /// VI: Lấy các flows đang hoạt động theo shop ID.
    /// </summary>
    Task<IReadOnlyList<AutomationFlow>> GetActiveByShopIdAsync(Guid shopId, CancellationToken cancellationToken = default);

    /// <summary>
    /// EN: Get flows by trigger type.
    /// VI: Lấy flows theo loại trigger.
    /// </summary>
    Task<IReadOnlyList<AutomationFlow>> GetByTriggerTypeAsync(Guid shopId, TriggerType triggerType, CancellationToken cancellationToken = default);
}
