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

package com.azure.resourcemanager.databox.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.databox.models.ContactDetails;
import com.azure.resourcemanager.databox.models.NotificationPreference;
import com.azure.resourcemanager.databox.models.NotificationStageName;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ContactDetailsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ContactDetails model =
            BinaryData
                .fromString(
                    "{\"contactName\":\"kwh\",\"phone\":\"soifiyipjxsqw\",\"phoneExtension\":\"rjb\",\"mobile\":\"orcjxvsnby\",\"emailList\":[\"abnmocpcyshu\",\"zafb\"],\"notificationPreference\":[{\"stageName\":\"DataCopy\",\"sendNotification\":true}]}")
                .toObject(ContactDetails.class);
        Assertions.assertEquals("kwh", model.contactName());
        Assertions.assertEquals("soifiyipjxsqw", model.phone());
        Assertions.assertEquals("rjb", model.phoneExtension());
        Assertions.assertEquals("orcjxvsnby", model.mobile());
        Assertions.assertEquals("abnmocpcyshu", model.emailList().get(0));
        Assertions.assertEquals(NotificationStageName.DATA_COPY, model.notificationPreference().get(0).stageName());
        Assertions.assertEquals(true, model.notificationPreference().get(0).sendNotification());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ContactDetails model =
            new ContactDetails()
                .withContactName("kwh")
                .withPhone("soifiyipjxsqw")
                .withPhoneExtension("rjb")
                .withMobile("orcjxvsnby")
                .withEmailList(Arrays.asList("abnmocpcyshu", "zafb"))
                .withNotificationPreference(
                    Arrays
                        .asList(
                            new NotificationPreference()
                                .withStageName(NotificationStageName.DATA_COPY)
                                .withSendNotification(true)));
        model = BinaryData.fromObject(model).toObject(ContactDetails.class);
        Assertions.assertEquals("kwh", model.contactName());
        Assertions.assertEquals("soifiyipjxsqw", model.phone());
        Assertions.assertEquals("rjb", model.phoneExtension());
        Assertions.assertEquals("orcjxvsnby", model.mobile());
        Assertions.assertEquals("abnmocpcyshu", model.emailList().get(0));
        Assertions.assertEquals(NotificationStageName.DATA_COPY, model.notificationPreference().get(0).stageName());
        Assertions.assertEquals(true, model.notificationPreference().get(0).sendNotification());
    }
}
