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

package com.azure.resourcemanager.billingbenefits.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.billingbenefits.models.AppliedScopeProperties;
import com.azure.resourcemanager.billingbenefits.models.AppliedScopeType;
import com.azure.resourcemanager.billingbenefits.models.PurchaseRequest;
import com.azure.resourcemanager.billingbenefits.models.RenewProperties;
import com.azure.resourcemanager.billingbenefits.models.SavingsPlanUpdateRequestProperties;
import org.junit.jupiter.api.Assertions;

public final class SavingsPlanUpdateRequestPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SavingsPlanUpdateRequestProperties model =
            BinaryData
                .fromString(
                    "{\"displayName\":\"dphagalpbuxwgip\",\"appliedScopeType\":\"Shared\",\"appliedScopeProperties\":{\"tenantId\":\"wkgshwa\",\"managementGroupId\":\"ixzbinjeputtmryw\",\"subscriptionId\":\"zoqftiyqzrnkcqvy\",\"resourceGroupId\":\"whzlsicohoq\",\"displayName\":\"wvl\"},\"renew\":true,\"renewProperties\":{\"purchaseProperties\":{}}}")
                .toObject(SavingsPlanUpdateRequestProperties.class);
        Assertions.assertEquals("dphagalpbuxwgip", model.displayName());
        Assertions.assertEquals(AppliedScopeType.SHARED, model.appliedScopeType());
        Assertions.assertEquals("wkgshwa", model.appliedScopeProperties().tenantId());
        Assertions.assertEquals("ixzbinjeputtmryw", model.appliedScopeProperties().managementGroupId());
        Assertions.assertEquals("zoqftiyqzrnkcqvy", model.appliedScopeProperties().subscriptionId());
        Assertions.assertEquals("whzlsicohoq", model.appliedScopeProperties().resourceGroupId());
        Assertions.assertEquals("wvl", model.appliedScopeProperties().displayName());
        Assertions.assertEquals(true, model.renew());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SavingsPlanUpdateRequestProperties model =
            new SavingsPlanUpdateRequestProperties()
                .withDisplayName("dphagalpbuxwgip")
                .withAppliedScopeType(AppliedScopeType.SHARED)
                .withAppliedScopeProperties(
                    new AppliedScopeProperties()
                        .withTenantId("wkgshwa")
                        .withManagementGroupId("ixzbinjeputtmryw")
                        .withSubscriptionId("zoqftiyqzrnkcqvy")
                        .withResourceGroupId("whzlsicohoq")
                        .withDisplayName("wvl"))
                .withRenew(true)
                .withRenewProperties(new RenewProperties().withPurchaseProperties(new PurchaseRequest()));
        model = BinaryData.fromObject(model).toObject(SavingsPlanUpdateRequestProperties.class);
        Assertions.assertEquals("dphagalpbuxwgip", model.displayName());
        Assertions.assertEquals(AppliedScopeType.SHARED, model.appliedScopeType());
        Assertions.assertEquals("wkgshwa", model.appliedScopeProperties().tenantId());
        Assertions.assertEquals("ixzbinjeputtmryw", model.appliedScopeProperties().managementGroupId());
        Assertions.assertEquals("zoqftiyqzrnkcqvy", model.appliedScopeProperties().subscriptionId());
        Assertions.assertEquals("whzlsicohoq", model.appliedScopeProperties().resourceGroupId());
        Assertions.assertEquals("wvl", model.appliedScopeProperties().displayName());
        Assertions.assertEquals(true, model.renew());
    }
}
