package handler

import (
	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"
	"youngee_b_api/consts"
	"youngee_b_api/model/http_model"
	"youngee_b_api/service"
	"youngee_b_api/util"
)

func WrapGetTalentstatusCountHandler(ctx *gin.Context) {
	handler := newGetTalentstatusCountHandler(ctx)
	baseRun(handler)
}

type GetTalentstatusCount struct {
	ctx  *gin.Context
	req  *http_model.GetTalentstatusCountRequest
	resp *http_model.CommonResponse
}

func (c GetTalentstatusCount) getContext() *gin.Context {
	return c.ctx
}

func (c GetTalentstatusCount) getResponse() interface{} {
	return c.resp
}

func (c GetTalentstatusCount) getRequest() interface{} {
	return c.req
}

func (c GetTalentstatusCount) run() {
	data := http_model.GetTalentstatusCountRequest{}
	data = *c.req
	res, err := service.Task.GetTalentstatusCount(c.ctx, data)
	if err != nil {
		logrus.Errorf("[GetTalentstatusCount] call GetTalentstatusCount err:%+v\n", err)
		util.HandlerPackErrorResp(c.resp, consts.ErrorParamCheck, "")
		logrus.Info("GetTalentstatusCount fail,req:%+v", c.req)
		return
	}
	c.resp.Message = "成功查询达人状态数量"
	c.resp.Data = res
	c.resp.Status = consts.ErrorSuccess
}

func (c GetTalentstatusCount) checkParam() error {
	return nil
}

func newGetTalentstatusCountHandler(ctx *gin.Context) *GetTalentstatusCount {
	return &GetTalentstatusCount{
		ctx:  ctx,
		req:  http_model.NewGetTalentstatusCountRequest(),
		resp: http_model.NewGetTalentstatusCountResponse(),
	}
}
