package mock

import (
	"context"

	"github.com/confluentinc/confluent-kafka-go/v2/kafka"
)

// NoncommitalConsumerMock mock for Kafka utility
type NoncommitalConsumerMock struct{}

func (c *NoncommitalConsumerMock) Subscribe(topics []string) error {
	return nil
}

func (c *NoncommitalConsumerMock) ConsumeToChannel(topics []string, events chan *kafka.Message) error {
	return nil
}

func (c *NoncommitalConsumerMock) ConsumeOrRebalancedCatch(topics []string, events chan *kafka.Message, reb chan struct{}) error {
	return nil
}

func (c *NoncommitalConsumerMock) Seek(topic string, offset kafka.Offset) error {
	return nil
}

func (c *NoncommitalConsumerMock) Commit(message *kafka.Message) ([]kafka.TopicPartition, error) {
	return []kafka.TopicPartition{message.TopicPartition}, nil
}

func (c *NoncommitalConsumerMock) LastOffsetConsumed(topic string, partition int32) (kafka.Offset, error) {
	return 1, nil
}

func (c *NoncommitalConsumerMock) Stop() {}

func (c *NoncommitalConsumerMock) Check(ctx context.Context) error {
	return nil
}

// passthrough function for CommitOffsets()
func (c *NoncommitalConsumerMock) CommitOffsets(offsets []kafka.TopicPartition) ([]kafka.TopicPartition, error) {
	return nil, nil
}
