package handler

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

func WrapLocalRejectSketchHandler(ctx *gin.Context) {
	handler := newLocalRejectSketchHandler(ctx)
	baseRun(handler)
}

func newLocalRejectSketchHandler(ctx *gin.Context) *LocalRejectSketchHandler {
	return &LocalRejectSketchHandler{
		req:  http_model.NewLocalRejectSketchRequest(),
		resp: http_model.NewLocalRejectSketchResponse(),
		ctx:  ctx,
	}
}

type LocalRejectSketchHandler struct {
	req  *http_model.LocalRejectSketchRequest
	resp *http_model.CommonResponse
	ctx  *gin.Context
}

func (h *LocalRejectSketchHandler) getRequest() interface{} {
	return h.req
}
func (h *LocalRejectSketchHandler) getContext() *gin.Context {
	return h.ctx
}
func (h *LocalRejectSketchHandler) getResponse() interface{} {
	return h.resp
}

func (h *LocalRejectSketchHandler) run() {
	data := http_model.LocalRejectSketchRequest{}
	data = *h.req
	res, err := service.Sketch.LocalRejectSketch(h.ctx, data)
	if err != nil {
		logrus.Errorf("[ReviseOpinionHandler] call Create err:%+v\n", err)
		util.HandlerPackErrorResp(h.resp, consts.ErrorParamCheck, "")
		log.Info("CreateProject fail,req:%+v", h.req)
		return
	}
	h.resp.Message = "成功拒绝初稿"
	h.resp.Data = res
	h.resp.Status = consts.ErrorSuccess
}
func (h *LocalRejectSketchHandler) checkParam() error {
	return nil
}
