package handler

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

func WrapSpecialAddStrategyHandler(ctx *gin.Context) {
	handler := newSpecialAddStrategyHandler(ctx)
	baseRun(handler)
}

func newSpecialAddStrategyHandler(ctx *gin.Context) *SpecialAddStrategyHandler {
	return &SpecialAddStrategyHandler{
		req:  http_model.NewSpecialAddStrategyRequest(),
		resp: http_model.NewSpecialAddStrategyResponse(),
		ctx:  ctx,
	}
}

type SpecialAddStrategyHandler struct {
	req  *http_model.SpecialAddStrategyRequest
	resp *http_model.CommonResponse
	ctx  *gin.Context
}

func (p *SpecialAddStrategyHandler) getContext() *gin.Context {
	return p.ctx
}

func (p *SpecialAddStrategyHandler) getResponse() interface{} {
	return p.resp
}

func (p *SpecialAddStrategyHandler) getRequest() interface{} {
	return p.req
}

func (p *SpecialAddStrategyHandler) run() {
	fmt.Println(p.req.RecruitStrategys)
	err := service.SProject.CreateSpecialStrategy(p.ctx, p.req)
	if err != nil {
		p.resp.Message = err.Error()
	}
	p.resp.Message = "成功添加招募策略"
}

func (p *SpecialAddStrategyHandler) checkParam() error {
	return nil
}
