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

package com.azure.resourcemanager.vmwarecloudsimple.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.CustomizationPolicyProperties;
import com.azure.resourcemanager.vmwarecloudsimple.models.CustomizationIdentity;
import com.azure.resourcemanager.vmwarecloudsimple.models.CustomizationIdentityType;
import com.azure.resourcemanager.vmwarecloudsimple.models.CustomizationNicSetting;
import com.azure.resourcemanager.vmwarecloudsimple.models.CustomizationPolicyPropertiesType;
import com.azure.resourcemanager.vmwarecloudsimple.models.CustomizationSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class CustomizationPolicyPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CustomizationPolicyProperties model =
            BinaryData
                .fromString(
                    "{\"description\":\"tcs\",\"privateCloudId\":\"cktqumiekkezzi\",\"specification\":{\"identity\":{\"data\":\"fjhdg\",\"type\":\"WINDOWS_TEXT\"},\"nicSettings\":[{\"macAddress\":\"g\"},{\"macAddress\":\"idb\"},{\"macAddress\":\"t\"}]},\"type\":\"WINDOWS\",\"version\":\"rxcyjmoad\"}")
                .toObject(CustomizationPolicyProperties.class);
        Assertions.assertEquals("tcs", model.description());
        Assertions.assertEquals("cktqumiekkezzi", model.privateCloudId());
        Assertions.assertEquals("fjhdg", model.specification().identity().data());
        Assertions.assertEquals(CustomizationIdentityType.WINDOWS_TEXT, model.specification().identity().type());
        Assertions.assertEquals("g", model.specification().nicSettings().get(0).macAddress());
        Assertions.assertEquals(CustomizationPolicyPropertiesType.WINDOWS, model.type());
        Assertions.assertEquals("rxcyjmoad", model.version());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CustomizationPolicyProperties model =
            new CustomizationPolicyProperties()
                .withDescription("tcs")
                .withPrivateCloudId("cktqumiekkezzi")
                .withSpecification(
                    new CustomizationSpecification()
                        .withIdentity(
                            new CustomizationIdentity()
                                .withData("fjhdg")
                                .withType(CustomizationIdentityType.WINDOWS_TEXT))
                        .withNicSettings(
                            Arrays
                                .asList(
                                    new CustomizationNicSetting().withMacAddress("g"),
                                    new CustomizationNicSetting().withMacAddress("idb"),
                                    new CustomizationNicSetting().withMacAddress("t"))))
                .withType(CustomizationPolicyPropertiesType.WINDOWS)
                .withVersion("rxcyjmoad");
        model = BinaryData.fromObject(model).toObject(CustomizationPolicyProperties.class);
        Assertions.assertEquals("tcs", model.description());
        Assertions.assertEquals("cktqumiekkezzi", model.privateCloudId());
        Assertions.assertEquals("fjhdg", model.specification().identity().data());
        Assertions.assertEquals(CustomizationIdentityType.WINDOWS_TEXT, model.specification().identity().type());
        Assertions.assertEquals("g", model.specification().nicSettings().get(0).macAddress());
        Assertions.assertEquals(CustomizationPolicyPropertiesType.WINDOWS, model.type());
        Assertions.assertEquals("rxcyjmoad", model.version());
    }
}
