// 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.SeverityLevel;
import com.azure.resourcemanager.support.models.SupportTicketsListResult;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class SupportTicketsListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SupportTicketsListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"supportTicketId\":\"b\",\"description\":\"s\",\"problemClassificationId\":\"msmjqulngsntn\",\"problemClassificationDisplayName\":\"bkzgcwrwclx\",\"severity\":\"critical\",\"enrollmentId\":\"ljdousk\",\"require24X7Response\":true,\"supportPlanType\":\"rcjd\",\"title\":\"wtnhxbnjbiksqr\",\"problemStartTime\":\"2021-08-17T11:42:15Z\",\"serviceId\":\"sainqpjwnzl\",\"serviceDisplayName\":\"fmppe\",\"status\":\"vmgxsab\",\"createdDate\":\"2021-03-02T20:03:02Z\",\"modifiedDate\":\"2021-03-09T00:46:41Z\"},\"id\":\"itcjczdz\",\"name\":\"vndhkrwpdapp\",\"type\":\"sbdkvwr\"},{\"properties\":{\"supportTicketId\":\"eusnhutj\",\"description\":\"ltmrldh\",\"problemClassificationId\":\"gjzzdatqxhocdg\",\"problemClassificationDisplayName\":\"blgphuticn\",\"severity\":\"highestcriticalimpact\",\"enrollmentId\":\"aozwyiftyhxhu\",\"require24X7Response\":false,\"supportPlanType\":\"xolniwpwcukjfk\",\"title\":\"iawxklry\",\"problemStartTime\":\"2021-07-12T14:06:09Z\",\"serviceId\":\"ckbasyypndd\",\"serviceDisplayName\":\"gcbacphejkot\",\"status\":\"qgoulznd\",\"createdDate\":\"2021-06-21T08:22:40Z\",\"modifiedDate\":\"2021-09-19T22:30:16Z\"},\"id\":\"gfgibm\",\"name\":\"dgak\",\"type\":\"qsrxybzqqed\"},{\"properties\":{\"supportTicketId\":\"bciqfouflm\",\"description\":\"nkzsmodmglou\",\"problemClassificationId\":\"pbkwtmu\",\"problemClassificationDisplayName\":\"uqktap\",\"severity\":\"critical\",\"enrollmentId\":\"gcue\",\"require24X7Response\":true,\"supportPlanType\":\"o\",\"title\":\"vqwhbmdgbbjfd\",\"problemStartTime\":\"2021-09-14T17:27:38Z\",\"serviceId\":\"bmbexppbhtqqro\",\"serviceDisplayName\":\"p\",\"status\":\"s\",\"createdDate\":\"2021-11-03T08:28:15Z\",\"modifiedDate\":\"2021-02-03T23:40:53Z\"},\"id\":\"igjyjg\",\"name\":\"jaoyfhrtx\",\"type\":\"lnerkujysvleju\"}],\"nextLink\":\"qawrlyxwj\"}")
                .toObject(SupportTicketsListResult.class);
        Assertions.assertEquals("b", model.value().get(0).supportTicketId());
        Assertions.assertEquals("s", model.value().get(0).description());
        Assertions.assertEquals("msmjqulngsntn", model.value().get(0).problemClassificationId());
        Assertions.assertEquals(SeverityLevel.CRITICAL, model.value().get(0).severity());
        Assertions.assertEquals(true, model.value().get(0).require24X7Response());
        Assertions.assertEquals("wtnhxbnjbiksqr", model.value().get(0).title());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-17T11:42:15Z"), model.value().get(0).problemStartTime());
        Assertions.assertEquals("sainqpjwnzl", model.value().get(0).serviceId());
        Assertions.assertEquals("qawrlyxwj", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SupportTicketsListResult model =
            new SupportTicketsListResult()
                .withValue(
                    Arrays
                        .asList(
                            new SupportTicketDetailsInner()
                                .withSupportTicketId("b")
                                .withDescription("s")
                                .withProblemClassificationId("msmjqulngsntn")
                                .withSeverity(SeverityLevel.CRITICAL)
                                .withRequire24X7Response(true)
                                .withTitle("wtnhxbnjbiksqr")
                                .withProblemStartTime(OffsetDateTime.parse("2021-08-17T11:42:15Z"))
                                .withServiceId("sainqpjwnzl"),
                            new SupportTicketDetailsInner()
                                .withSupportTicketId("eusnhutj")
                                .withDescription("ltmrldh")
                                .withProblemClassificationId("gjzzdatqxhocdg")
                                .withSeverity(SeverityLevel.HIGHESTCRITICALIMPACT)
                                .withRequire24X7Response(false)
                                .withTitle("iawxklry")
                                .withProblemStartTime(OffsetDateTime.parse("2021-07-12T14:06:09Z"))
                                .withServiceId("ckbasyypndd"),
                            new SupportTicketDetailsInner()
                                .withSupportTicketId("bciqfouflm")
                                .withDescription("nkzsmodmglou")
                                .withProblemClassificationId("pbkwtmu")
                                .withSeverity(SeverityLevel.CRITICAL)
                                .withRequire24X7Response(true)
                                .withTitle("vqwhbmdgbbjfd")
                                .withProblemStartTime(OffsetDateTime.parse("2021-09-14T17:27:38Z"))
                                .withServiceId("bmbexppbhtqqro")))
                .withNextLink("qawrlyxwj");
        model = BinaryData.fromObject(model).toObject(SupportTicketsListResult.class);
        Assertions.assertEquals("b", model.value().get(0).supportTicketId());
        Assertions.assertEquals("s", model.value().get(0).description());
        Assertions.assertEquals("msmjqulngsntn", model.value().get(0).problemClassificationId());
        Assertions.assertEquals(SeverityLevel.CRITICAL, model.value().get(0).severity());
        Assertions.assertEquals(true, model.value().get(0).require24X7Response());
        Assertions.assertEquals("wtnhxbnjbiksqr", model.value().get(0).title());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-17T11:42:15Z"), model.value().get(0).problemStartTime());
        Assertions.assertEquals("sainqpjwnzl", model.value().get(0).serviceId());
        Assertions.assertEquals("qawrlyxwj", model.nextLink());
    }
}
