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

package com.azure.resourcemanager.support.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.support.fluent.models.SupportTicketDetailsProperties;
import com.azure.resourcemanager.support.models.ContactProfile;
import com.azure.resourcemanager.support.models.PreferredContactMethod;
import com.azure.resourcemanager.support.models.QuotaChangeRequest;
import com.azure.resourcemanager.support.models.QuotaTicketDetails;
import com.azure.resourcemanager.support.models.ServiceLevelAgreement;
import com.azure.resourcemanager.support.models.SeverityLevel;
import com.azure.resourcemanager.support.models.SupportEngineer;
import com.azure.resourcemanager.support.models.TechnicalTicketDetails;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class SupportTicketDetailsPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SupportTicketDetailsProperties model =
            BinaryData
                .fromString(
                    "{\"supportTicketId\":\"xzlocxscp\",\"description\":\"ierhhbcsglummaj\",\"problemClassificationId\":\"j\",\"problemClassificationDisplayName\":\"dxob\",\"severity\":\"critical\",\"enrollmentId\":\"xkqpxo\",\"require24X7Response\":true,\"contactDetails\":{\"firstName\":\"ionpimexg\",\"lastName\":\"txgcpodgmaajr\",\"preferredContactMethod\":\"phone\",\"primaryEmailAddress\":\"djwzrlov\",\"additionalEmailAddresses\":[\"whijcoejctbza\",\"s\",\"sycbkbfk\",\"ukdkexxppofmxa\"],\"phoneNumber\":\"fjpgddtocjjxhvp\",\"preferredTimeZone\":\"o\",\"country\":\"exhd\",\"preferredSupportLanguage\":\"xibqeojnx\"},\"serviceLevelAgreement\":{\"startTime\":\"2021-05-15T04:32:43Z\",\"expirationTime\":\"2021-02-11T07:14:49Z\",\"slaMinutes\":188265871},\"supportEngineer\":{\"emailAddress\":\"deicbtwnpzao\"},\"supportPlanType\":\"uhrhcffcyddgl\",\"title\":\"jthjqkwpyei\",\"problemStartTime\":\"2021-07-26T00:36:37Z\",\"serviceId\":\"qciwqvhkhixuigdt\",\"serviceDisplayName\":\"bob\",\"status\":\"ghmewuam\",\"createdDate\":\"2021-01-27T21:23:24Z\",\"modifiedDate\":\"2020-12-30T21:59:13Z\",\"technicalTicketDetails\":{\"resourceId\":\"vvtpgvdfgio\"},\"quotaTicketDetails\":{\"quotaChangeRequestSubType\":\"tutqxlngxlefgug\",\"quotaChangeRequestVersion\":\"krxd\",\"quotaChangeRequests\":[{\"region\":\"tthzrvqd\",\"payload\":\"bhj\"}]}}")
                .toObject(SupportTicketDetailsProperties.class);
        Assertions.assertEquals("xzlocxscp", model.supportTicketId());
        Assertions.assertEquals("ierhhbcsglummaj", model.description());
        Assertions.assertEquals("j", model.problemClassificationId());
        Assertions.assertEquals(SeverityLevel.CRITICAL, model.severity());
        Assertions.assertEquals(true, model.require24X7Response());
        Assertions.assertEquals("ionpimexg", model.contactDetails().firstName());
        Assertions.assertEquals("txgcpodgmaajr", model.contactDetails().lastName());
        Assertions.assertEquals(PreferredContactMethod.PHONE, model.contactDetails().preferredContactMethod());
        Assertions.assertEquals("djwzrlov", model.contactDetails().primaryEmailAddress());
        Assertions.assertEquals("whijcoejctbza", model.contactDetails().additionalEmailAddresses().get(0));
        Assertions.assertEquals("fjpgddtocjjxhvp", model.contactDetails().phoneNumber());
        Assertions.assertEquals("o", model.contactDetails().preferredTimeZone());
        Assertions.assertEquals("exhd", model.contactDetails().country());
        Assertions.assertEquals("xibqeojnx", model.contactDetails().preferredSupportLanguage());
        Assertions.assertEquals("jthjqkwpyei", model.title());
        Assertions.assertEquals(OffsetDateTime.parse("2021-07-26T00:36:37Z"), model.problemStartTime());
        Assertions.assertEquals("qciwqvhkhixuigdt", model.serviceId());
        Assertions.assertEquals("vvtpgvdfgio", model.technicalTicketDetails().resourceId());
        Assertions.assertEquals("tutqxlngxlefgug", model.quotaTicketDetails().quotaChangeRequestSubType());
        Assertions.assertEquals("krxd", model.quotaTicketDetails().quotaChangeRequestVersion());
        Assertions.assertEquals("tthzrvqd", model.quotaTicketDetails().quotaChangeRequests().get(0).region());
        Assertions.assertEquals("bhj", model.quotaTicketDetails().quotaChangeRequests().get(0).payload());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SupportTicketDetailsProperties model =
            new SupportTicketDetailsProperties()
                .withSupportTicketId("xzlocxscp")
                .withDescription("ierhhbcsglummaj")
                .withProblemClassificationId("j")
                .withSeverity(SeverityLevel.CRITICAL)
                .withRequire24X7Response(true)
                .withContactDetails(
                    new ContactProfile()
                        .withFirstName("ionpimexg")
                        .withLastName("txgcpodgmaajr")
                        .withPreferredContactMethod(PreferredContactMethod.PHONE)
                        .withPrimaryEmailAddress("djwzrlov")
                        .withAdditionalEmailAddresses(Arrays.asList("whijcoejctbza", "s", "sycbkbfk", "ukdkexxppofmxa"))
                        .withPhoneNumber("fjpgddtocjjxhvp")
                        .withPreferredTimeZone("o")
                        .withCountry("exhd")
                        .withPreferredSupportLanguage("xibqeojnx"))
                .withServiceLevelAgreement(new ServiceLevelAgreement())
                .withSupportEngineer(new SupportEngineer())
                .withTitle("jthjqkwpyei")
                .withProblemStartTime(OffsetDateTime.parse("2021-07-26T00:36:37Z"))
                .withServiceId("qciwqvhkhixuigdt")
                .withTechnicalTicketDetails(new TechnicalTicketDetails().withResourceId("vvtpgvdfgio"))
                .withQuotaTicketDetails(
                    new QuotaTicketDetails()
                        .withQuotaChangeRequestSubType("tutqxlngxlefgug")
                        .withQuotaChangeRequestVersion("krxd")
                        .withQuotaChangeRequests(
                            Arrays.asList(new QuotaChangeRequest().withRegion("tthzrvqd").withPayload("bhj"))));
        model = BinaryData.fromObject(model).toObject(SupportTicketDetailsProperties.class);
        Assertions.assertEquals("xzlocxscp", model.supportTicketId());
        Assertions.assertEquals("ierhhbcsglummaj", model.description());
        Assertions.assertEquals("j", model.problemClassificationId());
        Assertions.assertEquals(SeverityLevel.CRITICAL, model.severity());
        Assertions.assertEquals(true, model.require24X7Response());
        Assertions.assertEquals("ionpimexg", model.contactDetails().firstName());
        Assertions.assertEquals("txgcpodgmaajr", model.contactDetails().lastName());
        Assertions.assertEquals(PreferredContactMethod.PHONE, model.contactDetails().preferredContactMethod());
        Assertions.assertEquals("djwzrlov", model.contactDetails().primaryEmailAddress());
        Assertions.assertEquals("whijcoejctbza", model.contactDetails().additionalEmailAddresses().get(0));
        Assertions.assertEquals("fjpgddtocjjxhvp", model.contactDetails().phoneNumber());
        Assertions.assertEquals("o", model.contactDetails().preferredTimeZone());
        Assertions.assertEquals("exhd", model.contactDetails().country());
        Assertions.assertEquals("xibqeojnx", model.contactDetails().preferredSupportLanguage());
        Assertions.assertEquals("jthjqkwpyei", model.title());
        Assertions.assertEquals(OffsetDateTime.parse("2021-07-26T00:36:37Z"), model.problemStartTime());
        Assertions.assertEquals("qciwqvhkhixuigdt", model.serviceId());
        Assertions.assertEquals("vvtpgvdfgio", model.technicalTicketDetails().resourceId());
        Assertions.assertEquals("tutqxlngxlefgug", model.quotaTicketDetails().quotaChangeRequestSubType());
        Assertions.assertEquals("krxd", model.quotaTicketDetails().quotaChangeRequestVersion());
        Assertions.assertEquals("tthzrvqd", model.quotaTicketDetails().quotaChangeRequests().get(0).region());
        Assertions.assertEquals("bhj", model.quotaTicketDetails().quotaChangeRequests().get(0).payload());
    }
}
