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

package com.azure.resourcemanager.mariadb.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mariadb.fluent.models.PerformanceTierPropertiesInner;
import com.azure.resourcemanager.mariadb.models.PerformanceTierServiceLevelObjectives;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PerformanceTierPropertiesInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PerformanceTierPropertiesInner model =
            BinaryData
                .fromString(
                    "{\"id\":\"hqyudxorrqnbpoc\",\"maxBackupRetentionDays\":2085551487,\"minBackupRetentionDays\":2041227856,\"maxStorageMB\":688230720,\"minLargeStorageMB\":1661944066,\"maxLargeStorageMB\":983918139,\"minStorageMB\":1045892554,\"serviceLevelObjectives\":[{\"id\":\"mvvd\",\"edition\":\"atkpnp\",\"vCore\":63177450,\"hardwareGeneration\":\"xbczwtruwiqz\",\"maxBackupRetentionDays\":124611793,\"minBackupRetentionDays\":1378529430,\"maxStorageMB\":863677105,\"minStorageMB\":79438477}]}")
                .toObject(PerformanceTierPropertiesInner.class);
        Assertions.assertEquals("hqyudxorrqnbpoc", model.id());
        Assertions.assertEquals(2085551487, model.maxBackupRetentionDays());
        Assertions.assertEquals(2041227856, model.minBackupRetentionDays());
        Assertions.assertEquals(688230720, model.maxStorageMB());
        Assertions.assertEquals(1661944066, model.minLargeStorageMB());
        Assertions.assertEquals(983918139, model.maxLargeStorageMB());
        Assertions.assertEquals(1045892554, model.minStorageMB());
        Assertions.assertEquals("mvvd", model.serviceLevelObjectives().get(0).id());
        Assertions.assertEquals("atkpnp", model.serviceLevelObjectives().get(0).edition());
        Assertions.assertEquals(63177450, model.serviceLevelObjectives().get(0).vCore());
        Assertions.assertEquals("xbczwtruwiqz", model.serviceLevelObjectives().get(0).hardwareGeneration());
        Assertions.assertEquals(124611793, model.serviceLevelObjectives().get(0).maxBackupRetentionDays());
        Assertions.assertEquals(1378529430, model.serviceLevelObjectives().get(0).minBackupRetentionDays());
        Assertions.assertEquals(863677105, model.serviceLevelObjectives().get(0).maxStorageMB());
        Assertions.assertEquals(79438477, model.serviceLevelObjectives().get(0).minStorageMB());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PerformanceTierPropertiesInner model =
            new PerformanceTierPropertiesInner()
                .withId("hqyudxorrqnbpoc")
                .withMaxBackupRetentionDays(2085551487)
                .withMinBackupRetentionDays(2041227856)
                .withMaxStorageMB(688230720)
                .withMinLargeStorageMB(1661944066)
                .withMaxLargeStorageMB(983918139)
                .withMinStorageMB(1045892554)
                .withServiceLevelObjectives(
                    Arrays
                        .asList(
                            new PerformanceTierServiceLevelObjectives()
                                .withId("mvvd")
                                .withEdition("atkpnp")
                                .withVCore(63177450)
                                .withHardwareGeneration("xbczwtruwiqz")
                                .withMaxBackupRetentionDays(124611793)
                                .withMinBackupRetentionDays(1378529430)
                                .withMaxStorageMB(863677105)
                                .withMinStorageMB(79438477)));
        model = BinaryData.fromObject(model).toObject(PerformanceTierPropertiesInner.class);
        Assertions.assertEquals("hqyudxorrqnbpoc", model.id());
        Assertions.assertEquals(2085551487, model.maxBackupRetentionDays());
        Assertions.assertEquals(2041227856, model.minBackupRetentionDays());
        Assertions.assertEquals(688230720, model.maxStorageMB());
        Assertions.assertEquals(1661944066, model.minLargeStorageMB());
        Assertions.assertEquals(983918139, model.maxLargeStorageMB());
        Assertions.assertEquals(1045892554, model.minStorageMB());
        Assertions.assertEquals("mvvd", model.serviceLevelObjectives().get(0).id());
        Assertions.assertEquals("atkpnp", model.serviceLevelObjectives().get(0).edition());
        Assertions.assertEquals(63177450, model.serviceLevelObjectives().get(0).vCore());
        Assertions.assertEquals("xbczwtruwiqz", model.serviceLevelObjectives().get(0).hardwareGeneration());
        Assertions.assertEquals(124611793, model.serviceLevelObjectives().get(0).maxBackupRetentionDays());
        Assertions.assertEquals(1378529430, model.serviceLevelObjectives().get(0).minBackupRetentionDays());
        Assertions.assertEquals(863677105, model.serviceLevelObjectives().get(0).maxStorageMB());
        Assertions.assertEquals(79438477, model.serviceLevelObjectives().get(0).minStorageMB());
    }
}
