// 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.fluent.models.OperationProperties;
import com.azure.resourcemanager.netapp.models.LogSpecification;
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 OperationPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationProperties model =
            BinaryData
                .fromString(
                    "{\"serviceSpecification\":{\"metricSpecifications\":[{\"name\":\"hdbihan\",\"displayName\":\"hfcbjysa\",\"displayDescription\":\"th\",\"unit\":\"hab\",\"supportedAggregationTypes\":[],\"supportedTimeGrainTypes\":[],\"internalMetricName\":\"kxwczbyscnpqxuhi\",\"enableRegionalMdmAccount\":true,\"sourceMdmAccount\":\"iwbybrkxvdumjg\",\"sourceMdmNamespace\":\"fwvuk\",\"dimensions\":[],\"aggregationType\":\"udccsnhsjc\",\"fillGapWithZero\":false,\"category\":\"hkryhtn\",\"resourceIdDimensionNameOverride\":\"czwlokjyem\",\"isInternal\":false},{\"name\":\"ipjoxzjnchgejs\",\"displayName\":\"dmailzydehojw\",\"displayDescription\":\"huxinpmqnj\",\"unit\":\"wixjsprozvcp\",\"supportedAggregationTypes\":[],\"supportedTimeGrainTypes\":[],\"internalMetricName\":\"jvwmfda\",\"enableRegionalMdmAccount\":false,\"sourceMdmAccount\":\"dvpjhulsuuvmk\",\"sourceMdmNamespace\":\"zkrwfn\",\"dimensions\":[],\"aggregationType\":\"djpslw\",\"fillGapWithZero\":true,\"category\":\"vwryoqpso\",\"resourceIdDimensionNameOverride\":\"ctazakljlahbcryf\",\"isInternal\":false}],\"logSpecifications\":[{\"name\":\"ygexpaojakhmsb\",\"displayName\":\"hcrzevd\"},{\"name\":\"lxaolthqtrgqjbp\",\"displayName\":\"fsinzgvfcjrwzoxx\"}]}}")
                .toObject(OperationProperties.class);
        Assertions.assertEquals("hdbihan", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions.assertEquals("hfcbjysa", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions.assertEquals("th", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("hab", model.serviceSpecification().metricSpecifications().get(0).unit());
        Assertions
            .assertEquals(
                "kxwczbyscnpqxuhi", model.serviceSpecification().metricSpecifications().get(0).internalMetricName());
        Assertions
            .assertEquals(true, model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions
            .assertEquals(
                "iwbybrkxvdumjg", model.serviceSpecification().metricSpecifications().get(0).sourceMdmAccount());
        Assertions
            .assertEquals("fwvuk", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace());
        Assertions
            .assertEquals("udccsnhsjc", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals(false, model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("hkryhtn", model.serviceSpecification().metricSpecifications().get(0).category());
        Assertions
            .assertEquals(
                "czwlokjyem",
                model.serviceSpecification().metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions.assertEquals(false, model.serviceSpecification().metricSpecifications().get(0).isInternal());
        Assertions.assertEquals("ygexpaojakhmsb", model.serviceSpecification().logSpecifications().get(0).name());
        Assertions.assertEquals("hcrzevd", model.serviceSpecification().logSpecifications().get(0).displayName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationProperties model =
            new OperationProperties()
                .withServiceSpecification(
                    new ServiceSpecification()
                        .withMetricSpecifications(
                            Arrays
                                .asList(
                                    new MetricSpecification()
                                        .withName("hdbihan")
                                        .withDisplayName("hfcbjysa")
                                        .withDisplayDescription("th")
                                        .withUnit("hab")
                                        .withSupportedAggregationTypes(Arrays.asList())
                                        .withSupportedTimeGrainTypes(Arrays.asList())
                                        .withInternalMetricName("kxwczbyscnpqxuhi")
                                        .withEnableRegionalMdmAccount(true)
                                        .withSourceMdmAccount("iwbybrkxvdumjg")
                                        .withSourceMdmNamespace("fwvuk")
                                        .withDimensions(Arrays.asList())
                                        .withAggregationType("udccsnhsjc")
                                        .withFillGapWithZero(false)
                                        .withCategory("hkryhtn")
                                        .withResourceIdDimensionNameOverride("czwlokjyem")
                                        .withIsInternal(false),
                                    new MetricSpecification()
                                        .withName("ipjoxzjnchgejs")
                                        .withDisplayName("dmailzydehojw")
                                        .withDisplayDescription("huxinpmqnj")
                                        .withUnit("wixjsprozvcp")
                                        .withSupportedAggregationTypes(Arrays.asList())
                                        .withSupportedTimeGrainTypes(Arrays.asList())
                                        .withInternalMetricName("jvwmfda")
                                        .withEnableRegionalMdmAccount(false)
                                        .withSourceMdmAccount("dvpjhulsuuvmk")
                                        .withSourceMdmNamespace("zkrwfn")
                                        .withDimensions(Arrays.asList())
                                        .withAggregationType("djpslw")
                                        .withFillGapWithZero(true)
                                        .withCategory("vwryoqpso")
                                        .withResourceIdDimensionNameOverride("ctazakljlahbcryf")
                                        .withIsInternal(false)))
                        .withLogSpecifications(
                            Arrays
                                .asList(
                                    new LogSpecification().withName("ygexpaojakhmsb").withDisplayName("hcrzevd"),
                                    new LogSpecification()
                                        .withName("lxaolthqtrgqjbp")
                                        .withDisplayName("fsinzgvfcjrwzoxx"))));
        model = BinaryData.fromObject(model).toObject(OperationProperties.class);
        Assertions.assertEquals("hdbihan", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions.assertEquals("hfcbjysa", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions.assertEquals("th", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions.assertEquals("hab", model.serviceSpecification().metricSpecifications().get(0).unit());
        Assertions
            .assertEquals(
                "kxwczbyscnpqxuhi", model.serviceSpecification().metricSpecifications().get(0).internalMetricName());
        Assertions
            .assertEquals(true, model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions
            .assertEquals(
                "iwbybrkxvdumjg", model.serviceSpecification().metricSpecifications().get(0).sourceMdmAccount());
        Assertions
            .assertEquals("fwvuk", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace());
        Assertions
            .assertEquals("udccsnhsjc", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions.assertEquals(false, model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero());
        Assertions.assertEquals("hkryhtn", model.serviceSpecification().metricSpecifications().get(0).category());
        Assertions
            .assertEquals(
                "czwlokjyem",
                model.serviceSpecification().metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions.assertEquals(false, model.serviceSpecification().metricSpecifications().get(0).isInternal());
        Assertions.assertEquals("ygexpaojakhmsb", model.serviceSpecification().logSpecifications().get(0).name());
        Assertions.assertEquals("hcrzevd", model.serviceSpecification().logSpecifications().get(0).displayName());
    }
}
