package handler

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

func WrapSupplierInvoiceListHandler(ctx *gin.Context) {
	handler := newSupplierInvoiceListHandler(ctx)
	baseRun(handler)
}

func newSupplierInvoiceListHandler(ctx *gin.Context) *SupplierInvoiceListHandler {
	return &SupplierInvoiceListHandler{
		req:  http_model.NewSupplierInvoiceListRequest(),
		resp: http_model.NewSupplierInvoiceListResponse(),
		ctx:  ctx,
	}
}

type SupplierInvoiceListHandler struct {
	req  *http_model.SupplierInvoiceListRequest
	resp *http_model.CommonResponse
	ctx  *gin.Context
}

func (h *SupplierInvoiceListHandler) getRequest() interface{} {
	return h.req
}
func (h *SupplierInvoiceListHandler) getContext() *gin.Context {
	return h.ctx
}
func (h *SupplierInvoiceListHandler) getResponse() interface{} {
	return h.resp
}
func (h *SupplierInvoiceListHandler) run() {
	supplierInvoice, err := service.Supplier.GetSupplierInvoiceList(h.ctx, h.req)
	if err != nil {
		h.resp.Data = err
		h.resp.Message = "查询失败"
	}
	h.resp.Data = supplierInvoice
	h.resp.Message = "查询成功"

}

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