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

package com.azure.resourcemanager.resourcehealth.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner;
import com.azure.resourcemanager.resourcehealth.models.SeverityValues;
import com.azure.resourcemanager.resourcehealth.models.StageValues;
import com.azure.resourcemanager.resourcehealth.models.StatusActiveEvent;
import com.azure.resourcemanager.resourcehealth.models.StatusBanner;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class EmergingIssuesGetResultInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EmergingIssuesGetResultInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"refreshTimestamp\":\"2021-01-05T12:33:20Z\",\"statusBanners\":[{\"title\":\"mcdytdxwitxnrj\",\"message\":\"gqwgxhniskxfbkp\",\"cloud\":\"gklwn\",\"lastModifiedTime\":\"2021-09-10T01:27:47Z\"}],\"statusActiveEvents\":[{\"title\":\"uwhvylwzbtdhxujz\",\"description\":\"mpowuwpr\",\"trackingId\":\"lve\",\"startTime\":\"2021-01-24T13:59:26Z\",\"cloud\":\"pjmkhfxobbc\",\"severity\":\"Warning\",\"stage\":\"Active\",\"published\":true,\"lastModifiedTime\":\"2021-04-01T12:50:08Z\",\"impacts\":[]},{\"title\":\"bpbewtghfgb\",\"description\":\"gw\",\"trackingId\":\"vlvqhjkbegi\",\"startTime\":\"2021-03-26T15:32:51Z\",\"cloud\":\"xiebwwaloayqcg\",\"severity\":\"Warning\",\"stage\":\"Active\",\"published\":false,\"lastModifiedTime\":\"2021-08-18T20:27:18Z\",\"impacts\":[]},{\"title\":\"mhtxongmtsavjcb\",\"description\":\"xqpsrknftguv\",\"trackingId\":\"uhprwmdyvxqt\",\"startTime\":\"2021-09-21T09:24:54Z\",\"cloud\":\"ww\",\"severity\":\"Error\",\"stage\":\"Active\",\"published\":true,\"lastModifiedTime\":\"2021-06-25T11:51:15Z\",\"impacts\":[]},{\"title\":\"ibycno\",\"description\":\"knme\",\"trackingId\":\"sgzvahapjyzhpv\",\"startTime\":\"2021-11-12T18:49:52Z\",\"cloud\":\"j\",\"severity\":\"Information\",\"stage\":\"Archived\",\"published\":true,\"lastModifiedTime\":\"2021-11-01T21:36:12Z\",\"impacts\":[]}]},\"id\":\"kvugfhzovawjvzun\",\"name\":\"uthnnprnxipeilpj\",\"type\":\"uaejxdultsk\"}")
                .toObject(EmergingIssuesGetResultInner.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-05T12:33:20Z"), model.refreshTimestamp());
        Assertions.assertEquals("mcdytdxwitxnrj", model.statusBanners().get(0).title());
        Assertions.assertEquals("gqwgxhniskxfbkp", model.statusBanners().get(0).message());
        Assertions.assertEquals("gklwn", model.statusBanners().get(0).cloud());
        Assertions
            .assertEquals(
                OffsetDateTime.parse("2021-09-10T01:27:47Z"), model.statusBanners().get(0).lastModifiedTime());
        Assertions.assertEquals("uwhvylwzbtdhxujz", model.statusActiveEvents().get(0).title());
        Assertions.assertEquals("mpowuwpr", model.statusActiveEvents().get(0).description());
        Assertions.assertEquals("lve", model.statusActiveEvents().get(0).trackingId());
        Assertions
            .assertEquals(OffsetDateTime.parse("2021-01-24T13:59:26Z"), model.statusActiveEvents().get(0).startTime());
        Assertions.assertEquals("pjmkhfxobbc", model.statusActiveEvents().get(0).cloud());
        Assertions.assertEquals(SeverityValues.WARNING, model.statusActiveEvents().get(0).severity());
        Assertions.assertEquals(StageValues.ACTIVE, model.statusActiveEvents().get(0).stage());
        Assertions.assertEquals(true, model.statusActiveEvents().get(0).published());
        Assertions
            .assertEquals(
                OffsetDateTime.parse("2021-04-01T12:50:08Z"), model.statusActiveEvents().get(0).lastModifiedTime());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EmergingIssuesGetResultInner model =
            new EmergingIssuesGetResultInner()
                .withRefreshTimestamp(OffsetDateTime.parse("2021-01-05T12:33:20Z"))
                .withStatusBanners(
                    Arrays
                        .asList(
                            new StatusBanner()
                                .withTitle("mcdytdxwitxnrj")
                                .withMessage("gqwgxhniskxfbkp")
                                .withCloud("gklwn")
                                .withLastModifiedTime(OffsetDateTime.parse("2021-09-10T01:27:47Z"))))
                .withStatusActiveEvents(
                    Arrays
                        .asList(
                            new StatusActiveEvent()
                                .withTitle("uwhvylwzbtdhxujz")
                                .withDescription("mpowuwpr")
                                .withTrackingId("lve")
                                .withStartTime(OffsetDateTime.parse("2021-01-24T13:59:26Z"))
                                .withCloud("pjmkhfxobbc")
                                .withSeverity(SeverityValues.WARNING)
                                .withStage(StageValues.ACTIVE)
                                .withPublished(true)
                                .withLastModifiedTime(OffsetDateTime.parse("2021-04-01T12:50:08Z"))
                                .withImpacts(Arrays.asList()),
                            new StatusActiveEvent()
                                .withTitle("bpbewtghfgb")
                                .withDescription("gw")
                                .withTrackingId("vlvqhjkbegi")
                                .withStartTime(OffsetDateTime.parse("2021-03-26T15:32:51Z"))
                                .withCloud("xiebwwaloayqcg")
                                .withSeverity(SeverityValues.WARNING)
                                .withStage(StageValues.ACTIVE)
                                .withPublished(false)
                                .withLastModifiedTime(OffsetDateTime.parse("2021-08-18T20:27:18Z"))
                                .withImpacts(Arrays.asList()),
                            new StatusActiveEvent()
                                .withTitle("mhtxongmtsavjcb")
                                .withDescription("xqpsrknftguv")
                                .withTrackingId("uhprwmdyvxqt")
                                .withStartTime(OffsetDateTime.parse("2021-09-21T09:24:54Z"))
                                .withCloud("ww")
                                .withSeverity(SeverityValues.ERROR)
                                .withStage(StageValues.ACTIVE)
                                .withPublished(true)
                                .withLastModifiedTime(OffsetDateTime.parse("2021-06-25T11:51:15Z"))
                                .withImpacts(Arrays.asList()),
                            new StatusActiveEvent()
                                .withTitle("ibycno")
                                .withDescription("knme")
                                .withTrackingId("sgzvahapjyzhpv")
                                .withStartTime(OffsetDateTime.parse("2021-11-12T18:49:52Z"))
                                .withCloud("j")
                                .withSeverity(SeverityValues.INFORMATION)
                                .withStage(StageValues.ARCHIVED)
                                .withPublished(true)
                                .withLastModifiedTime(OffsetDateTime.parse("2021-11-01T21:36:12Z"))
                                .withImpacts(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(EmergingIssuesGetResultInner.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-05T12:33:20Z"), model.refreshTimestamp());
        Assertions.assertEquals("mcdytdxwitxnrj", model.statusBanners().get(0).title());
        Assertions.assertEquals("gqwgxhniskxfbkp", model.statusBanners().get(0).message());
        Assertions.assertEquals("gklwn", model.statusBanners().get(0).cloud());
        Assertions
            .assertEquals(
                OffsetDateTime.parse("2021-09-10T01:27:47Z"), model.statusBanners().get(0).lastModifiedTime());
        Assertions.assertEquals("uwhvylwzbtdhxujz", model.statusActiveEvents().get(0).title());
        Assertions.assertEquals("mpowuwpr", model.statusActiveEvents().get(0).description());
        Assertions.assertEquals("lve", model.statusActiveEvents().get(0).trackingId());
        Assertions
            .assertEquals(OffsetDateTime.parse("2021-01-24T13:59:26Z"), model.statusActiveEvents().get(0).startTime());
        Assertions.assertEquals("pjmkhfxobbc", model.statusActiveEvents().get(0).cloud());
        Assertions.assertEquals(SeverityValues.WARNING, model.statusActiveEvents().get(0).severity());
        Assertions.assertEquals(StageValues.ACTIVE, model.statusActiveEvents().get(0).stage());
        Assertions.assertEquals(true, model.statusActiveEvents().get(0).published());
        Assertions
            .assertEquals(
                OffsetDateTime.parse("2021-04-01T12:50:08Z"), model.statusActiveEvents().get(0).lastModifiedTime());
    }
}
