package detail

import (
	"net/http"

	"git.noahlan.cn/noahlan/ntool-biz/zero/statusz"
	"github.com/zeromicro/go-zero/rest/httpx"

	"git.noahlan.cn/n-admin/n-admin-server/api/internal/logic/dictionary_admin/detail"
	"git.noahlan.cn/n-admin/n-admin-server/api/internal/svc"
	"git.noahlan.cn/n-admin/n-admin-server/api/internal/types"
)

// swagger:route delete /api/admin/dictionary/detail dictionary_admin/detail DeleteDictionaryDetailAdmin
//
// Delete dictionary | 删除字典项（批量）
//
// Delete dictionary | 删除字典项（批量）
//

func DeleteDictionaryDetailAdminHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		const transErr = true
		var req types.DeleteDictionaryDetailReq
		if err := httpx.Parse(r, &req); err != nil {
			statusz.ResponseHandler(r, w, transErr, nil, err)
			return
		}

		l := detail.NewDeleteDictionaryDetailAdminLogic(r, r.Context(), svcCtx)
		err := l.DeleteDictionaryDetailAdmin(&req)

		statusz.ResponseHandler(r, w, transErr, nil, err)

	}
}
