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

package resource

import (
	"context"

	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"

	"github.com/zeromicro/go-zero/zrpc"
	"google.golang.org/grpc"
)

type (
	AllEmpowerReq                = pb.AllEmpowerReq
	CheckPowerReq                = pb.CheckPowerReq
	CrReEmpowerReq               = pb.CrReEmpowerReq
	DeductionReq                 = pb.DeductionReq
	Empower                      = pb.Empower
	EmpowerListReq               = pb.EmpowerListReq
	EmpowerListResp              = pb.EmpowerListResp
	EmpowerReq                   = pb.EmpowerReq
	HaspowersReq                 = pb.HaspowersReq
	HaspowersResp                = pb.HaspowersResp
	PowerReq                     = pb.PowerReq
	RechargeReq                  = pb.RechargeReq
	Resp                         = pb.Resp
	WaitEmpowerDetailBySpecIdReq = pb.WaitEmpowerDetailBySpecIdReq
	WaitEmpowerDetailReq         = pb.WaitEmpowerDetailReq
	WaitEmpowerDetailResp        = pb.WaitEmpowerDetailResp
	WaitEmpowerDetailsResp       = pb.WaitEmpowerDetailsResp

	Resource interface {
		// 开通或者取消用户/企业权益
		PowerHandle(ctx context.Context, in *PowerReq, opts ...grpc.CallOption) (*Resp, error)
		// 检查用户/企业权益
		CheckPower(ctx context.Context, in *CheckPowerReq, opts ...grpc.CallOption) (*Resp, error)
		// 资源扣减
		Deduction(ctx context.Context, in *DeductionReq, opts ...grpc.CallOption) (*Resp, error)
		// 资源充值
		Recharge(ctx context.Context, in *RechargeReq, opts ...grpc.CallOption) (*Resp, error)
		// 先把有权限的人清空，再把权益授权给新的人
		ReEmpower(ctx context.Context, in *EmpowerReq, opts ...grpc.CallOption) (*Resp, error)
		// 先根据功能分类把人的权益清空，再给人授权新的权益
		CrReEmpower(ctx context.Context, in *CrReEmpowerReq, opts ...grpc.CallOption) (*Resp, error)
		// 授权
		Empower(ctx context.Context, in *EmpowerReq, opts ...grpc.CallOption) (*Resp, error)
		// 根据功能代码取消授权
		CancelEmpower(ctx context.Context, in *EmpowerReq, opts ...grpc.CallOption) (*Resp, error)
		// 根据功能分类取消授权
		CancelAllEmpower(ctx context.Context, in *AllEmpowerReq, opts ...grpc.CallOption) (*Resp, error)
		// 授权列表
		EmpowerList(ctx context.Context, in *EmpowerListReq, opts ...grpc.CallOption) (*EmpowerListResp, error)
		// 所有的权益
		Haspowers(ctx context.Context, in *HaspowersReq, opts ...grpc.CallOption) (*HaspowersResp, error)
		// 根据功能代码获取待授权详情
		WaitEmpowerDetail(ctx context.Context, in *WaitEmpowerDetailReq, opts ...grpc.CallOption) (*WaitEmpowerDetailResp, error)
		// 根据商品规格获取待授权详情
		WaitEmpowerDetailBySpecId(ctx context.Context, in *WaitEmpowerDetailBySpecIdReq, opts ...grpc.CallOption) (*WaitEmpowerDetailsResp, error)
	}

	defaultResource struct {
		cli zrpc.Client
	}
)

func NewResource(cli zrpc.Client) Resource {
	return &defaultResource{
		cli: cli,
	}
}

// 开通或者取消用户/企业权益
func (m *defaultResource) PowerHandle(ctx context.Context, in *PowerReq, opts ...grpc.CallOption) (*Resp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.PowerHandle(ctx, in, opts...)
}

// 检查用户/企业权益
func (m *defaultResource) CheckPower(ctx context.Context, in *CheckPowerReq, opts ...grpc.CallOption) (*Resp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.CheckPower(ctx, in, opts...)
}

// 资源扣减
func (m *defaultResource) Deduction(ctx context.Context, in *DeductionReq, opts ...grpc.CallOption) (*Resp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.Deduction(ctx, in, opts...)
}

// 资源充值
func (m *defaultResource) Recharge(ctx context.Context, in *RechargeReq, opts ...grpc.CallOption) (*Resp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.Recharge(ctx, in, opts...)
}

// 先把有权限的人清空，再把权益授权给新的人
func (m *defaultResource) ReEmpower(ctx context.Context, in *EmpowerReq, opts ...grpc.CallOption) (*Resp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.ReEmpower(ctx, in, opts...)
}

// 先根据功能分类把人的权益清空，再给人授权新的权益
func (m *defaultResource) CrReEmpower(ctx context.Context, in *CrReEmpowerReq, opts ...grpc.CallOption) (*Resp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.CrReEmpower(ctx, in, opts...)
}

// 授权
func (m *defaultResource) Empower(ctx context.Context, in *EmpowerReq, opts ...grpc.CallOption) (*Resp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.Empower(ctx, in, opts...)
}

// 根据功能代码取消授权
func (m *defaultResource) CancelEmpower(ctx context.Context, in *EmpowerReq, opts ...grpc.CallOption) (*Resp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.CancelEmpower(ctx, in, opts...)
}

// 根据功能分类取消授权
func (m *defaultResource) CancelAllEmpower(ctx context.Context, in *AllEmpowerReq, opts ...grpc.CallOption) (*Resp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.CancelAllEmpower(ctx, in, opts...)
}

// 授权列表
func (m *defaultResource) EmpowerList(ctx context.Context, in *EmpowerListReq, opts ...grpc.CallOption) (*EmpowerListResp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.EmpowerList(ctx, in, opts...)
}

// 所有的权益
func (m *defaultResource) Haspowers(ctx context.Context, in *HaspowersReq, opts ...grpc.CallOption) (*HaspowersResp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.Haspowers(ctx, in, opts...)
}

// 根据功能代码获取待授权详情
func (m *defaultResource) WaitEmpowerDetail(ctx context.Context, in *WaitEmpowerDetailReq, opts ...grpc.CallOption) (*WaitEmpowerDetailResp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.WaitEmpowerDetail(ctx, in, opts...)
}

// 根据商品规格获取待授权详情
func (m *defaultResource) WaitEmpowerDetailBySpecId(ctx context.Context, in *WaitEmpowerDetailBySpecIdReq, opts ...grpc.CallOption) (*WaitEmpowerDetailsResp, error) {
	client := pb.NewResourceClient(m.cli.Conn())
	return client.WaitEmpowerDetailBySpecId(ctx, in, opts...)
}
