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

func newRejectSketchHandler(ctx *gin.Context) *RejectSketchHandler {
	return &RejectSketchHandler{
		req:  http_model.NewRejectSketchRequest(),
		resp: http_model.NewRejectSketchResponse(),
		ctx:  ctx,
	}
}

type RejectSketchHandler struct {
	req  *http_model.RejectSketchRequest
	resp *http_model.CommonResponse
	ctx  *gin.Context
}

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

func (h *RejectSketchHandler) run() {
	data := http_model.RejectSketchRequest{}
	data = *h.req
	res, err := service.Sketch.RejectSketch(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 *RejectSketchHandler) checkParam() error {
	return nil
}
