// Code generated by sdkgen. DO NOT EDIT.

//nolint
package mongodb

import (
	"context"

	"google.golang.org/grpc"

	"github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/mongodb/v1"
	"github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
)

//revive:disable

// DatabaseServiceClient is a mongodb.DatabaseServiceClient with
// lazy GRPC connection initialization.
type DatabaseServiceClient struct {
	getConn func(ctx context.Context) (*grpc.ClientConn, error)
}

var _ mongodb.DatabaseServiceClient = &DatabaseServiceClient{}

// Create implements mongodb.DatabaseServiceClient
func (c *DatabaseServiceClient) Create(ctx context.Context, in *mongodb.CreateDatabaseRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return mongodb.NewDatabaseServiceClient(conn).Create(ctx, in, opts...)
}

// Delete implements mongodb.DatabaseServiceClient
func (c *DatabaseServiceClient) Delete(ctx context.Context, in *mongodb.DeleteDatabaseRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return mongodb.NewDatabaseServiceClient(conn).Delete(ctx, in, opts...)
}

// Get implements mongodb.DatabaseServiceClient
func (c *DatabaseServiceClient) Get(ctx context.Context, in *mongodb.GetDatabaseRequest, opts ...grpc.CallOption) (*mongodb.Database, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return mongodb.NewDatabaseServiceClient(conn).Get(ctx, in, opts...)
}

// List implements mongodb.DatabaseServiceClient
func (c *DatabaseServiceClient) List(ctx context.Context, in *mongodb.ListDatabasesRequest, opts ...grpc.CallOption) (*mongodb.ListDatabasesResponse, error) {
	conn, err := c.getConn(ctx)
	if err != nil {
		return nil, err
	}
	return mongodb.NewDatabaseServiceClient(conn).List(ctx, in, opts...)
}
