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

package com.azure.resourcemanager.netapp.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.netapp.models.Dimension;
import com.azure.resourcemanager.netapp.models.MetricAggregationType;
import com.azure.resourcemanager.netapp.models.MetricSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MetricSpecificationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MetricSpecification model =
            BinaryData
                .fromString(
                    "{\"name\":\"awrlyx\",\"displayName\":\"kcprbnw\",\"displayDescription\":\"gjvtbv\",\"unit\":\"sszdnru\",\"supportedAggregationTypes\":[\"Average\",\"Average\",\"Average\"],\"supportedTimeGrainTypes\":[\"uqfprwzw\",\"nguitnwuizgazxu\"],\"internalMetricName\":\"zuckyfi\",\"enableRegionalMdmAccount\":false,\"sourceMdmAccount\":\"dfvzwdzuhty\",\"sourceMdmNamespace\":\"isdkfthwxmnteiw\",\"dimensions\":[{\"name\":\"km\",\"displayName\":\"c\"},{\"name\":\"xdcu\",\"displayName\":\"fsrpymzidnse\"},{\"name\":\"xtbzsgfyccsne\",\"displayName\":\"dwzjeiach\"},{\"name\":\"osfln\",\"displayName\":\"sfqpteehz\"}],\"aggregationType\":\"ypyqrimzinp\",\"fillGapWithZero\":false,\"category\":\"dkirsoodqxhcr\",\"resourceIdDimensionNameOverride\":\"ohjtckw\",\"isInternal\":true}")
                .toObject(MetricSpecification.class);
        Assertions.assertEquals("awrlyx", model.name());
        Assertions.assertEquals("kcprbnw", model.displayName());
        Assertions.assertEquals("gjvtbv", model.displayDescription());
        Assertions.assertEquals("sszdnru", model.unit());
        Assertions.assertEquals(MetricAggregationType.AVERAGE, model.supportedAggregationTypes().get(0));
        Assertions.assertEquals("uqfprwzw", model.supportedTimeGrainTypes().get(0));
        Assertions.assertEquals("zuckyfi", model.internalMetricName());
        Assertions.assertEquals(false, model.enableRegionalMdmAccount());
        Assertions.assertEquals("dfvzwdzuhty", model.sourceMdmAccount());
        Assertions.assertEquals("isdkfthwxmnteiw", model.sourceMdmNamespace());
        Assertions.assertEquals("km", model.dimensions().get(0).name());
        Assertions.assertEquals("c", model.dimensions().get(0).displayName());
        Assertions.assertEquals("ypyqrimzinp", model.aggregationType());
        Assertions.assertEquals(false, model.fillGapWithZero());
        Assertions.assertEquals("dkirsoodqxhcr", model.category());
        Assertions.assertEquals("ohjtckw", model.resourceIdDimensionNameOverride());
        Assertions.assertEquals(true, model.isInternal());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MetricSpecification model =
            new MetricSpecification()
                .withName("awrlyx")
                .withDisplayName("kcprbnw")
                .withDisplayDescription("gjvtbv")
                .withUnit("sszdnru")
                .withSupportedAggregationTypes(
                    Arrays
                        .asList(
                            MetricAggregationType.AVERAGE,
                            MetricAggregationType.AVERAGE,
                            MetricAggregationType.AVERAGE))
                .withSupportedTimeGrainTypes(Arrays.asList("uqfprwzw", "nguitnwuizgazxu"))
                .withInternalMetricName("zuckyfi")
                .withEnableRegionalMdmAccount(false)
                .withSourceMdmAccount("dfvzwdzuhty")
                .withSourceMdmNamespace("isdkfthwxmnteiw")
                .withDimensions(
                    Arrays
                        .asList(
                            new Dimension().withName("km").withDisplayName("c"),
                            new Dimension().withName("xdcu").withDisplayName("fsrpymzidnse"),
                            new Dimension().withName("xtbzsgfyccsne").withDisplayName("dwzjeiach"),
                            new Dimension().withName("osfln").withDisplayName("sfqpteehz")))
                .withAggregationType("ypyqrimzinp")
                .withFillGapWithZero(false)
                .withCategory("dkirsoodqxhcr")
                .withResourceIdDimensionNameOverride("ohjtckw")
                .withIsInternal(true);
        model = BinaryData.fromObject(model).toObject(MetricSpecification.class);
        Assertions.assertEquals("awrlyx", model.name());
        Assertions.assertEquals("kcprbnw", model.displayName());
        Assertions.assertEquals("gjvtbv", model.displayDescription());
        Assertions.assertEquals("sszdnru", model.unit());
        Assertions.assertEquals(MetricAggregationType.AVERAGE, model.supportedAggregationTypes().get(0));
        Assertions.assertEquals("uqfprwzw", model.supportedTimeGrainTypes().get(0));
        Assertions.assertEquals("zuckyfi", model.internalMetricName());
        Assertions.assertEquals(false, model.enableRegionalMdmAccount());
        Assertions.assertEquals("dfvzwdzuhty", model.sourceMdmAccount());
        Assertions.assertEquals("isdkfthwxmnteiw", model.sourceMdmNamespace());
        Assertions.assertEquals("km", model.dimensions().get(0).name());
        Assertions.assertEquals("c", model.dimensions().get(0).displayName());
        Assertions.assertEquals("ypyqrimzinp", model.aggregationType());
        Assertions.assertEquals(false, model.fillGapWithZero());
        Assertions.assertEquals("dkirsoodqxhcr", model.category());
        Assertions.assertEquals("ohjtckw", model.resourceIdDimensionNameOverride());
        Assertions.assertEquals(true, model.isInternal());
    }
}
