package user_admin

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/user_admin"
	"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/user user_admin DeleteUserAdmin
//
// Delete user | 删除用户
//
// Delete user | 删除用户
//
// Parameters:
//  + name: body
//    require: true
//    in: body
//    type: BaseIDs
//

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

		l := user_admin.NewDeleteUserAdminLogic(r, r.Context(), svcCtx)
		err := l.DeleteUserAdmin(&req)

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

	}
}
