package publictools

import (
	"context"

	"apps/backend/internal/module/growth/usecase"
	"apps/backend/internal/svc"
	"apps/backend/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type PublicPainKeywordsLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewPublicPainKeywordsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PublicPainKeywordsLogic {
	return &PublicPainKeywordsLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
}

func (l *PublicPainKeywordsLogic) PublicPainKeywords(req *types.PainKeywordsReq) (*types.PainKeywordsData, error) {
	kw, pains, scan, summary := usecase.PainKeywords(req.ProductBrief, req.Audience)
	return &types.PainKeywordsData{
		Keywords: kw, Pains: pains, ScanTerms: scan, Summary: summary,
		SignupHint: "把掃描詞丟進海巡 brief，登入後一鍵找痛點貼文。",
	}, nil
}
