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

package com.azure.resourcemanager.avs.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.avs.models.LogSpecification;
import com.azure.resourcemanager.avs.models.MetricSpecification;
import com.azure.resourcemanager.avs.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(
                    "{\"logSpecifications\":[{\"name\":\"cciqihnhungbwjz\",\"displayName\":\"fygxgispemvtzfk\",\"blobDuration\":\"ubljofxqe\"},{\"name\":\"jaeq\",\"displayName\":\"qjbasvms\",\"blobDuration\":\"qulngsntnbybkzgc\"},{\"name\":\"wclxxwrl\",\"displayName\":\"ouskcqvkocrc\",\"blobDuration\":\"kwt\"}],\"metricSpecifications\":[{\"name\":\"njbiksqrglssain\",\"displayName\":\"jwnzlljfmp\",\"displayDescription\":\"ebvmgxsabkyqd\",\"unit\":\"jitcjczdzevn\",\"category\":\"krwpdap\",\"aggregationType\":\"sbdkvwr\",\"supportedAggregationTypes\":[\"eusnhutj\",\"ltmrldh\"],\"supportedTimeGrainTypes\":[\"zzd\"],\"fillGapWithZero\":true,\"dimensions\":[],\"enableRegionalMdmAccount\":\"cdgea\",\"sourceMdmAccount\":\"gphuticndvka\",\"sourceMdmNamespace\":\"wyiftyhxhur\"},{\"name\":\"ftyxolniw\",\"displayName\":\"cukjf\",\"displayDescription\":\"iawxklry\",\"unit\":\"wckbasyypnd\",\"category\":\"sgcbac\",\"aggregationType\":\"ejk\",\"supportedAggregationTypes\":[\"nqgoulzndli\",\"wyqkgfgibm\",\"dgak\",\"qsrxybzqqed\"],\"supportedTimeGrainTypes\":[\"bciqfouflm\",\"nkzsmodmglou\",\"pbkwtmu\"],\"fillGapWithZero\":false,\"dimensions\":[],\"enableRegionalMdmAccount\":\"ap\",\"sourceMdmAccount\":\"wgcu\",\"sourceMdmNamespace\":\"tumkdosvqwhbm\"},{\"name\":\"bbjfddgmbmbexp\",\"displayName\":\"htqqrolfp\",\"displayDescription\":\"s\",\"unit\":\"gbquxigj\",\"category\":\"gzjaoyfhrtxilne\",\"aggregationType\":\"ujysvle\",\"supportedAggregationTypes\":[\"fqawrlyxw\",\"kcprbnw\",\"xgjvtbv\",\"ysszdnrujqguh\"],\"supportedTimeGrainTypes\":[\"uqfprwzw\",\"nguitnwuizgazxu\"],\"fillGapWithZero\":false,\"dimensions\":[],\"enableRegionalMdmAccount\":\"y\",\"sourceMdmAccount\":\"hr\",\"sourceMdmNamespace\":\"dfvzwdzuhty\"}]}")
                .toObject(ServiceSpecification.class);
        Assertions.assertEquals("cciqihnhungbwjz", model.logSpecifications().get(0).name());
        Assertions.assertEquals("fygxgispemvtzfk", model.logSpecifications().get(0).displayName());
        Assertions.assertEquals("ubljofxqe", model.logSpecifications().get(0).blobDuration());
        Assertions.assertEquals("njbiksqrglssain", model.metricSpecifications().get(0).name());
        Assertions.assertEquals("jwnzlljfmp", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("ebvmgxsabkyqd", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("jitcjczdzevn", model.metricSpecifications().get(0).unit());
        Assertions.assertEquals("krwpdap", model.metricSpecifications().get(0).category());
        Assertions.assertEquals("sbdkvwr", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("eusnhutj", model.metricSpecifications().get(0).supportedAggregationTypes().get(0));
        Assertions.assertEquals("zzd", model.metricSpecifications().get(0).supportedTimeGrainTypes().get(0));
        Assertions.assertEquals(true, model.metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("cdgea", model.metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("gphuticndvka", model.metricSpecifications().get(0).sourceMdmAccount());
        Assertions.assertEquals("wyiftyhxhur", model.metricSpecifications().get(0).sourceMdmNamespace());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServiceSpecification model =
            new ServiceSpecification()
                .withLogSpecifications(
                    Arrays
                        .asList(
                            new LogSpecification()
                                .withName("cciqihnhungbwjz")
                                .withDisplayName("fygxgispemvtzfk")
                                .withBlobDuration("ubljofxqe"),
                            new LogSpecification()
                                .withName("jaeq")
                                .withDisplayName("qjbasvms")
                                .withBlobDuration("qulngsntnbybkzgc"),
                            new LogSpecification()
                                .withName("wclxxwrl")
                                .withDisplayName("ouskcqvkocrc")
                                .withBlobDuration("kwt")))
                .withMetricSpecifications(
                    Arrays
                        .asList(
                            new MetricSpecification()
                                .withName("njbiksqrglssain")
                                .withDisplayName("jwnzlljfmp")
                                .withDisplayDescription("ebvmgxsabkyqd")
                                .withUnit("jitcjczdzevn")
                                .withCategory("krwpdap")
                                .withAggregationType("sbdkvwr")
                                .withSupportedAggregationTypes(Arrays.asList("eusnhutj", "ltmrldh"))
                                .withSupportedTimeGrainTypes(Arrays.asList("zzd"))
                                .withFillGapWithZero(true)
                                .withDimensions(Arrays.asList())
                                .withEnableRegionalMdmAccount("cdgea")
                                .withSourceMdmAccount("gphuticndvka")
                                .withSourceMdmNamespace("wyiftyhxhur"),
                            new MetricSpecification()
                                .withName("ftyxolniw")
                                .withDisplayName("cukjf")
                                .withDisplayDescription("iawxklry")
                                .withUnit("wckbasyypnd")
                                .withCategory("sgcbac")
                                .withAggregationType("ejk")
                                .withSupportedAggregationTypes(
                                    Arrays.asList("nqgoulzndli", "wyqkgfgibm", "dgak", "qsrxybzqqed"))
                                .withSupportedTimeGrainTypes(Arrays.asList("bciqfouflm", "nkzsmodmglou", "pbkwtmu"))
                                .withFillGapWithZero(false)
                                .withDimensions(Arrays.asList())
                                .withEnableRegionalMdmAccount("ap")
                                .withSourceMdmAccount("wgcu")
                                .withSourceMdmNamespace("tumkdosvqwhbm"),
                            new MetricSpecification()
                                .withName("bbjfddgmbmbexp")
                                .withDisplayName("htqqrolfp")
                                .withDisplayDescription("s")
                                .withUnit("gbquxigj")
                                .withCategory("gzjaoyfhrtxilne")
                                .withAggregationType("ujysvle")
                                .withSupportedAggregationTypes(
                                    Arrays.asList("fqawrlyxw", "kcprbnw", "xgjvtbv", "ysszdnrujqguh"))
                                .withSupportedTimeGrainTypes(Arrays.asList("uqfprwzw", "nguitnwuizgazxu"))
                                .withFillGapWithZero(false)
                                .withDimensions(Arrays.asList())
                                .withEnableRegionalMdmAccount("y")
                                .withSourceMdmAccount("hr")
                                .withSourceMdmNamespace("dfvzwdzuhty")));
        model = BinaryData.fromObject(model).toObject(ServiceSpecification.class);
        Assertions.assertEquals("cciqihnhungbwjz", model.logSpecifications().get(0).name());
        Assertions.assertEquals("fygxgispemvtzfk", model.logSpecifications().get(0).displayName());
        Assertions.assertEquals("ubljofxqe", model.logSpecifications().get(0).blobDuration());
        Assertions.assertEquals("njbiksqrglssain", model.metricSpecifications().get(0).name());
        Assertions.assertEquals("jwnzlljfmp", model.metricSpecifications().get(0).displayName());
        Assertions.assertEquals("ebvmgxsabkyqd", model.metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("jitcjczdzevn", model.metricSpecifications().get(0).unit());
        Assertions.assertEquals("krwpdap", model.metricSpecifications().get(0).category());
        Assertions.assertEquals("sbdkvwr", model.metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals("eusnhutj", model.metricSpecifications().get(0).supportedAggregationTypes().get(0));
        Assertions.assertEquals("zzd", model.metricSpecifications().get(0).supportedTimeGrainTypes().get(0));
        Assertions.assertEquals(true, model.metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("cdgea", model.metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("gphuticndvka", model.metricSpecifications().get(0).sourceMdmAccount());
        Assertions.assertEquals("wyiftyhxhur", model.metricSpecifications().get(0).sourceMdmNamespace());
    }
}
