// Code generated by goctl. DO NOT EDIT!
// Source: resource.proto

package server

import (
	"context"

	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/internal/logic"
	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/internal/svc"
	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
)

type ResourceServer struct {
	svcCtx *svc.ServiceContext
	pb.UnimplementedResourceServer
}

func NewResourceServer(svcCtx *svc.ServiceContext) *ResourceServer {
	return &ResourceServer{
		svcCtx: svcCtx,
	}
}

// 开通或者取消用户/企业权益
func (s *ResourceServer) PowerHandle(ctx context.Context, in *pb.PowerReq) (*pb.Resp, error) {
	l := logic.NewPowerHandleLogic(ctx, s.svcCtx)
	return l.PowerHandle(in)
}

// 检查用户/企业权益
func (s *ResourceServer) CheckPower(ctx context.Context, in *pb.CheckPowerReq) (*pb.Resp, error) {
	l := logic.NewCheckPowerLogic(ctx, s.svcCtx)
	return l.CheckPower(in)
}

// 资源扣减
func (s *ResourceServer) Deduction(ctx context.Context, in *pb.DeductionReq) (*pb.Resp, error) {
	l := logic.NewDeductionLogic(ctx, s.svcCtx)
	return l.Deduction(in)
}

// 资源充值
func (s *ResourceServer) Recharge(ctx context.Context, in *pb.RechargeReq) (*pb.Resp, error) {
	l := logic.NewRechargeLogic(ctx, s.svcCtx)
	return l.Recharge(in)
}

// 先把有权限的人清空，再把权益授权给新的人
func (s *ResourceServer) ReEmpower(ctx context.Context, in *pb.EmpowerReq) (*pb.Resp, error) {
	l := logic.NewReEmpowerLogic(ctx, s.svcCtx)
	return l.ReEmpower(in)
}

// 先根据功能分类把人的权益清空，再给人授权新的权益
func (s *ResourceServer) CrReEmpower(ctx context.Context, in *pb.CrReEmpowerReq) (*pb.Resp, error) {
	l := logic.NewCrReEmpowerLogic(ctx, s.svcCtx)
	return l.CrReEmpower(in)
}

// 授权
func (s *ResourceServer) Empower(ctx context.Context, in *pb.EmpowerReq) (*pb.Resp, error) {
	l := logic.NewEmpowerLogic(ctx, s.svcCtx)
	return l.Empower(in)
}

// 根据功能代码取消授权
func (s *ResourceServer) CancelEmpower(ctx context.Context, in *pb.EmpowerReq) (*pb.Resp, error) {
	l := logic.NewCancelEmpowerLogic(ctx, s.svcCtx)
	return l.CancelEmpower(in)
}

// 根据功能分类取消授权
func (s *ResourceServer) CancelAllEmpower(ctx context.Context, in *pb.AllEmpowerReq) (*pb.Resp, error) {
	l := logic.NewCancelAllEmpowerLogic(ctx, s.svcCtx)
	return l.CancelAllEmpower(in)
}

// 授权列表
func (s *ResourceServer) EmpowerList(ctx context.Context, in *pb.EmpowerListReq) (*pb.EmpowerListResp, error) {
	l := logic.NewEmpowerListLogic(ctx, s.svcCtx)
	return l.EmpowerList(in)
}

// 所有的权益
func (s *ResourceServer) Haspowers(ctx context.Context, in *pb.HaspowersReq) (*pb.HaspowersResp, error) {
	l := logic.NewHaspowersLogic(ctx, s.svcCtx)
	return l.Haspowers(in)
}

// 根据功能代码获取待授权详情
func (s *ResourceServer) WaitEmpowerDetail(ctx context.Context, in *pb.WaitEmpowerDetailReq) (*pb.WaitEmpowerDetailResp, error) {
	l := logic.NewWaitEmpowerDetailLogic(ctx, s.svcCtx)
	return l.WaitEmpowerDetail(in)
}

// 根据商品规格获取待授权详情
func (s *ResourceServer) WaitEmpowerDetailBySpecId(ctx context.Context, in *pb.WaitEmpowerDetailBySpecIdReq) (*pb.WaitEmpowerDetailsResp, error) {
	l := logic.NewWaitEmpowerDetailBySpecIdLogic(ctx, s.svcCtx)
	return l.WaitEmpowerDetailBySpecId(in)
}
