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

package com.azure.resourcemanager.databoxedge.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.databoxedge.models.IoTDeviceInfo;
import com.azure.resourcemanager.databoxedge.models.IoTRole;
import com.azure.resourcemanager.databoxedge.models.MountPointMap;
import com.azure.resourcemanager.databoxedge.models.PlatformType;
import com.azure.resourcemanager.databoxedge.models.RoleStatus;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class IoTRoleTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        IoTRole model =
            BinaryData
                .fromString(
                    "{\"kind\":\"IOT\",\"properties\":{\"hostPlatform\":\"Windows\",\"ioTDeviceDetails\":{\"deviceId\":\"cn\",\"ioTHostHub\":\"ujitcjedftww\",\"ioTHostHubId\":\"zkoj\"},\"ioTEdgeDeviceDetails\":{\"deviceId\":\"c\",\"ioTHostHub\":\"zfoqouicybxar\",\"ioTHostHubId\":\"szufoxciqopidoa\"},\"shareMappings\":[{\"shareId\":\"dhkha\",\"roleId\":\"khnzbonlw\",\"mountPoint\":\"oegokdwbwh\",\"roleType\":\"IOT\"},{\"shareId\":\"zcmrvexztvb\",\"roleId\":\"gsfraoyzkoow\",\"mountPoint\":\"mnguxawqaldsyu\",\"roleType\":\"Cognitive\"}],\"roleStatus\":\"Disabled\"},\"id\":\"erqf\",\"name\":\"bw\",\"type\":\"znkbykutwpfhpagm\"}")
                .toObject(IoTRole.class);
        Assertions.assertEquals(PlatformType.WINDOWS, model.hostPlatform());
        Assertions.assertEquals("cn", model.ioTDeviceDetails().deviceId());
        Assertions.assertEquals("ujitcjedftww", model.ioTDeviceDetails().ioTHostHub());
        Assertions.assertEquals("zkoj", model.ioTDeviceDetails().ioTHostHubId());
        Assertions.assertEquals("c", model.ioTEdgeDeviceDetails().deviceId());
        Assertions.assertEquals("zfoqouicybxar", model.ioTEdgeDeviceDetails().ioTHostHub());
        Assertions.assertEquals("szufoxciqopidoa", model.ioTEdgeDeviceDetails().ioTHostHubId());
        Assertions.assertEquals("dhkha", model.shareMappings().get(0).shareId());
        Assertions.assertEquals(RoleStatus.DISABLED, model.roleStatus());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        IoTRole model =
            new IoTRole()
                .withHostPlatform(PlatformType.WINDOWS)
                .withIoTDeviceDetails(
                    new IoTDeviceInfo().withDeviceId("cn").withIoTHostHub("ujitcjedftww").withIoTHostHubId("zkoj"))
                .withIoTEdgeDeviceDetails(
                    new IoTDeviceInfo()
                        .withDeviceId("c")
                        .withIoTHostHub("zfoqouicybxar")
                        .withIoTHostHubId("szufoxciqopidoa"))
                .withShareMappings(
                    Arrays
                        .asList(
                            new MountPointMap().withShareId("dhkha"), new MountPointMap().withShareId("zcmrvexztvb")))
                .withRoleStatus(RoleStatus.DISABLED);
        model = BinaryData.fromObject(model).toObject(IoTRole.class);
        Assertions.assertEquals(PlatformType.WINDOWS, model.hostPlatform());
        Assertions.assertEquals("cn", model.ioTDeviceDetails().deviceId());
        Assertions.assertEquals("ujitcjedftww", model.ioTDeviceDetails().ioTHostHub());
        Assertions.assertEquals("zkoj", model.ioTDeviceDetails().ioTHostHubId());
        Assertions.assertEquals("c", model.ioTEdgeDeviceDetails().deviceId());
        Assertions.assertEquals("zfoqouicybxar", model.ioTEdgeDeviceDetails().ioTHostHub());
        Assertions.assertEquals("szufoxciqopidoa", model.ioTEdgeDeviceDetails().ioTHostHubId());
        Assertions.assertEquals("dhkha", model.shareMappings().get(0).shareId());
        Assertions.assertEquals(RoleStatus.DISABLED, model.roleStatus());
    }
}
