package handler

import (
	"github.com/gin-gonic/gin"
	"youngee_b_api/model/http_model"
	"youngee_b_api/service"
)

func WrapRejectCooperateHandler(ctx *gin.Context) {
	handler := newRejectCooperateHandler(ctx)
	baseRun(handler)
}

func newRejectCooperateHandler(ctx *gin.Context) *RejectCooperateHandler {
	return &RejectCooperateHandler{
		req:  http_model.NewRejectCooperateRequest(),
		resp: http_model.NewRejectCooperateResponse(),
		ctx:  ctx,
	}
}

type RejectCooperateHandler struct {
	req  *http_model.RejectCooperateRequest
	resp *http_model.CommonResponse
	ctx  *gin.Context
}

func (h *RejectCooperateHandler) getRequest() interface{} {
	return h.req
}
func (h *RejectCooperateHandler) getContext() *gin.Context {
	return h.ctx
}
func (h *RejectCooperateHandler) getResponse() interface{} {
	return h.resp
}
func (h *RejectCooperateHandler) run() {
	err := service.Cooperate.RejectEnterpriseCooperate(h.ctx, h.req.CooperateId)
	if err != nil {
		h.resp.Data = err
		h.resp.Message = "拒绝合作邀约失败"
	} else {
		h.resp.Message = "拒绝合作邀约成功"
	}
}
func (h *RejectCooperateHandler) checkParam() error {
	return nil
}
