package agent

import (
	"context"

	"github.com/tidbcloud/AgentTeam/internal/store/workspace"
	"github.com/tidbcloud/AgentTeam/internal/workflow/invocation"
	"github.com/tidbcloud/AgentTeam/internal/workflow/invocationmanage"
)

// WorkflowInvocationService is the internal immutable acceptance boundary used
// by Workflow Run start. Invocation remains an audit/storage concept and is
// not registered as an Agent API object.
type WorkflowInvocationService interface {
	ReplayManual(context.Context, invocationmanage.ReplayInput) (invocation.AcceptResult, bool, error)
	InvokeManual(context.Context, invocationmanage.ManualInput) (invocation.AcceptResult, error)
}

// WorkflowInvocationOwnerResolver resolves the managing human behind the
// machine of an authenticated Agent for Workflow Run start authorization.
type WorkflowInvocationOwnerResolver interface {
	AgentManagedByUser(context.Context, string, string) (string, error)
}

// WorkflowInvocationWorkspaceResolver resolves the managing human's current
// workspace membership and role for Workflow Run start authorization.
type WorkflowInvocationWorkspaceResolver interface {
	GetWorkspaceForUser(context.Context, string, string) (workspace.Summary, error)
}
