// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.media.videoanalyzer.edge.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.UnsupportedEncodingException;

/** Creates a new remote device adapter or updates an existing one. */
@Fluent
public final class RemoteDeviceAdapterSetRequest extends MethodRequest {
    /*
     * The Video Analyzer edge module can act as a transparent gateway for
     * video, enabling IoT devices to send video to the cloud from behind a
     * firewall. A remote device adapter should be created for each such IoT
     * device. Communication between the cloud and IoT device would then flow
     * via the Video Analyzer edge module.
     */
    @JsonProperty(value = "remoteDeviceAdapter", required = true)
    private RemoteDeviceAdapter remoteDeviceAdapter;

    /*
     * method name
     */
    @JsonProperty(value = "methodName", required = true, access = JsonProperty.Access.WRITE_ONLY)
    private String methodName;

    /**
     * Creates an instance of RemoteDeviceAdapterSetRequest class.
     *
     * @param remoteDeviceAdapter the remoteDeviceAdapter value to set.
     */
    @JsonCreator
    public RemoteDeviceAdapterSetRequest(
            @JsonProperty(value = "remoteDeviceAdapter", required = true) RemoteDeviceAdapter remoteDeviceAdapter) {
        methodName = "remoteDeviceAdapterSet";
        this.remoteDeviceAdapter = remoteDeviceAdapter;
    }

    /**
     * Get the remoteDeviceAdapter property: The Video Analyzer edge module can act as a transparent gateway for video,
     * enabling IoT devices to send video to the cloud from behind a firewall. A remote device adapter should be created
     * for each such IoT device. Communication between the cloud and IoT device would then flow via the Video Analyzer
     * edge module.
     *
     * @return the remoteDeviceAdapter value.
     */
    public RemoteDeviceAdapter getRemoteDeviceAdapter() {
        return this.remoteDeviceAdapter;
    }

    /**
     * Get the methodName property: method name.
     *
     * @return the methodName value.
     */
    public String getMethodName() {
        return this.methodName;
    }

    /**
     * Get the payload as JSON: the serialized form of the request body
     *
     * @return the payload as JSON
     * @throws UnsupportedEncodingException UnsupportedEncodingException UnsupportedEncodingException
     */
    public String getPayloadAsJson() throws UnsupportedEncodingException {
        RemoteDeviceAdapterSetRequestBody setRequestBody =
                new RemoteDeviceAdapterSetRequestBody(this.remoteDeviceAdapter.getName());
        setRequestBody.setSystemData(this.remoteDeviceAdapter.getSystemData());
        setRequestBody.setProperties(this.remoteDeviceAdapter.getProperties());
        return setRequestBody.getPayloadAsJson();
    }
}
