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

public final class OperationMetaMetricSpecificationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationMetaMetricSpecification model =
            BinaryData
                .fromString(
                    "{\"aggregationType\":\"xbf\",\"dimensions\":[{\"displayName\":\"eh\",\"name\":\"vecxgodebfqkk\",\"toBeExportedForCustomer\":false},{\"displayName\":\"ukgri\",\"name\":\"lzlfbxzpuz\",\"toBeExportedForCustomer\":true},{\"displayName\":\"pnq\",\"name\":\"hmgkbrpyy\",\"toBeExportedForCustomer\":true}],\"displayDescription\":\"nuqqkpikadrgvt\",\"displayName\":\"gnbuy\",\"enableRegionalMdmAccount\":\"ijggmebfsiar\",\"internalMetricName\":\"trcvpnazzmh\",\"name\":\"unmpxttd\",\"resourceIdDimensionNameOverride\":\"rbnlankxmyskp\",\"sourceMdmNamespace\":\"enbtkcxywny\",\"supportedAggregationTypes\":[\"synlqidybyxczfc\"],\"supportedTimeGrainTypes\":[\"axdbabph\",\"wrqlfktsthsuco\",\"mnyyazt\",\"bt\"],\"unit\":\"rq\"}")
                .toObject(OperationMetaMetricSpecification.class);
        Assertions.assertEquals("xbf", model.aggregationType());
        Assertions.assertEquals("eh", model.dimensions().get(0).displayName());
        Assertions.assertEquals("vecxgodebfqkk", model.dimensions().get(0).name());
        Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedForCustomer());
        Assertions.assertEquals("nuqqkpikadrgvt", model.displayDescription());
        Assertions.assertEquals("gnbuy", model.displayName());
        Assertions.assertEquals("ijggmebfsiar", model.enableRegionalMdmAccount());
        Assertions.assertEquals("trcvpnazzmh", model.internalMetricName());
        Assertions.assertEquals("unmpxttd", model.name());
        Assertions.assertEquals("rbnlankxmyskp", model.resourceIdDimensionNameOverride());
        Assertions.assertEquals("enbtkcxywny", model.sourceMdmNamespace());
        Assertions.assertEquals("synlqidybyxczfc", model.supportedAggregationTypes().get(0));
        Assertions.assertEquals("axdbabph", model.supportedTimeGrainTypes().get(0));
        Assertions.assertEquals("rq", model.unit());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationMetaMetricSpecification model =
            new OperationMetaMetricSpecification()
                .withAggregationType("xbf")
                .withDimensions(
                    Arrays
                        .asList(
                            new DimensionProperties()
                                .withDisplayName("eh")
                                .withName("vecxgodebfqkk")
                                .withToBeExportedForCustomer(false),
                            new DimensionProperties()
                                .withDisplayName("ukgri")
                                .withName("lzlfbxzpuz")
                                .withToBeExportedForCustomer(true),
                            new DimensionProperties()
                                .withDisplayName("pnq")
                                .withName("hmgkbrpyy")
                                .withToBeExportedForCustomer(true)))
                .withDisplayDescription("nuqqkpikadrgvt")
                .withDisplayName("gnbuy")
                .withEnableRegionalMdmAccount("ijggmebfsiar")
                .withInternalMetricName("trcvpnazzmh")
                .withName("unmpxttd")
                .withResourceIdDimensionNameOverride("rbnlankxmyskp")
                .withSourceMdmNamespace("enbtkcxywny")
                .withSupportedAggregationTypes(Arrays.asList("synlqidybyxczfc"))
                .withSupportedTimeGrainTypes(Arrays.asList("axdbabph", "wrqlfktsthsuco", "mnyyazt", "bt"))
                .withUnit("rq");
        model = BinaryData.fromObject(model).toObject(OperationMetaMetricSpecification.class);
        Assertions.assertEquals("xbf", model.aggregationType());
        Assertions.assertEquals("eh", model.dimensions().get(0).displayName());
        Assertions.assertEquals("vecxgodebfqkk", model.dimensions().get(0).name());
        Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedForCustomer());
        Assertions.assertEquals("nuqqkpikadrgvt", model.displayDescription());
        Assertions.assertEquals("gnbuy", model.displayName());
        Assertions.assertEquals("ijggmebfsiar", model.enableRegionalMdmAccount());
        Assertions.assertEquals("trcvpnazzmh", model.internalMetricName());
        Assertions.assertEquals("unmpxttd", model.name());
        Assertions.assertEquals("rbnlankxmyskp", model.resourceIdDimensionNameOverride());
        Assertions.assertEquals("enbtkcxywny", model.sourceMdmNamespace());
        Assertions.assertEquals("synlqidybyxczfc", model.supportedAggregationTypes().get(0));
        Assertions.assertEquals("axdbabph", model.supportedTimeGrainTypes().get(0));
        Assertions.assertEquals("rq", model.unit());
    }
}
