// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
// Licensed under the GNU Affero General Public License (AGPL).
// See License.AGPL.txt in the project root for license information.

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             (unknown)
// source: usage/v1/usage.proto

package v1

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// UsageServiceClient is the client API for UsageService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type UsageServiceClient interface {
	// GetCostCenter retrieves the active cost center for the given attributionID
	GetCostCenter(ctx context.Context, in *GetCostCenterRequest, opts ...grpc.CallOption) (*GetCostCenterResponse, error)
	// SetCostCenter stores the given cost center
	SetCostCenter(ctx context.Context, in *SetCostCenterRequest, opts ...grpc.CallOption) (*SetCostCenterResponse, error)
	// Triggers reconciliation of usage.
	ReconcileUsage(ctx context.Context, in *ReconcileUsageRequest, opts ...grpc.CallOption) (*ReconcileUsageResponse, error)
	// ResetUsage resets Usage for CostCenters which have expired or will explire shortly
	ResetUsage(ctx context.Context, in *ResetUsageRequest, opts ...grpc.CallOption) (*ResetUsageResponse, error)
	// ListUsage retrieves all usage for the specified attributionId and theb given time range
	ListUsage(ctx context.Context, in *ListUsageRequest, opts ...grpc.CallOption) (*ListUsageResponse, error)
	// GetBalance returns the current credits balance for the given attributionId
	GetBalance(ctx context.Context, in *GetBalanceRequest, opts ...grpc.CallOption) (*GetBalanceResponse, error)
	// AddUsageCreditNote adds a usage credit note to the given cost center with the effective date of now
	AddUsageCreditNote(ctx context.Context, in *AddUsageCreditNoteRequest, opts ...grpc.CallOption) (*AddUsageCreditNoteResponse, error)
}

type usageServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewUsageServiceClient(cc grpc.ClientConnInterface) UsageServiceClient {
	return &usageServiceClient{cc}
}

