package logic

import (
	"context"
	"fmt"

	. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/service"
	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/internal/svc"
	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"

	"github.com/zeromicro/go-zero/core/logx"
)

type CancelAllEmpowerLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCancelAllEmpowerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CancelAllEmpowerLogic {
	return &CancelAllEmpowerLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 根据功能分类取消授权
func (l *CancelAllEmpowerLogic) CancelAllEmpower(in *pb.AllEmpowerReq) (*pb.Resp, error) {
	resp := &pb.Resp{}
	status, err := CancelAllEmpower(in.Appid, in.FunctionModule, in.EntId, in.EntUserId)
	if err != nil {
		l.Error(fmt.Sprintf("%+v", in), err)
	}
	resp.Status = status
	return resp, nil
}
