package handler

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

func WrapaddNewJobHandler(ctx *gin.Context) {
	handler := newaddNewJobHandler(ctx)
	baseRun(handler)
}

func newaddNewJobHandler(ctx *gin.Context) *AddNewJobHandler {
	return &AddNewJobHandler{
		req:  http_model.NewAddNewJobRequest(),
		resp: http_model.NewAddNewJobResponse(),
		ctx:  ctx,
	}
}

type AddNewJobHandler struct {
	req  *http_model.AddNewJobRequest
	resp *http_model.CommonResponse
	ctx  *gin.Context
}

func (h *AddNewJobHandler) getRequest() interface{} {
	return h.req
}
func (h *AddNewJobHandler) getContext() *gin.Context {
	return h.ctx
}
func (h *AddNewJobHandler) getResponse() interface{} {
	return h.resp
}
func (h *AddNewJobHandler) run() {
	// fmt.Println("AddNewJobHandler Running")
	// fmt.Println("岗位信息：", h.req)
	jobData := http_model.AddNewJobRequest{}
	jobData = *h.req
	err := service.Job.CreateJob(h.ctx, jobData)
	if err != nil {
		fmt.Println(err)
	}
	return
}

func (h *AddNewJobHandler) checkParam() error {
	return nil
}
