package mongotest

import (
	"context"
	"fmt"

	"github.com/pfeifferj/container-mom-go/pkg/operator/mongodb/api"
	"go.mongodb.org/mongo-driver/mongo"
)

var _ api.Interface = (*ErrorMockClient)(nil)

// ErrorMockClient simulates MongoDB errors
type ErrorMockClient struct{}

func NewErrorMockClient() *ErrorMockClient {
	return &ErrorMockClient{}
}

func (m *ErrorMockClient) ListDeployments(ctx context.Context) ([]api.MongoDeployment, error) {
	return nil, fmt.Errorf("failed to query deployments: simulated error")
}

func (m *ErrorMockClient) GetDeployment(ctx context.Context, id string) (*api.MongoDeployment, error) {
	return nil, fmt.Errorf("failed to get deployment: simulated error")
}

func (m *ErrorMockClient) CreateDeployment(ctx context.Context, deployment *api.MongoDeployment) error {
	return fmt.Errorf("failed to create deployment: simulated error")
}

func (m *ErrorMockClient) UpdateDeployment(ctx context.Context, deployment *api.MongoDeployment) error {
	return fmt.Errorf("failed to update deployment: simulated error")
}

func (m *ErrorMockClient) DeleteDeployment(ctx context.Context, id string) error {
	return fmt.Errorf("failed to delete deployment: simulated error")
}

func (m *ErrorMockClient) DeleteAllDeployments(ctx context.Context) error {
	return fmt.Errorf("failed to delete all deployments: simulated error")
}

func (m *ErrorMockClient) GetClient() *mongo.Client {
	return nil
}

func (m *ErrorMockClient) Disconnect(ctx context.Context) error {
	return fmt.Errorf("failed to disconnect: simulated error")
}

func (m *ErrorMockClient) Database(name string) *mongo.Database {
	return nil
}
