package detail

import (
	"context"
	"git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core"

	"git.noahlan.cn/n-admin/n-admin-server/api/internal/svc"
	"git.noahlan.cn/n-admin/n-admin-server/api/internal/types"

	"net/http"
)

type DeleteDictionaryDetailAdminLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	r      *http.Request
}

func NewDeleteDictionaryDetailAdminLogic(r *http.Request, ctx context.Context, svcCtx *svc.ServiceContext) *DeleteDictionaryDetailAdminLogic {
	return &DeleteDictionaryDetailAdminLogic{
		r:      r,
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *DeleteDictionaryDetailAdminLogic) DeleteDictionaryDetailAdmin(req *types.DeleteDictionaryDetailReq) error {
	_, err := l.svcCtx.CoreRpc.DeleteDictionaryDetail(l.ctx, &core.DeleteDictionaryDetailReq{
		Ids:    req.Ids,
		DictId: req.DictionaryID,
	})
	if err != nil {
		return err
	}

	return nil
}
