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

package com.azure.resourcemanager.logz.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.logz.models.LogzOrganizationProperties;
import com.azure.resourcemanager.logz.models.MarketplaceSubscriptionStatus;
import com.azure.resourcemanager.logz.models.MonitorProperties;
import com.azure.resourcemanager.logz.models.MonitoringStatus;
import com.azure.resourcemanager.logz.models.PlanData;
import com.azure.resourcemanager.logz.models.UserInfo;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class MonitorPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MonitorProperties model =
            BinaryData
                .fromString(
                    "{\"provisioningState\":\"Succeeded\",\"monitoringStatus\":\"Enabled\",\"marketplaceSubscriptionStatus\":\"Active\",\"logzOrganizationProperties\":{\"companyName\":\"umkdosvqwhbmd\",\"id\":\"bjf\",\"enterpriseAppId\":\"gmbmbexppbh\",\"singleSignOnUrl\":\"qrolfpf\"},\"userInfo\":{\"firstName\":\"lgbquxig\",\"lastName\":\"jgzjaoyfhrtx\",\"emailAddress\":\"n\",\"phoneNumber\":\"kujysvlejuvfq\"},\"planData\":{\"usageType\":\"lyxwjkcprbnwbx\",\"billingCycle\":\"vtb\",\"planDetails\":\"ysszdnrujqguh\",\"effectiveDate\":\"2021-02-16T19:21:04Z\"},\"liftrResourceCategory\":\"MonitorLogs\",\"liftrResourcePreference\":1747028439}")
                .toObject(MonitorProperties.class);
        Assertions.assertEquals(MonitoringStatus.ENABLED, model.monitoringStatus());
        Assertions.assertEquals(MarketplaceSubscriptionStatus.ACTIVE, model.marketplaceSubscriptionStatus());
        Assertions.assertEquals("umkdosvqwhbmd", model.logzOrganizationProperties().companyName());
        Assertions.assertEquals("gmbmbexppbh", model.logzOrganizationProperties().enterpriseAppId());
        Assertions.assertEquals("qrolfpf", model.logzOrganizationProperties().singleSignOnUrl());
        Assertions.assertEquals("lgbquxig", model.userInfo().firstName());
        Assertions.assertEquals("jgzjaoyfhrtx", model.userInfo().lastName());
        Assertions.assertEquals("n", model.userInfo().emailAddress());
        Assertions.assertEquals("kujysvlejuvfq", model.userInfo().phoneNumber());
        Assertions.assertEquals("lyxwjkcprbnwbx", model.planData().usageType());
        Assertions.assertEquals("vtb", model.planData().billingCycle());
        Assertions.assertEquals("ysszdnrujqguh", model.planData().planDetails());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-16T19:21:04Z"), model.planData().effectiveDate());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MonitorProperties model =
            new MonitorProperties()
                .withMonitoringStatus(MonitoringStatus.ENABLED)
                .withMarketplaceSubscriptionStatus(MarketplaceSubscriptionStatus.ACTIVE)
                .withLogzOrganizationProperties(
                    new LogzOrganizationProperties()
                        .withCompanyName("umkdosvqwhbmd")
                        .withEnterpriseAppId("gmbmbexppbh")
                        .withSingleSignOnUrl("qrolfpf"))
                .withUserInfo(
                    new UserInfo()
                        .withFirstName("lgbquxig")
                        .withLastName("jgzjaoyfhrtx")
                        .withEmailAddress("n")
                        .withPhoneNumber("kujysvlejuvfq"))
                .withPlanData(
                    new PlanData()
                        .withUsageType("lyxwjkcprbnwbx")
                        .withBillingCycle("vtb")
                        .withPlanDetails("ysszdnrujqguh")
                        .withEffectiveDate(OffsetDateTime.parse("2021-02-16T19:21:04Z")));
        model = BinaryData.fromObject(model).toObject(MonitorProperties.class);
        Assertions.assertEquals(MonitoringStatus.ENABLED, model.monitoringStatus());
        Assertions.assertEquals(MarketplaceSubscriptionStatus.ACTIVE, model.marketplaceSubscriptionStatus());
        Assertions.assertEquals("umkdosvqwhbmd", model.logzOrganizationProperties().companyName());
        Assertions.assertEquals("gmbmbexppbh", model.logzOrganizationProperties().enterpriseAppId());
        Assertions.assertEquals("qrolfpf", model.logzOrganizationProperties().singleSignOnUrl());
        Assertions.assertEquals("lgbquxig", model.userInfo().firstName());
        Assertions.assertEquals("jgzjaoyfhrtx", model.userInfo().lastName());
        Assertions.assertEquals("n", model.userInfo().emailAddress());
        Assertions.assertEquals("kujysvlejuvfq", model.userInfo().phoneNumber());
        Assertions.assertEquals("lyxwjkcprbnwbx", model.planData().usageType());
        Assertions.assertEquals("vtb", model.planData().billingCycle());
        Assertions.assertEquals("ysszdnrujqguh", model.planData().planDetails());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-16T19:21:04Z"), model.planData().effectiveDate());
    }
}
