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

type GetLocalTalentstatusNum struct {
	ctx  *gin.Context
	req  *http_model.GetLocalTalentstatusNumRequest
	resp *http_model.CommonResponse
}

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

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

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

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

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

func newGetLocalTalentstatusNumHandler(ctx *gin.Context) *GetLocalTalentstatusNum {
	return &GetLocalTalentstatusNum{
		ctx:  ctx,
		req:  http_model.NewGetLocalTalentstatusNumRequest(),
		resp: http_model.NewGetLocalTalentstatusNumResponse(),
	}
}
