// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.
// source: services/leases/v1/leases.proto
package leases

import (
	context "context"
	ttrpc "github.com/containerd/ttrpc"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)

type TTRPCLeasesService interface {
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error)
	List(context.Context, *ListRequest) (*ListResponse, error)
	AddResource(context.Context, *AddResourceRequest) (*emptypb.Empty, error)
	DeleteResource(context.Context, *DeleteResourceRequest) (*emptypb.Empty, error)
	ListResources(context.Context, *ListResourcesRequest) (*ListResourcesResponse, error)
}

func RegisterTTRPCLeasesService(srv *ttrpc.Server, svc TTRPCLeasesService) {
	srv.RegisterService("containerd.services.leases.v1.Leases", &ttrpc.ServiceDesc{
		Methods: map[string]ttrpc.Method{
			"Create": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req CreateRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Create(ctx, &req)
			},
			"Delete": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req DeleteRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Delete(ctx, &req)
			},
			"List": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req ListRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.List(ctx, &req)
			},
			"AddResource": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req AddResourceRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.AddResource(ctx, &req)
			},
			"DeleteResource": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req DeleteResourceRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.DeleteResource(ctx, &req)
			},
			"ListResources": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req ListResourcesRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.ListResources(ctx, &req)
			},
		},
	})
}

type ttrpcleasesClient struct {
	client *ttrpc.Client
}

func NewTTRPCLeasesClient(client *ttrpc.Client) TTRPCLeasesService {
	return &ttrpcleasesClient{
		client: client,
	}
}

func (c *ttrpcleasesClient) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) {
	var resp CreateResponse
	if err := c.client.Call(ctx, "containerd.services.leases.v1.Leases", "Create", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcleasesClient) Delete(ctx context.Context, req *DeleteRequest) (*emptypb.Empty, error) {
	var resp emptypb.Empty
	if err := c.client.Call(ctx, "containerd.services.leases.v1.Leases", "Delete", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcleasesClient) List(ctx context.Context, req *ListRequest) (*ListResponse, error) {
	var resp ListResponse
	if err := c.client.Call(ctx, "containerd.services.leases.v1.Leases", "List", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcleasesClient) AddResource(ctx context.Context, req *AddResourceRequest) (*emptypb.Empty, error) {
	var resp emptypb.Empty
	if err := c.client.Call(ctx, "containerd.services.leases.v1.Leases", "AddResource", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcleasesClient) DeleteResource(ctx context.Context, req *DeleteResourceRequest) (*emptypb.Empty, error) {
	var resp emptypb.Empty
	if err := c.client.Call(ctx, "containerd.services.leases.v1.Leases", "DeleteResource", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcleasesClient) ListResources(ctx context.Context, req *ListResourcesRequest) (*ListResourcesResponse, error) {
	var resp ListResourcesResponse
	if err := c.client.Call(ctx, "containerd.services.leases.v1.Leases", "ListResources", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}
