package handler

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

func WrapSupplierToWithdrawListHandler(ctx *gin.Context) {
	handler := newSupplierToWithdrawListHandler(ctx)
	baseRun(handler)
}

func newSupplierToWithdrawListHandler(ctx *gin.Context) *SupplierToWithdrawListHandler {
	return &SupplierToWithdrawListHandler{
		req:  http_model.NewSupplierToWithdrawListRequest(),
		resp: http_model.NewSupplierToWithdrawListResponse(),
		ctx:  ctx,
	}
}

type SupplierToWithdrawListHandler struct {
	req  *http_model.SupplierToWithdrawListRequest
	resp *http_model.CommonResponse
	ctx  *gin.Context
}

func (h *SupplierToWithdrawListHandler) getRequest() interface{} {
	return h.req
}
func (h *SupplierToWithdrawListHandler) getContext() *gin.Context {
	return h.ctx
}
func (h *SupplierToWithdrawListHandler) getResponse() interface{} {
	return h.resp
}
func (h *SupplierToWithdrawListHandler) run() {
	toWithdrawList, err := service.Supplier.GetSupplierToWithdrawList(h.ctx, h.req)
	if err != nil {
		h.resp.Status = 40000
		h.resp.Message = err.Error()
		return
	}
	h.resp.Status = 50000
	h.resp.Data = toWithdrawList
}

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