// 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.LogSpecification;
import com.azure.resourcemanager.netapp.models.MetricAggregationType;
import com.azure.resourcemanager.netapp.models.MetricSpecification;
import com.azure.resourcemanager.netapp.models.ServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ServiceSpecificationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServiceSpecification model =
            BinaryData
                .fromString(
                    "{\"metricSpecifications\":[{\"name\":\"lluwfzitonpeq\",\"displayName\":\"jkjlxofpdvhpfx\",\"displayDescription\":\"pini\",\"unit\":\"ayhuy\",\"supportedAggregationTypes\":[\"Average\",\"Average\"],\"supportedTimeGrainTypes\":[\"po\"],\"internalMetricName\":\"inuvamiheogn\",\"enableRegionalMdmAccount\":false,\"sourceMdmAccount\":\"xth\",\"sourceMdmNamespace\":\"tusivyevcciqihn\",\"dimensions\":[],\"aggregationType\":\"bwjzr\",\"fillGapWithZero\":true,\"category\":\"xgispemvtzfkufu\",\"resourceIdDimensionNameOverride\":\"jofxqe\",\"isInternal\":false},{\"name\":\"e\",\"displayName\":\"hqjbasvmsmj\",\"displayDescription\":\"lngsntnbybkzgcwr\",\"unit\":\"lxxwrljdouskc\",\"supportedAggregationTypes\":[\"Average\",\"Average\",\"Average\",\"Average\"],\"supportedTimeGrainTypes\":[\"kwt\"],\"internalMetricName\":\"xbnjbiksq\",\"enableRegionalMdmAccount\":false,\"sourceMdmAccount\":\"sainqpjwnzl\",\"sourceMdmNamespace\":\"fmppe\",\"dimensions\":[],\"aggregationType\":\"gxsabkyq\",\"fillGapWithZero\":false,\"category\":\"itcjczdz\",\"resourceIdDimensionNameOverride\":\"ndhkrw\",\"isInternal\":false},{\"name\":\"p\",\"displayName\":\"bdkvwrwjf\",\"displayDescription\":\"snhu\",\"unit\":\"eltmrldhugjzzdat\",\"supportedAggregationTypes\":[\"Average\",\"Average\"],\"supportedTimeGrainTypes\":[\"eablg\",\"huticndvkao\",\"wyiftyhxhur\",\"k\"],\"internalMetricName\":\"yxolniwp\",\"enableRegionalMdmAccount\":true,\"sourceMdmAccount\":\"jfkgiawxk\",\"sourceMdmNamespace\":\"ypl\",\"dimensions\":[],\"aggregationType\":\"asy\",\"fillGapWithZero\":true,\"category\":\"dhsgcba\",\"resourceIdDimensionNameOverride\":\"hejkotynqgou\",\"isInternal\":false},{\"name\":\"likwyqkgfgib\",\"displayName\":\"dgak\",\"displayDescription\":\"s\",\"unit\":\"yb\",\"supportedAggregationTypes\":[\"Average\",\"Average\",\"Average\",\"Average\"],\"supportedTimeGrainTypes\":[\"ciqfou\",\"lmmnkzsmodmglo\",\"gpbkwtmut\"],\"internalMetricName\":\"qktapspwgcuert\",\"enableRegionalMdmAccount\":false,\"sourceMdmAccount\":\"o\",\"sourceMdmNamespace\":\"qw\",\"dimensions\":[],\"aggregationType\":\"gbbjfddgmbmbe\",\"fillGapWithZero\":true,\"category\":\"htqqrolfp\",\"resourceIdDimensionNameOverride\":\"s\",\"isInternal\":false}],\"logSpecifications\":[{\"name\":\"xigjyjgzjaoyfhr\",\"displayName\":\"ilnerkujysvlejuv\"}]}")
                .toObject(ServiceSpecification.class);
        Assertions.assertEquals("lluwfzitonpeq", model.metricSpecifications().get(0).name());
        Assertions.assertEquals("jkjlxofpdvhpfx", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("pini", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("ayhuy", model.metricSpecifications().get(0).unit());
        Assertions
            .assertEquals(
                MetricAggregationType.AVERAGE, model.metricSpecifications().get(0).supportedAggregationTypes().get(0));
        Assertions.assertEquals("po", model.metricSpecifications().get(0).supportedTimeGrainTypes().get(0));
        Assertions.assertEquals("inuvamiheogn", model.metricSpecifications().get(0).internalMetricName());
        Assertions.assertEquals(false, model.metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("xth", model.metricSpecifications().get(0).sourceMdmAccount());
        Assertions.assertEquals("tusivyevcciqihn", model.metricSpecifications().get(0).sourceMdmNamespace());
        Assertions.assertEquals("bwjzr", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals(true, model.metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("xgispemvtzfkufu", model.metricSpecifications().get(0).category());
        Assertions.assertEquals("jofxqe", model.metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions.assertEquals(false, model.metricSpecifications().get(0).isInternal());
        Assertions.assertEquals("xigjyjgzjaoyfhr", model.logSpecifications().get(0).name());
        Assertions.assertEquals("ilnerkujysvlejuv", model.logSpecifications().get(0).displayName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServiceSpecification model =
            new ServiceSpecification()
                .withMetricSpecifications(
                    Arrays
                        .asList(
                            new MetricSpecification()
                                .withName("lluwfzitonpeq")
                                .withDisplayName("jkjlxofpdvhpfx")
                                .withDisplayDescription("pini")
                                .withUnit("ayhuy")
                                .withSupportedAggregationTypes(
                                    Arrays.asList(MetricAggregationType.AVERAGE, MetricAggregationType.AVERAGE))
                                .withSupportedTimeGrainTypes(Arrays.asList("po"))
                                .withInternalMetricName("inuvamiheogn")
                                .withEnableRegionalMdmAccount(false)
                                .withSourceMdmAccount("xth")
                                .withSourceMdmNamespace("tusivyevcciqihn")
                                .withDimensions(Arrays.asList())
                                .withAggregationType("bwjzr")
                                .withFillGapWithZero(true)
                                .withCategory("xgispemvtzfkufu")
                                .withResourceIdDimensionNameOverride("jofxqe")
                                .withIsInternal(false),
                            new MetricSpecification()
                                .withName("e")
                                .withDisplayName("hqjbasvmsmj")
                                .withDisplayDescription("lngsntnbybkzgcwr")
                                .withUnit("lxxwrljdouskc")
                                .withSupportedAggregationTypes(
                                    Arrays
                                        .asList(
                                            MetricAggregationType.AVERAGE,
                                            MetricAggregationType.AVERAGE,
                                            MetricAggregationType.AVERAGE,
                                            MetricAggregationType.AVERAGE))
                                .withSupportedTimeGrainTypes(Arrays.asList("kwt"))
                                .withInternalMetricName("xbnjbiksq")
                                .withEnableRegionalMdmAccount(false)
                                .withSourceMdmAccount("sainqpjwnzl")
                                .withSourceMdmNamespace("fmppe")
                                .withDimensions(Arrays.asList())
                                .withAggregationType("gxsabkyq")
                                .withFillGapWithZero(false)
                                .withCategory("itcjczdz")
                                .withResourceIdDimensionNameOverride("ndhkrw")
                                .withIsInternal(false),
                            new MetricSpecification()
                                .withName("p")
                                .withDisplayName("bdkvwrwjf")
                                .withDisplayDescription("snhu")
                                .withUnit("eltmrldhugjzzdat")
                                .withSupportedAggregationTypes(
                                    Arrays.asList(MetricAggregationType.AVERAGE, MetricAggregationType.AVERAGE))
                                .withSupportedTimeGrainTypes(Arrays.asList("eablg", "huticndvkao", "wyiftyhxhur", "k"))
                                .withInternalMetricName("yxolniwp")
                                .withEnableRegionalMdmAccount(true)
                                .withSourceMdmAccount("jfkgiawxk")
                                .withSourceMdmNamespace("ypl")
                                .withDimensions(Arrays.asList())
                                .withAggregationType("asy")
                                .withFillGapWithZero(true)
                                .withCategory("dhsgcba")
                                .withResourceIdDimensionNameOverride("hejkotynqgou")
                                .withIsInternal(false),
                            new MetricSpecification()
                                .withName("likwyqkgfgib")
                                .withDisplayName("dgak")
                                .withDisplayDescription("s")
                                .withUnit("yb")
                                .withSupportedAggregationTypes(
                                    Arrays
                                        .asList(
                                            MetricAggregationType.AVERAGE,
                                            MetricAggregationType.AVERAGE,
                                            MetricAggregationType.AVERAGE,
                                            MetricAggregationType.AVERAGE))
                                .withSupportedTimeGrainTypes(Arrays.asList("ciqfou", "lmmnkzsmodmglo", "gpbkwtmut"))
                                .withInternalMetricName("qktapspwgcuert")
                                .withEnableRegionalMdmAccount(false)
                                .withSourceMdmAccount("o")
                                .withSourceMdmNamespace("qw")
                                .withDimensions(Arrays.asList())
                                .withAggregationType("gbbjfddgmbmbe")
                                .withFillGapWithZero(true)
                                .withCategory("htqqrolfp")
                                .withResourceIdDimensionNameOverride("s")
                                .withIsInternal(false)))
                .withLogSpecifications(
                    Arrays
                        .asList(
                            new LogSpecification().withName("xigjyjgzjaoyfhr").withDisplayName("ilnerkujysvlejuv")));
        model = BinaryData.fromObject(model).toObject(ServiceSpecification.class);
        Assertions.assertEquals("lluwfzitonpeq", model.metricSpecifications().get(0).name());
        Assertions.assertEquals("jkjlxofpdvhpfx", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("pini", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("ayhuy", model.metricSpecifications().get(0).unit());
        Assertions
            .assertEquals(
                MetricAggregationType.AVERAGE, model.metricSpecifications().get(0).supportedAggregationTypes().get(0));
        Assertions.assertEquals("po", model.metricSpecifications().get(0).supportedTimeGrainTypes().get(0));
        Assertions.assertEquals("inuvamiheogn", model.metricSpecifications().get(0).internalMetricName());
        Assertions.assertEquals(false, model.metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("xth", model.metricSpecifications().get(0).sourceMdmAccount());
        Assertions.assertEquals("tusivyevcciqihn", model.metricSpecifications().get(0).sourceMdmNamespace());
        Assertions.assertEquals("bwjzr", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals(true, model.metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("xgispemvtzfkufu", model.metricSpecifications().get(0).category());
        Assertions.assertEquals("jofxqe", model.metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions.assertEquals(false, model.metricSpecifications().get(0).isInternal());
        Assertions.assertEquals("xigjyjgzjaoyfhr", model.logSpecifications().get(0).name());
        Assertions.assertEquals("ilnerkujysvlejuv", model.logSpecifications().get(0).displayName());
    }
}
