package knowledgeqa

import (
	"context"

	"github.com/tidbcloud/AgentTeam/internal/knowledgeqa/protocol"
)

func (handler *handlerBase) notifyQueued(turn Turn) {
	if handler.deps.Queue == nil {
		return
	}
	handler.deps.Queue.NotifyKnowledgeQATurnQueued(
		context.Background(), turn.WorkspaceID, turn.ID, turn.CurrentAttemptID,
	)
}

func (handler *handlerBase) notifyTurnUpdated(
	ctx context.Context,
	workspaceID string,
	ownerMemberID string,
	threadChannelID string,
	turnID string,
) {
	if handler.deps.TurnUpdates == nil {
		return
	}
	handler.deps.TurnUpdates.NotifyKnowledgeQATurnUpdated(ctx, protocol.TurnUpdate{
		WorkspaceID:     workspaceID,
		OwnerMemberID:   ownerMemberID,
		ThreadChannelID: threadChannelID,
		TurnID:          turnID,
	})
}
