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

package com.azure.resourcemanager.advisor.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.advisor.fluent.models.MetadataEntityInner;
import com.azure.resourcemanager.advisor.models.MetadataSupportedValueDetail;
import com.azure.resourcemanager.advisor.models.Scenario;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MetadataEntityInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MetadataEntityInner model =
            BinaryData
                .fromString(
                    "{\"id\":\"mhquvgjxp\",\"type\":\"czmehmtzopbsp\",\"name\":\"upi\",\"properties\":{\"displayName\":\"ybbejhph\",\"dependsOn\":[\"msxaobhd\",\"bmtqioq\",\"zehtbmu\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\"],\"supportedValues\":[{\"id\":\"hwlrx\",\"displayName\":\"qsoqijgkd\"},{\"id\":\"pazlobcufpdz\",\"displayName\":\"btcqq\"}]}}")
                .toObject(MetadataEntityInner.class);
        Assertions.assertEquals("mhquvgjxp", model.id());
        Assertions.assertEquals("czmehmtzopbsp", model.type());
        Assertions.assertEquals("upi", model.name());
        Assertions.assertEquals("ybbejhph", model.displayName());
        Assertions.assertEquals("msxaobhd", model.dependsOn().get(0));
        Assertions.assertEquals(Scenario.ALERTS, model.applicableScenarios().get(0));
        Assertions.assertEquals("hwlrx", model.supportedValues().get(0).id());
        Assertions.assertEquals("qsoqijgkd", model.supportedValues().get(0).displayName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MetadataEntityInner model =
            new MetadataEntityInner()
                .withId("mhquvgjxp")
                .withType("czmehmtzopbsp")
                .withName("upi")
                .withDisplayName("ybbejhph")
                .withDependsOn(Arrays.asList("msxaobhd", "bmtqioq", "zehtbmu"))
                .withApplicableScenarios(Arrays.asList(Scenario.ALERTS, Scenario.ALERTS))
                .withSupportedValues(
                    Arrays
                        .asList(
                            new MetadataSupportedValueDetail().withId("hwlrx").withDisplayName("qsoqijgkd"),
                            new MetadataSupportedValueDetail().withId("pazlobcufpdz").withDisplayName("btcqq")));
        model = BinaryData.fromObject(model).toObject(MetadataEntityInner.class);
        Assertions.assertEquals("mhquvgjxp", model.id());
        Assertions.assertEquals("czmehmtzopbsp", model.type());
        Assertions.assertEquals("upi", model.name());
        Assertions.assertEquals("ybbejhph", model.displayName());
        Assertions.assertEquals("msxaobhd", model.dependsOn().get(0));
        Assertions.assertEquals(Scenario.ALERTS, model.applicableScenarios().get(0));
        Assertions.assertEquals("hwlrx", model.supportedValues().get(0).id());
        Assertions.assertEquals("qsoqijgkd", model.supportedValues().get(0).displayName());
    }
}
