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

package com.azure.resourcemanager.security.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.security.fluent.models.PricingInner;
import com.azure.resourcemanager.security.fluent.models.PricingListInner;
import com.azure.resourcemanager.security.models.PricingTier;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PricingListInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PricingListInner model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"pricingTier\":\"Standard\",\"subPlan\":\"nqpjwnzlljfmpp\",\"freeTrialRemainingTime\":\"PT46H48M36S\",\"enablementTime\":\"2021-10-30T03:41:11Z\",\"deprecated\":true,\"replacedBy\":[],\"extensions\":[]},\"id\":\"bkyqduu\",\"name\":\"itcjczdz\",\"type\":\"vndhkrwpdapp\"},{\"properties\":{\"pricingTier\":\"Standard\",\"subPlan\":\"kvwrwjfeu\",\"freeTrialRemainingTime\":\"PT36H39M29S\",\"enablementTime\":\"2021-01-02T14:30:26Z\",\"deprecated\":true,\"replacedBy\":[],\"extensions\":[]},\"id\":\"mrldhu\",\"name\":\"jzzd\",\"type\":\"tqxhocdgeab\"},{\"properties\":{\"pricingTier\":\"Free\",\"subPlan\":\"uticndvkaozwyif\",\"freeTrialRemainingTime\":\"PT23H12M54S\",\"enablementTime\":\"2021-10-09T12:18:53Z\",\"deprecated\":false,\"replacedBy\":[],\"extensions\":[]},\"id\":\"ftyxolniw\",\"name\":\"wcukjfkgiawxk\",\"type\":\"ryplwckbasyypn\"},{\"properties\":{\"pricingTier\":\"Standard\",\"subPlan\":\"gcbacphejkot\",\"freeTrialRemainingTime\":\"PT157H5M51S\",\"enablementTime\":\"2021-02-05T05:14:14Z\",\"deprecated\":false,\"replacedBy\":[],\"extensions\":[]},\"id\":\"dlikwyqkgfgibma\",\"name\":\"gakeqsr\",\"type\":\"yb\"}]}")
                .toObject(PricingListInner.class);
        Assertions.assertEquals(PricingTier.STANDARD, model.value().get(0).pricingTier());
        Assertions.assertEquals("nqpjwnzlljfmpp", model.value().get(0).subPlan());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PricingListInner model =
            new PricingListInner()
                .withValue(
                    Arrays
                        .asList(
                            new PricingInner()
                                .withPricingTier(PricingTier.STANDARD)
                                .withSubPlan("nqpjwnzlljfmpp")
                                .withExtensions(Arrays.asList()),
                            new PricingInner()
                                .withPricingTier(PricingTier.STANDARD)
                                .withSubPlan("kvwrwjfeu")
                                .withExtensions(Arrays.asList()),
                            new PricingInner()
                                .withPricingTier(PricingTier.FREE)
                                .withSubPlan("uticndvkaozwyif")
                                .withExtensions(Arrays.asList()),
                            new PricingInner()
                                .withPricingTier(PricingTier.STANDARD)
                                .withSubPlan("gcbacphejkot")
                                .withExtensions(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(PricingListInner.class);
        Assertions.assertEquals(PricingTier.STANDARD, model.value().get(0).pricingTier());
        Assertions.assertEquals("nqpjwnzlljfmpp", model.value().get(0).subPlan());
    }
}
