package advice

import (
	"ai_scheduler/internal/biz"
	"ai_scheduler/internal/config"
	"ai_scheduler/internal/entitys"
	"ai_scheduler/internal/pkg"

	"github.com/gofiber/fiber/v2"
)

// TalkSkillService 数据处理
type TalkSkillService struct {
	adviceSkillBiz *biz.AdviceSkillBiz
	cfg            *config.Config
}

// NewTalkSkillService
func NewTalkSkillService(
	adviceSkillBiz *biz.AdviceSkillBiz,
	cfg *config.Config,
) *TalkSkillService {
	return &TalkSkillService{
		adviceSkillBiz: adviceSkillBiz,
		cfg:            cfg,
	}
}

func (d *TalkSkillService) TalkSkillAdd(c *fiber.Ctx) error {
	req := &entitys.AdvicerTalkSkillAddReq{}
	if err := c.BodyParser(req); err != nil {
		return err
	}
	id, err := d.adviceSkillBiz.VersionAdd(c.UserContext(), req)
	return pkg.HandleResponse(c, id, err)
}

func (d *TalkSkillService) TalkSkillUpdate(c *fiber.Ctx) error {
	req := &entitys.AdvicerTalkSkillUpdateReq{}
	if err := c.BodyParser(req); err != nil {
		return err
	}
	return d.adviceSkillBiz.VersionUpdate(c.UserContext(), req)
}

func (d *TalkSkillService) TalkSkillList(c *fiber.Ctx) error {
	req := &entitys.AdvicerTalkSkillListReq{}
	if err := c.BodyParser(req); err != nil {
		return err
	}
	list, err := d.adviceSkillBiz.VersionList(c.UserContext(), req)
	return pkg.HandleResponse(c, list, err)
}

func (d *TalkSkillService) TalkSkillDel(c *fiber.Ctx) error {
	req := &entitys.AdvicerTalkSkillDelReq{}
	if err := c.BodyParser(req); err != nil {
		return err
	}

	return d.adviceSkillBiz.VersionDel(c.UserContext(), req)
}
