// 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.AlertOperator;
import com.azure.resourcemanager.costmanagement.models.AlertPropertiesDetails;
import com.azure.resourcemanager.costmanagement.models.AlertTimeGrainType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AlertPropertiesDetailsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AlertPropertiesDetails model =
            BinaryData
                .fromString(
                    "{\"timeGrainType\":\"None\",\"periodStartDate\":\"dng\",\"triggeredBy\":\"ocipazyxoeg\",\"resourceGroupFilter\":[\"datajnpiucgyg\"],\"resourceFilter\":[\"datazntypmrb\",\"dataizcdrqjsd\"],\"meterFilter\":[\"datanfyhx\",\"dataeoejzic\",\"dataifsjttgzfbishcb\",\"datahajdeyeamdpha\"],\"tagFilter\":\"datalpbuxwgipwhonowk\",\"operator\":\"GreaterThanOrEqualTo\",\"unit\":\"kix\",\"contactEmails\":[\"jeputtmrywn\",\"zoqftiyqzrnkcqvy\",\"lwh\"],\"contactGroups\":[\"icohoqqnwvl\",\"yav\",\"hheunmmqhgyx\",\"konocu\"],\"contactRoles\":[\"lyaxuc\",\"nuqszfkbey\",\"ewrmjmwvvjektc\"],\"overridingAlert\":\"enhwlrs\",\"departmentName\":\"rzpwvlqdqgbiq\",\"companyName\":\"ihkaetcktvfc\",\"enrollmentNumber\":\"fsnkymuctq\",\"enrollmentStartDate\":\"fbebrjcxer\",\"enrollmentEndDate\":\"wutttxfvjrbi\"}")
                .toObject(AlertPropertiesDetails.class);
        Assertions.assertEquals(AlertTimeGrainType.NONE, model.timeGrainType());
        Assertions.assertEquals("dng", model.periodStartDate());
        Assertions.assertEquals("ocipazyxoeg", model.triggeredBy());
        Assertions.assertEquals(AlertOperator.GREATER_THAN_OR_EQUAL_TO, model.operator());
        Assertions.assertEquals("kix", model.unit());
        Assertions.assertEquals("jeputtmrywn", model.contactEmails().get(0));
        Assertions.assertEquals("icohoqqnwvl", model.contactGroups().get(0));
        Assertions.assertEquals("lyaxuc", model.contactRoles().get(0));
        Assertions.assertEquals("enhwlrs", model.overridingAlert());
        Assertions.assertEquals("rzpwvlqdqgbiq", model.departmentName());
        Assertions.assertEquals("ihkaetcktvfc", model.companyName());
        Assertions.assertEquals("fsnkymuctq", model.enrollmentNumber());
        Assertions.assertEquals("fbebrjcxer", model.enrollmentStartDate());
        Assertions.assertEquals("wutttxfvjrbi", model.enrollmentEndDate());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AlertPropertiesDetails model =
            new AlertPropertiesDetails()
                .withTimeGrainType(AlertTimeGrainType.NONE)
                .withPeriodStartDate("dng")
                .withTriggeredBy("ocipazyxoeg")
                .withResourceGroupFilter(Arrays.asList("datajnpiucgyg"))
                .withResourceFilter(Arrays.asList("datazntypmrb", "dataizcdrqjsd"))
                .withMeterFilter(Arrays.asList("datanfyhx", "dataeoejzic", "dataifsjttgzfbishcb", "datahajdeyeamdpha"))
                .withTagFilter("datalpbuxwgipwhonowk")
                .withOperator(AlertOperator.GREATER_THAN_OR_EQUAL_TO)
                .withUnit("kix")
                .withContactEmails(Arrays.asList("jeputtmrywn", "zoqftiyqzrnkcqvy", "lwh"))
                .withContactGroups(Arrays.asList("icohoqqnwvl", "yav", "hheunmmqhgyx", "konocu"))
                .withContactRoles(Arrays.asList("lyaxuc", "nuqszfkbey", "ewrmjmwvvjektc"))
                .withOverridingAlert("enhwlrs")
                .withDepartmentName("rzpwvlqdqgbiq")
                .withCompanyName("ihkaetcktvfc")
                .withEnrollmentNumber("fsnkymuctq")
                .withEnrollmentStartDate("fbebrjcxer")
                .withEnrollmentEndDate("wutttxfvjrbi");
        model = BinaryData.fromObject(model).toObject(AlertPropertiesDetails.class);
        Assertions.assertEquals(AlertTimeGrainType.NONE, model.timeGrainType());
        Assertions.assertEquals("dng", model.periodStartDate());
        Assertions.assertEquals("ocipazyxoeg", model.triggeredBy());
        Assertions.assertEquals(AlertOperator.GREATER_THAN_OR_EQUAL_TO, model.operator());
        Assertions.assertEquals("kix", model.unit());
        Assertions.assertEquals("jeputtmrywn", model.contactEmails().get(0));
        Assertions.assertEquals("icohoqqnwvl", model.contactGroups().get(0));
        Assertions.assertEquals("lyaxuc", model.contactRoles().get(0));
        Assertions.assertEquals("enhwlrs", model.overridingAlert());
        Assertions.assertEquals("rzpwvlqdqgbiq", model.departmentName());
        Assertions.assertEquals("ihkaetcktvfc", model.companyName());
        Assertions.assertEquals("fsnkymuctq", model.enrollmentNumber());
        Assertions.assertEquals("fbebrjcxer", model.enrollmentStartDate());
        Assertions.assertEquals("wutttxfvjrbi", model.enrollmentEndDate());
    }
}
