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

package com.azure.resourcemanager.costmanagement.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.costmanagement.models.AlertCategory;
import com.azure.resourcemanager.costmanagement.models.AlertCriteria;
import com.azure.resourcemanager.costmanagement.models.AlertOperator;
import com.azure.resourcemanager.costmanagement.models.AlertPropertiesDefinition;
import com.azure.resourcemanager.costmanagement.models.AlertPropertiesDetails;
import com.azure.resourcemanager.costmanagement.models.AlertSource;
import com.azure.resourcemanager.costmanagement.models.AlertStatus;
import com.azure.resourcemanager.costmanagement.models.AlertTimeGrainType;
import com.azure.resourcemanager.costmanagement.models.AlertType;
import com.azure.resourcemanager.costmanagement.models.DismissAlertPayload;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DismissAlertPayloadTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DismissAlertPayload model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"definition\":{\"type\":\"Budget\",\"category\":\"Cost\",\"criteria\":\"CreditThresholdReached\"},\"description\":\"fnljky\",\"source\":\"Preset\",\"details\":{\"timeGrainType\":\"BillingMonth\",\"periodStartDate\":\"qgidokgjljyo\",\"triggeredBy\":\"vcltbgsncgh\",\"resourceGroupFilter\":[\"dataszzhbijhtxfvgxbf\"],\"resourceFilter\":[\"datanehmpvecx\",\"dataodebfqkkrbmpu\",\"datagr\"],\"meterFilter\":[\"datalzlfbxzpuz\"],\"tagFilter\":\"dataispnqzahmgkbrp\",\"operator\":\"EqualTo\",\"unit\":\"nuqqkpikadrgvt\",\"contactEmails\":[\"buynhijggm\"],\"contactGroups\":[\"siarbutrcvpn\",\"zzmhjrunmpxttd\",\"hrbnlankxmyskpbh\"],\"contactRoles\":[\"tkcxywnytnrsy\",\"lqidyby\",\"czfc\",\"haaxdbabphl\"],\"overridingAlert\":\"qlfktsths\",\"departmentName\":\"ocmnyyazttbtwwrq\",\"companyName\":\"edckzywbiexzfey\",\"enrollmentNumber\":\"axibxujw\",\"enrollmentStartDate\":\"qwalmuzyoxaepd\",\"enrollmentEndDate\":\"jancu\"},\"costEntityId\":\"d\",\"status\":\"Resolved\",\"creationTime\":\"xbniwdjs\",\"closeTime\":\"tsdbpgn\",\"modificationTime\":\"txhp\",\"statusModificationUserName\":\"bzpfzab\",\"statusModificationTime\":\"cuh\"}}")
                .toObject(DismissAlertPayload.class);
        Assertions.assertEquals(AlertType.BUDGET, model.definition().type());
        Assertions.assertEquals(AlertCategory.COST, model.definition().category());
        Assertions.assertEquals(AlertCriteria.CREDIT_THRESHOLD_REACHED, model.definition().criteria());
        Assertions.assertEquals("fnljky", model.description());
        Assertions.assertEquals(AlertSource.PRESET, model.source());
        Assertions.assertEquals(AlertTimeGrainType.BILLING_MONTH, model.details().timeGrainType());
        Assertions.assertEquals("qgidokgjljyo", model.details().periodStartDate());
        Assertions.assertEquals("vcltbgsncgh", model.details().triggeredBy());
        Assertions.assertEquals(AlertOperator.EQUAL_TO, model.details().operator());
        Assertions.assertEquals("nuqqkpikadrgvt", model.details().unit());
        Assertions.assertEquals("buynhijggm", model.details().contactEmails().get(0));
        Assertions.assertEquals("siarbutrcvpn", model.details().contactGroups().get(0));
        Assertions.assertEquals("tkcxywnytnrsy", model.details().contactRoles().get(0));
        Assertions.assertEquals("qlfktsths", model.details().overridingAlert());
        Assertions.assertEquals("ocmnyyazttbtwwrq", model.details().departmentName());
        Assertions.assertEquals("edckzywbiexzfey", model.details().companyName());
        Assertions.assertEquals("axibxujw", model.details().enrollmentNumber());
        Assertions.assertEquals("qwalmuzyoxaepd", model.details().enrollmentStartDate());
        Assertions.assertEquals("jancu", model.details().enrollmentEndDate());
        Assertions.assertEquals("d", model.costEntityId());
        Assertions.assertEquals(AlertStatus.RESOLVED, model.status());
        Assertions.assertEquals("xbniwdjs", model.creationTime());
        Assertions.assertEquals("tsdbpgn", model.closeTime());
        Assertions.assertEquals("txhp", model.modificationTime());
        Assertions.assertEquals("bzpfzab", model.statusModificationUsername());
        Assertions.assertEquals("cuh", model.statusModificationTime());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DismissAlertPayload model =
            new DismissAlertPayload()
                .withDefinition(
                    new AlertPropertiesDefinition()
                        .withType(AlertType.BUDGET)
                        .withCategory(AlertCategory.COST)
                        .withCriteria(AlertCriteria.CREDIT_THRESHOLD_REACHED))
                .withDescription("fnljky")
                .withSource(AlertSource.PRESET)
                .withDetails(
                    new AlertPropertiesDetails()
                        .withTimeGrainType(AlertTimeGrainType.BILLING_MONTH)
                        .withPeriodStartDate("qgidokgjljyo")
                        .withTriggeredBy("vcltbgsncgh")
                        .withResourceGroupFilter(Arrays.asList("dataszzhbijhtxfvgxbf"))
                        .withResourceFilter(Arrays.asList("datanehmpvecx", "dataodebfqkkrbmpu", "datagr"))
                        .withMeterFilter(Arrays.asList("datalzlfbxzpuz"))
                        .withTagFilter("dataispnqzahmgkbrp")
                        .withOperator(AlertOperator.EQUAL_TO)
                        .withUnit("nuqqkpikadrgvt")
                        .withContactEmails(Arrays.asList("buynhijggm"))
                        .withContactGroups(Arrays.asList("siarbutrcvpn", "zzmhjrunmpxttd", "hrbnlankxmyskpbh"))
                        .withContactRoles(Arrays.asList("tkcxywnytnrsy", "lqidyby", "czfc", "haaxdbabphl"))
                        .withOverridingAlert("qlfktsths")
                        .withDepartmentName("ocmnyyazttbtwwrq")
                        .withCompanyName("edckzywbiexzfey")
                        .withEnrollmentNumber("axibxujw")
                        .withEnrollmentStartDate("qwalmuzyoxaepd")
                        .withEnrollmentEndDate("jancu"))
                .withCostEntityId("d")
                .withStatus(AlertStatus.RESOLVED)
                .withCreationTime("xbniwdjs")
                .withCloseTime("tsdbpgn")
                .withModificationTime("txhp")
                .withStatusModificationUsername("bzpfzab")
                .withStatusModificationTime("cuh");
        model = BinaryData.fromObject(model).toObject(DismissAlertPayload.class);
        Assertions.assertEquals(AlertType.BUDGET, model.definition().type());
        Assertions.assertEquals(AlertCategory.COST, model.definition().category());
        Assertions.assertEquals(AlertCriteria.CREDIT_THRESHOLD_REACHED, model.definition().criteria());
        Assertions.assertEquals("fnljky", model.description());
        Assertions.assertEquals(AlertSource.PRESET, model.source());
        Assertions.assertEquals(AlertTimeGrainType.BILLING_MONTH, model.details().timeGrainType());
        Assertions.assertEquals("qgidokgjljyo", model.details().periodStartDate());
        Assertions.assertEquals("vcltbgsncgh", model.details().triggeredBy());
        Assertions.assertEquals(AlertOperator.EQUAL_TO, model.details().operator());
        Assertions.assertEquals("nuqqkpikadrgvt", model.details().unit());
        Assertions.assertEquals("buynhijggm", model.details().contactEmails().get(0));
        Assertions.assertEquals("siarbutrcvpn", model.details().contactGroups().get(0));
        Assertions.assertEquals("tkcxywnytnrsy", model.details().contactRoles().get(0));
        Assertions.assertEquals("qlfktsths", model.details().overridingAlert());
        Assertions.assertEquals("ocmnyyazttbtwwrq", model.details().departmentName());
        Assertions.assertEquals("edckzywbiexzfey", model.details().companyName());
        Assertions.assertEquals("axibxujw", model.details().enrollmentNumber());
        Assertions.assertEquals("qwalmuzyoxaepd", model.details().enrollmentStartDate());
        Assertions.assertEquals("jancu", model.details().enrollmentEndDate());
        Assertions.assertEquals("d", model.costEntityId());
        Assertions.assertEquals(AlertStatus.RESOLVED, model.status());
        Assertions.assertEquals("xbniwdjs", model.creationTime());
        Assertions.assertEquals("tsdbpgn", model.closeTime());
        Assertions.assertEquals("txhp", model.modificationTime());
        Assertions.assertEquals("bzpfzab", model.statusModificationUsername());
        Assertions.assertEquals("cuh", model.statusModificationTime());
    }
}
