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 WrapGetLocalTalentstatusCountHandler(ctx *gin.Context) {
	handler := newGetLocalTalentstatusCountHandler(ctx)
	baseRun(handler)
}

type GetLocalTalentstatusCount struct {
	ctx  *gin.Context
	req  *http_model.GetLocalTalentstatusCountRequest
	resp *http_model.CommonResponse
}

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

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

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

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

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

func newGetLocalTalentstatusCountHandler(ctx *gin.Context) *GetLocalTalentstatusCount {
	return &GetLocalTalentstatusCount{
		ctx:  ctx,
		req:  http_model.NewGetLocalTalentstatusCountRequest(),
		resp: http_model.NewGetLocalTalentstatusCountResponse(),
	}
}
