package handler

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

func WrapAgreeCooperateHandler(ctx *gin.Context) {
	handler := newAgreeCooperateHandler(ctx)
	baseRun(handler)
}

func newAgreeCooperateHandler(ctx *gin.Context) *AgreeCooperateHandler {
	return &AgreeCooperateHandler{
		req:  http_model.NewAgreeCooperateRequest(),
		resp: http_model.NewAgreeCooperateResponse(),
		ctx:  ctx,
	}
}

type AgreeCooperateHandler struct {
	req  *http_model.AgreeCooperateRequest
	resp *http_model.CommonResponse
	ctx  *gin.Context
}

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