func (c *usageServiceClient) GetCostCenter(ctx context.Context, in *GetCostCenterRequest, opts ...grpc.CallOption) (*GetCostCenterResponse, error) {
	out := new(GetCostCenterResponse)
	err := c.cc.Invoke(ctx, "/usage.v1.UsageService/GetCostCenter", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *usageServiceClient) SetCostCenter(ctx context.Context, in *SetCostCenterRequest, opts ...grpc.CallOption) (*SetCostCenterResponse, error) {
	out := new(SetCostCenterResponse)
	err := c.cc.Invoke(ctx, "/usage.v1.UsageService/SetCostCenter", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *usageServiceClient) ReconcileUsage(ctx context.Context, in *ReconcileUsageRequest, opts ...grpc.CallOption) (*ReconcileUsageResponse, error) {
	out := new(ReconcileUsageResponse)
	err := c.cc.Invoke(ctx, "/usage.v1.UsageService/ReconcileUsage", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *usageServiceClient) ResetUsage(ctx context.Context, in *ResetUsageRequest, opts ...grpc.CallOption) (*ResetUsageResponse, error) {
	out := new(ResetUsageResponse)
	err := c.cc.Invoke(ctx, "/usage.v1.UsageService/ResetUsage", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *usageServiceClient) ListUsage(ctx context.Context, in *ListUsageRequest, opts ...grpc.CallOption) (*ListUsageResponse, error) {
	out := new(ListUsageResponse)
	err := c.cc.Invoke(ctx, "/usage.v1.UsageService/ListUsage", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *usageServiceClient) GetBalance(ctx context.Context, in *GetBalanceRequest, opts ...grpc.CallOption) (*GetBalanceResponse, error) {
	out := new(GetBalanceResponse)
	err := c.cc.Invoke(ctx, "/usage.v1.UsageService/GetBalance", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *usageServiceClient) AddUsageCreditNote(ctx context.Context, in *AddUsageCreditNoteRequest, opts ...grpc.CallOption) (*AddUsageCreditNoteResponse, error) {
	out := new(AddUsageCreditNoteResponse)
	err := c.cc.Invoke(ctx, "/usage.v1.UsageService/AddUsageCreditNote", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// UsageServiceServer is the server API for UsageService service.
// All implementations must embed UnimplementedUsageServiceServer
// for forward compatibility
type UsageServiceServer interface {
	// GetCostCenter retrieves the active cost center for the given attributionID
	GetCostCenter(context.Context, *GetCostCenterRequest) (*GetCostCenterResponse, error)
	// SetCostCenter stores the given cost center
	SetCostCenter(context.Context, *SetCostCenterRequest) (*SetCostCenterResponse, error)
	// Triggers reconciliation of usage.
	ReconcileUsage(context.Context, *ReconcileUsageRequest) (*ReconcileUsageResponse, error)
	// ResetUsage resets Usage for CostCenters which have expired or will explire shortly
	ResetUsage(context.Context, *ResetUsageRequest) (*ResetUsageResponse, error)
	// ListUsage retrieves all usage for the specified attributionId and theb given time range
	ListUsage(context.Context, *ListUsageRequest) (*ListUsageResponse, error)
	// GetBalance returns the current credits balance for the given attributionId
	GetBalance(context.Context, *GetBalanceRequest) (*GetBalanceResponse, error)
	// AddUsageCreditNote adds a usage credit note to the given cost center with the effective date of now
	AddUsageCreditNote(context.Context, *AddUsageCreditNoteRequest) (*AddUsageCreditNoteResponse, error)
	mustEmbedUnimplementedUsageServiceServer()
}

// UnimplementedUsageServiceServer must be embedded to have forward compatible implementations.
type UnimplementedUsageServiceServer struct {
}

func (UnimplementedUsageServiceServer) GetCostCenter(context.Context, *GetCostCenterRequest) (*GetCostCenterResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetCostCenter not implemented")
}
func (UnimplementedUsageServiceServer) SetCostCenter(context.Context, *SetCostCenterRequest) (*SetCostCenterResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SetCostCenter not implemented")
}
func (UnimplementedUsageServiceServer) ReconcileUsage(context.Context, *ReconcileUsageRequest) (*ReconcileUsageResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ReconcileUsage not implemented")
}
func (UnimplementedUsageServiceServer) ResetUsage(context.Context, *ResetUsageRequest) (*ResetUsageResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ResetUsage not implemented")
}
func (UnimplementedUsageServiceServer) ListUsage(context.Context, *ListUsageRequest) (*ListUsageResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListUsage not implemented")
}
func (UnimplementedUsageServiceServer) GetBalance(context.Context, *GetBalanceRequest) (*GetBalanceResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetBalance not implemented")
}
func (UnimplementedUsageServiceServer) AddUsageCreditNote(context.Context, *AddUsageCreditNoteRequest) (*AddUsageCreditNoteResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method AddUsageCreditNote not implemented")
}
func (UnimplementedUsageServiceServer) mustEmbedUnimplementedUsageServiceServer() {}

// UnsafeUsageServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to UsageServiceServer will
// result in compilation errors.
type UnsafeUsageServiceServer interface {
	mustEmbedUnimplementedUsageServiceServer()
}

func RegisterUsageServiceServer(s grpc.ServiceRegistrar, srv UsageServiceServer) {
	s.RegisterService(&UsageService_ServiceDesc, srv)
}

func _UsageService_GetCostCenter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetCostCenterRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UsageServiceServer).GetCostCenter(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/usage.v1.UsageService/GetCostCenter",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UsageServiceServer).GetCostCenter(ctx, req.(*GetCostCenterRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _UsageService_SetCostCenter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SetCostCenterRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UsageServiceServer).SetCostCenter(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/usage.v1.UsageService/SetCostCenter",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UsageServiceServer).SetCostCenter(ctx, req.(*SetCostCenterRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _UsageService_ReconcileUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ReconcileUsageRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UsageServiceServer).ReconcileUsage(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/usage.v1.UsageService/ReconcileUsage",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UsageServiceServer).ReconcileUsage(ctx, req.(*ReconcileUsageRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _UsageService_ResetUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ResetUsageRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UsageServiceServer).ResetUsage(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/usage.v1.UsageService/ResetUsage",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UsageServiceServer).ResetUsage(ctx, req.(*ResetUsageRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _UsageService_ListUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ListUsageRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UsageServiceServer).ListUsage(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/usage.v1.UsageService/ListUsage",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UsageServiceServer).ListUsage(ctx, req.(*ListUsageRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _UsageService_GetBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetBalanceRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UsageServiceServer).GetBalance(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/usage.v1.UsageService/GetBalance",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UsageServiceServer).GetBalance(ctx, req.(*GetBalanceRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _UsageService_AddUsageCreditNote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(AddUsageCreditNoteRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UsageServiceServer).AddUsageCreditNote(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/usage.v1.UsageService/AddUsageCreditNote",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UsageServiceServer).AddUsageCreditNote(ctx, req.(*AddUsageCreditNoteRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// UsageService_ServiceDesc is the grpc.ServiceDesc for UsageService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var UsageService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "usage.v1.UsageService",
	HandlerType: (*UsageServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetCostCenter",
			Handler:    _UsageService_GetCostCenter_Handler,
		},
		{
			MethodName: "SetCostCenter",
			Handler:    _UsageService_SetCostCenter_Handler,
		},
		{
			MethodName: "ReconcileUsage",
			Handler:    _UsageService_ReconcileUsage_Handler,
		},
		{
			MethodName: "ResetUsage",
			Handler:    _UsageService_ResetUsage_Handler,
		},
		{
			MethodName: "ListUsage",
			Handler:    _UsageService_ListUsage_Handler,
		},
		{
			MethodName: "GetBalance",
			Handler:    _UsageService_GetBalance_Handler,
		},
		{
			MethodName: "AddUsageCreditNote",
			Handler:    _UsageService_AddUsageCreditNote_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "usage/v1/usage.proto",
}
