// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.
// source: hypervisor.proto
package __

import (
	context "context"
	ttrpc "github.com/containerd/ttrpc"
)

type HypervisorService interface {
	CreateVM(context.Context, *CreateVMRequest) (*CreateVMResponse, error)
	StartVM(context.Context, *StartVMRequest) (*StartVMResponse, error)
	StopVM(context.Context, *StopVMRequest) (*StopVMResponse, error)
	Version(context.Context, *VersionRequest) (*VersionResponse, error)
}

func RegisterHypervisorService(srv *ttrpc.Server, svc HypervisorService) {
	srv.RegisterService("hypervisor.Hypervisor", &ttrpc.ServiceDesc{
		Methods: map[string]ttrpc.Method{
			"CreateVM": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req CreateVMRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.CreateVM(ctx, &req)
			},
			"StartVM": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req StartVMRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.StartVM(ctx, &req)
			},
			"StopVM": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req StopVMRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.StopVM(ctx, &req)
			},
			"Version": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
				var req VersionRequest
				if err := unmarshal(&req); err != nil {
					return nil, err
				}
				return svc.Version(ctx, &req)
			},
		},
	})
}

type hypervisorClient struct {
	client *ttrpc.Client
}

func NewHypervisorClient(client *ttrpc.Client) HypervisorService {
	return &hypervisorClient{
		client: client,
	}
}

func (c *hypervisorClient) CreateVM(ctx context.Context, req *CreateVMRequest) (*CreateVMResponse, error) {
	var resp CreateVMResponse
	if err := c.client.Call(ctx, "hypervisor.Hypervisor", "CreateVM", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *hypervisorClient) StartVM(ctx context.Context, req *StartVMRequest) (*StartVMResponse, error) {
	var resp StartVMResponse
	if err := c.client.Call(ctx, "hypervisor.Hypervisor", "StartVM", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *hypervisorClient) StopVM(ctx context.Context, req *StopVMRequest) (*StopVMResponse, error) {
	var resp StopVMResponse
	if err := c.client.Call(ctx, "hypervisor.Hypervisor", "StopVM", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}

func (c *hypervisorClient) Version(ctx context.Context, req *VersionRequest) (*VersionResponse, error) {
	var resp VersionResponse
	if err := c.client.Call(ctx, "hypervisor.Hypervisor", "Version", req, &resp); err != nil {
		return nil, err
	}
	return &resp, nil
}
