// 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.SupportTicketDetailsInner;
import com.azure.resourcemanager.support.models.ContactProfile;
import com.azure.resourcemanager.support.models.PreferredContactMethod;
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 SupportTicketDetailsInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SupportTicketDetailsInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"supportTicketId\":\"rbnwbxgjvtbvpy\",\"description\":\"szdnr\",\"problemClassificationId\":\"jq\",\"problemClassificationDisplayName\":\"hmuouqfprwzwbn\",\"severity\":\"moderate\",\"enrollmentId\":\"tnwu\",\"require24X7Response\":false,\"contactDetails\":{\"firstName\":\"a\",\"lastName\":\"x\",\"preferredContactMethod\":\"email\",\"primaryEmailAddress\":\"izuckyfihrfidfvz\",\"additionalEmailAddresses\":[\"uht\",\"mwisdkfthwxmnt\",\"i\",\"aop\"],\"phoneNumber\":\"mijcmmxdcufufs\",\"preferredTimeZone\":\"pymzidnsezcxtbzs\",\"country\":\"fycc\",\"preferredSupportLanguage\":\"newmdwzjeiachbo\"},\"serviceLevelAgreement\":{\"startTime\":\"2021-07-31T08:54:57Z\",\"expirationTime\":\"2021-10-26T17:11:13Z\",\"slaMinutes\":13730136},\"supportEngineer\":{\"emailAddress\":\"pteehzzv\"},\"supportPlanType\":\"yqrimzin\",\"title\":\"vswjdk\",\"problemStartTime\":\"2021-11-08T02:13:55Z\",\"serviceId\":\"oodqxhcrm\",\"serviceDisplayName\":\"hjtckwhd\",\"status\":\"ifiyipjxsqwpgrj\",\"createdDate\":\"2021-09-25T11:27:13Z\",\"modifiedDate\":\"2021-01-10T20:57:48Z\",\"technicalTicketDetails\":{\"resourceId\":\"xv\"},\"quotaTicketDetails\":{\"quotaChangeRequestSubType\":\"yxqabnmocpcyshur\",\"quotaChangeRequestVersion\":\"fblj\",\"quotaChangeRequests\":[]}},\"id\":\"btoqcjmkljavbqid\",\"name\":\"qajzyulpkudjkr\",\"type\":\"khbzhfepgzg\"}")
                .toObject(SupportTicketDetailsInner.class);
        Assertions.assertEquals("rbnwbxgjvtbvpy", model.supportTicketId());
        Assertions.assertEquals("szdnr", model.description());
        Assertions.assertEquals("jq", model.problemClassificationId());
        Assertions.assertEquals(SeverityLevel.MODERATE, model.severity());
        Assertions.assertEquals(false, model.require24X7Response());
        Assertions.assertEquals("a", model.contactDetails().firstName());
        Assertions.assertEquals("x", model.contactDetails().lastName());
        Assertions.assertEquals(PreferredContactMethod.EMAIL, model.contactDetails().preferredContactMethod());
        Assertions.assertEquals("izuckyfihrfidfvz", model.contactDetails().primaryEmailAddress());
        Assertions.assertEquals("uht", model.contactDetails().additionalEmailAddresses().get(0));
        Assertions.assertEquals("mijcmmxdcufufs", model.contactDetails().phoneNumber());
        Assertions.assertEquals("pymzidnsezcxtbzs", model.contactDetails().preferredTimeZone());
        Assertions.assertEquals("fycc", model.contactDetails().country());
        Assertions.assertEquals("newmdwzjeiachbo", model.contactDetails().preferredSupportLanguage());
        Assertions.assertEquals("vswjdk", model.title());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-08T02:13:55Z"), model.problemStartTime());
        Assertions.assertEquals("oodqxhcrm", model.serviceId());
        Assertions.assertEquals("xv", model.technicalTicketDetails().resourceId());
        Assertions.assertEquals("yxqabnmocpcyshur", model.quotaTicketDetails().quotaChangeRequestSubType());
        Assertions.assertEquals("fblj", model.quotaTicketDetails().quotaChangeRequestVersion());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SupportTicketDetailsInner model =
            new SupportTicketDetailsInner()
                .withSupportTicketId("rbnwbxgjvtbvpy")
                .withDescription("szdnr")
                .withProblemClassificationId("jq")
                .withSeverity(SeverityLevel.MODERATE)
                .withRequire24X7Response(false)
                .withContactDetails(
                    new ContactProfile()
                        .withFirstName("a")
                        .withLastName("x")
                        .withPreferredContactMethod(PreferredContactMethod.EMAIL)
                        .withPrimaryEmailAddress("izuckyfihrfidfvz")
                        .withAdditionalEmailAddresses(Arrays.asList("uht", "mwisdkfthwxmnt", "i", "aop"))
                        .withPhoneNumber("mijcmmxdcufufs")
                        .withPreferredTimeZone("pymzidnsezcxtbzs")
                        .withCountry("fycc")
                        .withPreferredSupportLanguage("newmdwzjeiachbo"))
                .withServiceLevelAgreement(new ServiceLevelAgreement())
                .withSupportEngineer(new SupportEngineer())
                .withTitle("vswjdk")
                .withProblemStartTime(OffsetDateTime.parse("2021-11-08T02:13:55Z"))
                .withServiceId("oodqxhcrm")
                .withTechnicalTicketDetails(new TechnicalTicketDetails().withResourceId("xv"))
                .withQuotaTicketDetails(
                    new QuotaTicketDetails()
                        .withQuotaChangeRequestSubType("yxqabnmocpcyshur")
                        .withQuotaChangeRequestVersion("fblj")
                        .withQuotaChangeRequests(Arrays.asList()));
        model = BinaryData.fromObject(model).toObject(SupportTicketDetailsInner.class);
        Assertions.assertEquals("rbnwbxgjvtbvpy", model.supportTicketId());
        Assertions.assertEquals("szdnr", model.description());
        Assertions.assertEquals("jq", model.problemClassificationId());
        Assertions.assertEquals(SeverityLevel.MODERATE, model.severity());
        Assertions.assertEquals(false, model.require24X7Response());
        Assertions.assertEquals("a", model.contactDetails().firstName());
        Assertions.assertEquals("x", model.contactDetails().lastName());
        Assertions.assertEquals(PreferredContactMethod.EMAIL, model.contactDetails().preferredContactMethod());
        Assertions.assertEquals("izuckyfihrfidfvz", model.contactDetails().primaryEmailAddress());
        Assertions.assertEquals("uht", model.contactDetails().additionalEmailAddresses().get(0));
        Assertions.assertEquals("mijcmmxdcufufs", model.contactDetails().phoneNumber());
        Assertions.assertEquals("pymzidnsezcxtbzs", model.contactDetails().preferredTimeZone());
        Assertions.assertEquals("fycc", model.contactDetails().country());
        Assertions.assertEquals("newmdwzjeiachbo", model.contactDetails().preferredSupportLanguage());
        Assertions.assertEquals("vswjdk", model.title());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-08T02:13:55Z"), model.problemStartTime());
        Assertions.assertEquals("oodqxhcrm", model.serviceId());
        Assertions.assertEquals("xv", model.technicalTicketDetails().resourceId());
        Assertions.assertEquals("yxqabnmocpcyshur", model.quotaTicketDetails().quotaChangeRequestSubType());
        Assertions.assertEquals("fblj", model.quotaTicketDetails().quotaChangeRequestVersion());
    }
}
