// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.
// source: github.com/containerd/containerd/api/services/introspection/v1/introspection.proto
package introspection

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

type TTRPCIntrospectionService interface {
	Plugins(context.Context, *PluginsRequest) (*PluginsResponse, error)
	Server(context.Context, *emptypb.Empty) (*ServerResponse, error)
	PluginInfo(context.Context, *PluginInfoRequest) (*PluginInfoResponse, error)
}

func RegisterTTRPCIntrospectionService(srv *ttrpc.Server, svc TTRPCIntrospectionService) {
	srv.RegisterService("containerd.services.introspection.v1.Introspection", &ttrpc.ServiceDesc{
		Methods: map[string]ttrpc.Method{
			"Plugins": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req PluginsRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Plugins(ctx, &req)
			},
			"Server": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req emptypb.Empty
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Server(ctx, &req)
			},
			"PluginInfo": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req PluginInfoRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.PluginInfo(ctx, &req)
			},
		},
	})
}

type ttrpcintrospectionClient struct {
	client *ttrpc.Client
}

func NewTTRPCIntrospectionClient(client *ttrpc.Client) TTRPCIntrospectionService {
	return &ttrpcintrospectionClient{
		client: client,
	}
}

func (c *ttrpcintrospectionClient) Plugins(ctx context.Context, req *PluginsRequest) (*PluginsResponse, error) {
	var resp PluginsResponse
	if err := c.client.Call(ctx, "containerd.services.introspection.v1.Introspection", "Plugins", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcintrospectionClient) Server(ctx context.Context, req *emptypb.Empty) (*ServerResponse, error) {
	var resp ServerResponse
	if err := c.client.Call(ctx, "containerd.services.introspection.v1.Introspection", "Server", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *ttrpcintrospectionClient) PluginInfo(ctx context.Context, req *PluginInfoRequest) (*PluginInfoResponse, error) {
	var resp PluginInfoResponse
	if err := c.client.Call(ctx, "containerd.services.introspection.v1.Introspection", "PluginInfo", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}
