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

package com.azure.resourcemanager.purview.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.purview.fluent.models.OperationProperties;
import com.azure.resourcemanager.purview.models.OperationMetaLogSpecification;
import com.azure.resourcemanager.purview.models.OperationMetaMetricSpecification;
import com.azure.resourcemanager.purview.models.OperationMetaServiceSpecification;
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\":[{\"blobDuration\":\"qjvsovmyokacs\",\"displayName\":\"w\",\"name\":\"zdobpxjmflbvvnch\"}],\"metricSpecifications\":[{\"aggregationType\":\"iwwzjuqk\",\"dimensions\":[],\"displayDescription\":\"ajiwkuo\",\"displayName\":\"skghsauuimj\",\"enableRegionalMdmAccount\":\"xieduugidyjrr\",\"internalMetricName\":\"y\",\"name\":\"svexcsonpclhoco\",\"resourceIdDimensionNameOverride\":\"lkevle\",\"sourceMdmNamespace\":\"zfbuhf\",\"supportedAggregationTypes\":[],\"supportedTimeGrainTypes\":[],\"unit\":\"x\"}]}}")
                .toObject(OperationProperties.class);
        Assertions
            .assertEquals("qjvsovmyokacs", model.serviceSpecification().logSpecifications().get(0).blobDuration());
        Assertions.assertEquals("w", model.serviceSpecification().logSpecifications().get(0).displayName());
        Assertions.assertEquals("zdobpxjmflbvvnch", model.serviceSpecification().logSpecifications().get(0).name());
        Assertions
            .assertEquals("iwwzjuqk", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions
            .assertEquals("ajiwkuo", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions
            .assertEquals("skghsauuimj", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions
            .assertEquals(
                "xieduugidyjrr", model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("y", model.serviceSpecification().metricSpecifications().get(0).internalMetricName());
        Assertions.assertEquals("svexcsonpclhoco", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions
            .assertEquals(
                "lkevle", model.serviceSpecification().metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions
            .assertEquals("zfbuhf", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace());
        Assertions.assertEquals("x", model.serviceSpecification().metricSpecifications().get(0).unit());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationProperties model =
            new OperationProperties()
                .withServiceSpecification(
                    new OperationMetaServiceSpecification()
                        .withLogSpecifications(
                            Arrays
                                .asList(
                                    new OperationMetaLogSpecification()
                                        .withBlobDuration("qjvsovmyokacs")
                                        .withDisplayName("w")
                                        .withName("zdobpxjmflbvvnch")))
                        .withMetricSpecifications(
                            Arrays
                                .asList(
                                    new OperationMetaMetricSpecification()
                                        .withAggregationType("iwwzjuqk")
                                        .withDimensions(Arrays.asList())
                                        .withDisplayDescription("ajiwkuo")
                                        .withDisplayName("skghsauuimj")
                                        .withEnableRegionalMdmAccount("xieduugidyjrr")
                                        .withInternalMetricName("y")
                                        .withName("svexcsonpclhoco")
                                        .withResourceIdDimensionNameOverride("lkevle")
                                        .withSourceMdmNamespace("zfbuhf")
                                        .withSupportedAggregationTypes(Arrays.asList())
                                        .withSupportedTimeGrainTypes(Arrays.asList())
                                        .withUnit("x"))));
        model = BinaryData.fromObject(model).toObject(OperationProperties.class);
        Assertions
            .assertEquals("qjvsovmyokacs", model.serviceSpecification().logSpecifications().get(0).blobDuration());
        Assertions.assertEquals("w", model.serviceSpecification().logSpecifications().get(0).displayName());
        Assertions.assertEquals("zdobpxjmflbvvnch", model.serviceSpecification().logSpecifications().get(0).name());
        Assertions
            .assertEquals("iwwzjuqk", model.serviceSpecification().metricSpecifications().get(0).aggregationType());
        Assertions
            .assertEquals("ajiwkuo", model.serviceSpecification().metricSpecifications().get(0).displayDescription());
        Assertions
            .assertEquals("skghsauuimj", model.serviceSpecification().metricSpecifications().get(0).displayName());
        Assertions
            .assertEquals(
                "xieduugidyjrr", model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount());
        Assertions.assertEquals("y", model.serviceSpecification().metricSpecifications().get(0).internalMetricName());
        Assertions.assertEquals("svexcsonpclhoco", model.serviceSpecification().metricSpecifications().get(0).name());
        Assertions
            .assertEquals(
                "lkevle", model.serviceSpecification().metricSpecifications().get(0).resourceIdDimensionNameOverride());
        Assertions
            .assertEquals("zfbuhf", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace());
        Assertions.assertEquals("x", model.serviceSpecification().metricSpecifications().get(0).unit());
    }
}
