package handler

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

func WrapupdateJobHandler(ctx *gin.Context) {
	handler := newupdateJobHandler(ctx)
	baseRun(handler)
}

func newupdateJobHandler(ctx *gin.Context) *UpdateNewJobHandler {
	return &UpdateNewJobHandler{
		req:  http_model.NewUpdateJobRequest(),
		resp: http_model.NewUpdateJobResponse(),
		ctx:  ctx,
	}
}

type UpdateNewJobHandler struct {
	req  *http_model.UpdateJobRequest
	resp *http_model.CommonResponse
	ctx  *gin.Context
}

func (h *UpdateNewJobHandler) getRequest() interface{} {
	return h.req
}
func (h *UpdateNewJobHandler) getContext() *gin.Context {
	return h.ctx
}
func (h *UpdateNewJobHandler) getResponse() interface{} {
	return h.resp
}
func (h *UpdateNewJobHandler) run() {
	jobData := http_model.UpdateJobRequest{}
	jobData = *h.req
	err := service.Job.UpdateJob(h.ctx, jobData)
	if err != nil {
		fmt.Println(err)
	}
	return
}

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