package activity

import (
	"context"

	"github.com/rockliang/poimen/workflows/pkg/types"
)

type PlanningInput struct {
	Config      types.OrchestratorConfig
	BoardState  string
	RepoPath    string
	Milestone   string
	TaskResults []types.TaskUnitOutput
}

type TaskDispatch struct {
	TaskID      string
	PromptSpec  types.PromptSpec
	BaseTimeout *int64
}

type PlanningOutput struct {
	TasksToDispatch      []string
	CompletedBranches    []string
	SubmilestoneComplete bool
}

func PlanningActivity(ctx context.Context, in PlanningInput) (PlanningOutput, error) {
	response, err := CallRoleLLM(ctx, in.Config, "planner", map[string]any{
		"SystemPrompt": in.Config.SystemPrompt,
		"BoardState":   in.BoardState,
		"Milestone":    in.Milestone,
		"Config":       in.Config,
	})
	if err != nil {
		return PlanningOutput{}, err
	}

	// TODO: parse LLM response into task dispatch list
	_ = response
	return PlanningOutput{
		TasksToDispatch:      []string{},
		CompletedBranches:    []string{},
		SubmilestoneComplete: false,
	}, nil
}
