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

public final class OperationPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationProperties model =
            BinaryData
                .fromString(
                    "{\"serviceSpecification\":{\"logSpecifications\":[{\"name\":\"dbihanufhfcbj\",\"displayName\":\"a\",\"blobDuration\":\"th\"},{\"name\":\"hab\",\"displayName\":\"pikxwczbyscnpqxu\",\"blobDuration\":\"vyq\"},{\"name\":\"wby\",\"displayName\":\"k\",\"blobDuration\":\"dumjgrtfwvuk\"}],\"metricSpecifications\":[{\"name\":\"dcc\",\"displayName\":\"h\",\"displayDescription\":\"cnyejhkryhtnapcz\",\"unit\":\"okjye\",\"category\":\"kvnipjoxz\",\"aggregationType\":\"chgejspodm\",\"supportedAggregationTypes\":[],\"supportedTimeGrainTypes\":[],\"fillGapWithZero\":false,\"dimensions\":[],\"enableRegionalMdmAccount\":\"h\",\"sourceMdmAccount\":\"wyahuxinpmqnja\",\"sourceMdmNamespace\":\"ixjsprozvcputeg\"},{\"name\":\"wmfdatscmdvpjhul\",\"displayName\":\"uvm\",\"displayDescription\":\"ozkrwfndiodjpslw\",\"unit\":\"dpvwryoqpsoaccta\",\"category\":\"kljla\",\"aggregationType\":\"cr\",\"supportedAggregationTypes\":[],\"supportedTimeGrainTypes\":[],\"fillGapWithZero\":false,\"dimensions\":[],\"enableRegionalMdmAccount\":\"sy\",\"sourceMdmAccount\":\"xpaojakhmsbz\",\"sourceMdmNamespace\":\"crzevdphlx\"},{\"name\":\"lthqtrgqjbp\",\"displayName\":\"fsinzgvfcjrwzoxx\",\"displayDescription\":\"felluwfzitonpe\",\"unit\":\"pjkjlxofpdv\",\"category\":\"fxxypininmayhuy\",\"aggregationType\":\"kpode\",\"supportedAggregationTypes\":[],\"supportedTimeGrainTypes\":[],\"fillGapWithZero\":true,\"dimensions\":[],\"enableRegionalMdmAccount\":\"vamih\",\"sourceMdmAccount\":\"gnarxzxtheo\",\"sourceMdmNamespace\":\"si\"}]}}")
                .toObject(OperationProperties.class);
        Assertions.assertEquals("dbihanufhfcbj", model.serviceSpecification().logSpecifications().get(0).name());
        Assertions.assertEquals("a", model.serviceSpecification().logSpecifications().get(0).displayName());
        Assertions.assertEquals("th", model.serviceSpecification().logSpecifications().get(0).blobDuration());
        Assertions.assertEquals("dcc", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions.assertEquals("h", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions
            .assertEquals(
                "cnyejhkryhtnapcz", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("okjye", model.serviceSpecification().metricSpecifications().get(0).unit());
        Assertions.assertEquals("kvnipjoxz", model.serviceSpecification().metricSpecifications().get(0).category());
        Assertions
            .assertEquals("chgejspodm", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals(false, model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero());
        Assertions
            .assertEquals("h", model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions
            .assertEquals(
                "wyahuxinpmqnja", model.serviceSpecification().metricSpecifications().get(0).sourceMdmAccount());
        Assertions
            .assertEquals(
                "ixjsprozvcputeg", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationProperties model =
            new OperationProperties()
                .withServiceSpecification(
                    new ServiceSpecification()
                        .withLogSpecifications(
                            Arrays
                                .asList(
                                    new LogSpecification()
                                        .withName("dbihanufhfcbj")
                                        .withDisplayName("a")
                                        .withBlobDuration("th"),
                                    new LogSpecification()
                                        .withName("hab")
                                        .withDisplayName("pikxwczbyscnpqxu")
                                        .withBlobDuration("vyq"),
                                    new LogSpecification()
                                        .withName("wby")
                                        .withDisplayName("k")
                                        .withBlobDuration("dumjgrtfwvuk")))
                        .withMetricSpecifications(
                            Arrays
                                .asList(
                                    new MetricSpecification()
                                        .withName("dcc")
                                        .withDisplayName("h")
                                        .withDisplayDescription("cnyejhkryhtnapcz")
                                        .withUnit("okjye")
                                        .withCategory("kvnipjoxz")
                                        .withAggregationType("chgejspodm")
                                        .withSupportedAggregationTypes(Arrays.asList())
                                        .withSupportedTimeGrainTypes(Arrays.asList())
                                        .withFillGapWithZero(false)
                                        .withDimensions(Arrays.asList())
                                        .withEnableRegionalMdmAccount("h")
                                        .withSourceMdmAccount("wyahuxinpmqnja")
                                        .withSourceMdmNamespace("ixjsprozvcputeg"),
                                    new MetricSpecification()
                                        .withName("wmfdatscmdvpjhul")
                                        .withDisplayName("uvm")
                                        .withDisplayDescription("ozkrwfndiodjpslw")
                                        .withUnit("dpvwryoqpsoaccta")
                                        .withCategory("kljla")
                                        .withAggregationType("cr")
                                        .withSupportedAggregationTypes(Arrays.asList())
                                        .withSupportedTimeGrainTypes(Arrays.asList())
                                        .withFillGapWithZero(false)
                                        .withDimensions(Arrays.asList())
                                        .withEnableRegionalMdmAccount("sy")
                                        .withSourceMdmAccount("xpaojakhmsbz")
                                        .withSourceMdmNamespace("crzevdphlx"),
                                    new MetricSpecification()
                                        .withName("lthqtrgqjbp")
                                        .withDisplayName("fsinzgvfcjrwzoxx")
                                        .withDisplayDescription("felluwfzitonpe")
                                        .withUnit("pjkjlxofpdv")
                                        .withCategory("fxxypininmayhuy")
                                        .withAggregationType("kpode")
                                        .withSupportedAggregationTypes(Arrays.asList())
                                        .withSupportedTimeGrainTypes(Arrays.asList())
                                        .withFillGapWithZero(true)
                                        .withDimensions(Arrays.asList())
                                        .withEnableRegionalMdmAccount("vamih")
                                        .withSourceMdmAccount("gnarxzxtheo")
                                        .withSourceMdmNamespace("si"))));
        model = BinaryData.fromObject(model).toObject(OperationProperties.class);
        Assertions.assertEquals("dbihanufhfcbj", model.serviceSpecification().logSpecifications().get(0).name());
        Assertions.assertEquals("a", model.serviceSpecification().logSpecifications().get(0).displayName());
        Assertions.assertEquals("th", model.serviceSpecification().logSpecifications().get(0).blobDuration());
        Assertions.assertEquals("dcc", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions.assertEquals("h", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions
            .assertEquals(
                "cnyejhkryhtnapcz", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("okjye", model.serviceSpecification().metricSpecifications().get(0).unit());
        Assertions.assertEquals("kvnipjoxz", model.serviceSpecification().metricSpecifications().get(0).category());
        Assertions
            .assertEquals("chgejspodm", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals(false, model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero());
        Assertions
            .assertEquals("h", model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions
            .assertEquals(
                "wyahuxinpmqnja", model.serviceSpecification().metricSpecifications().get(0).sourceMdmAccount());
        Assertions
            .assertEquals(
                "ixjsprozvcputeg", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace());
    }
}
