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

package com.azure.resourcemanager.mysqlflexibleserver.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mysqlflexibleserver.models.BackupAndExportRequest;
import com.azure.resourcemanager.mysqlflexibleserver.models.BackupFormat;
import com.azure.resourcemanager.mysqlflexibleserver.models.BackupSettings;
import com.azure.resourcemanager.mysqlflexibleserver.models.BackupStoreDetails;
import org.junit.jupiter.api.Assertions;

public final class BackupAndExportRequestTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        BackupAndExportRequest model =
            BinaryData
                .fromString(
                    "{\"targetDetails\":{\"objectType\":\"BackupStoreDetails\"},\"backupSettings\":{\"backupName\":\"ixjsprozvcputeg\",\"backupFormat\":\"CollatedFormat\"}}")
                .toObject(BackupAndExportRequest.class);
        Assertions.assertEquals("ixjsprozvcputeg", model.backupSettings().backupName());
        Assertions.assertEquals(BackupFormat.COLLATED_FORMAT, model.backupSettings().backupFormat());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        BackupAndExportRequest model =
            new BackupAndExportRequest()
                .withBackupSettings(
                    new BackupSettings()
                        .withBackupName("ixjsprozvcputeg")
                        .withBackupFormat(BackupFormat.COLLATED_FORMAT))
                .withTargetDetails(new BackupStoreDetails());
        model = BinaryData.fromObject(model).toObject(BackupAndExportRequest.class);
        Assertions.assertEquals("ixjsprozvcputeg", model.backupSettings().backupName());
        Assertions.assertEquals(BackupFormat.COLLATED_FORMAT, model.backupSettings().backupFormat());
    }
}
