// Code generated by Azure.Iot.Operations.ProtocolCompilerLib v0.10.0.0; DO NOT EDIT.
package counter

import (
	"github.com/Azure/iot-operations-sdks/go/protocol"
)

type IncrementCommandExecutor struct {
	*protocol.CommandExecutor[IncrementRequestPayload, IncrementResponsePayload]
}

func NewIncrementCommandExecutor(
	app *protocol.Application,
	client protocol.MqttClient,
	requestTopic string,
	handler protocol.CommandHandler[IncrementRequestPayload, IncrementResponsePayload],
	opt ...protocol.CommandExecutorOption,
) (*IncrementCommandExecutor, error) {
	var err error
	executor := &IncrementCommandExecutor{}

	var opts protocol.CommandExecutorOptions
	opts.Apply(
		opt,
		protocol.WithTopicTokens{
			"commandName": "increment",
		},
		protocol.WithIdempotent(false),
	)

	executor.CommandExecutor, err = protocol.NewCommandExecutor(
		app,
		client,
		protocol.JSON[IncrementRequestPayload]{},
		protocol.JSON[IncrementResponsePayload]{},
		requestTopic,
		handler,
		&opts,
	)

	return executor, err
}
