package activity

import (
	"context"

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

type JudgeInput struct {
	Config              types.OrchestratorConfig
	Diff                string
	IntegrationTestLogs string
}

type JudgeOutput struct {
	Verdict  string
	Critique string
}

func JudgeActivity(ctx context.Context, in JudgeInput) (JudgeOutput, error) {
	response, err := CallRoleLLM(ctx, in.Config, "judge", map[string]any{
		"SystemPrompt": in.Config.SystemPrompt,
		"Diff":         in.Diff,
		"TestResult":   in.IntegrationTestLogs,
	})
	if err != nil {
		return JudgeOutput{}, err
	}

	// TODO: parse LLM response for verdict
	return JudgeOutput{Verdict: "pass", Critique: response}, nil
}
