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 PublicStyleQuizLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

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

func (l *PublicStyleQuizLogic) PublicStyleQuiz(req *types.StyleQuizReq) (*types.StyleQuizData, error) {
	tone, rhythm, hooks, avoid, summary, tags := usecase.StyleQuiz(req.Samples)
	return &types.StyleQuizData{
		Tone: tone, Rhythm: rhythm, Hooks: hooks, Avoid: avoid, Summary: summary, Tags: tags,
		SignupHint: "想用人設語紋自動產文？登入巡樓試試。",
	}, nil
}
