package employee_config

import (
	"net/http"

	"github.com/zeromicro/go-zero/rest/httpx"

	"wechat-api/internal/logic/employee_config"
	"wechat-api/internal/svc"
	"wechat-api/internal/types"
)

// swagger:route get /employee_config/list employee_config GetEmployeeListConfig
//
// Get employee config list | 获取EmployeeConfig列表
//
// Get employee config list | 获取EmployeeConfig列表
//
// Parameters:
//  + name: body
//    require: true
//    in: body
//    type: EmployeeConfigListReq
//
// Responses:
//  200: EmployeeConfigListResp

func GetEmployeeListConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.EmployeeConfigListReq
		if err := httpx.Parse(r, &req, true); err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
			return
		}

		l := employee_config.NewGetEmployeeListConfigLogic(r.Context(), svcCtx)
		resp, err := l.GetEmployeeListConfig(&req)
		if err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
		} else {
			httpx.OkJsonCtx(r.Context(), w, resp)
		}
	}
}
