package oauthprovider_admin

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 DeleteOauthProviderAdminLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	r      *http.Request
}

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

func (l *DeleteOauthProviderAdminLogic) DeleteOauthProviderAdmin(req *types.BaseIDs) error {
	_, err := l.svcCtx.CoreRpc.DeleteOauthProvider(l.ctx, &core.IDsReq{Ids: req.Ids})
	if err != nil {
		return err
	}
	return nil
}
