/* Code generated by Azure.Iot.Operations.ProtocolCompilerLib v1.0.0.0; DO NOT EDIT. */

#nullable enable

using System;
using System.Collections.Generic;
using Azure.Iot.Operations.Protocol;
using Azure.Iot.Operations.Protocol.RPC;
using Azure.Iot.Operations.Protocol.Models;
using Azure.Iot.Operations.Services.AssetAndDeviceRegistry.Generated.Common;

namespace Azure.Iot.Operations.Services.AssetAndDeviceRegistry.Generated.DeviceDiscoveryService
{
    public static partial class DeviceDiscoveryService
    {
        /// <summary>
        /// Specializes the <c>CommandInvoker</c> class for Command 'createOrUpdateDiscoveredDevice'.
        /// </summary>
        [CommandTopic("akri/discovery/resources/{ex:discoveryClientId}/{ex:inboundEndpointType}/createOrUpdateDiscoveredDevice")]
        public class CreateOrUpdateDiscoveredDeviceCommandInvoker : CommandInvoker<CreateOrUpdateDiscoveredDeviceRequestPayload, CreateOrUpdateDiscoveredDeviceResponseSchema>
        {
            /// <summary>
            /// Initializes a new instance of the <see cref="CreateOrUpdateDiscoveredDeviceCommandInvoker"/> class.
            /// </summary>
            public CreateOrUpdateDiscoveredDeviceCommandInvoker(ApplicationContext applicationContext, IMqttPubSubClient mqttClient)
                : base(applicationContext, mqttClient, "createOrUpdateDiscoveredDevice", new Utf8JsonSerializer())
            {
                this.ResponseTopicPrefix = "clients/{invokerClientId}"; // default value, can be overwritten by user code

                if (mqttClient.ClientId != null)
                {
                    TopicTokenMap["invokerClientId"] = mqttClient.ClientId;
                }
            }
        }
    }
}
