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

package com.azure.resourcemanager.support.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.support.models.QuotaChangeRequest;
import com.azure.resourcemanager.support.models.QuotaTicketDetails;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class QuotaTicketDetailsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        QuotaTicketDetails model =
            BinaryData
                .fromString(
                    "{\"quotaChangeRequestSubType\":\"qgtz\",\"quotaChangeRequestVersion\":\"pnqbqqwxrjfe\",\"quotaChangeRequests\":[{\"region\":\"wsubisnja\",\"payload\":\"mngnzscxaqw\"},{\"region\":\"chcbonqvpkvlrxnj\",\"payload\":\"seiphe\"},{\"region\":\"lokeyy\",\"payload\":\"nj\"}]}")
                .toObject(QuotaTicketDetails.class);
        Assertions.assertEquals("qgtz", model.quotaChangeRequestSubType());
        Assertions.assertEquals("pnqbqqwxrjfe", model.quotaChangeRequestVersion());
        Assertions.assertEquals("wsubisnja", model.quotaChangeRequests().get(0).region());
        Assertions.assertEquals("mngnzscxaqw", model.quotaChangeRequests().get(0).payload());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        QuotaTicketDetails model =
            new QuotaTicketDetails()
                .withQuotaChangeRequestSubType("qgtz")
                .withQuotaChangeRequestVersion("pnqbqqwxrjfe")
                .withQuotaChangeRequests(
                    Arrays
                        .asList(
                            new QuotaChangeRequest().withRegion("wsubisnja").withPayload("mngnzscxaqw"),
                            new QuotaChangeRequest().withRegion("chcbonqvpkvlrxnj").withPayload("seiphe"),
                            new QuotaChangeRequest().withRegion("lokeyy").withPayload("nj")));
        model = BinaryData.fromObject(model).toObject(QuotaTicketDetails.class);
        Assertions.assertEquals("qgtz", model.quotaChangeRequestSubType());
        Assertions.assertEquals("pnqbqqwxrjfe", model.quotaChangeRequestVersion());
        Assertions.assertEquals("wsubisnja", model.quotaChangeRequests().get(0).region());
        Assertions.assertEquals("mngnzscxaqw", model.quotaChangeRequests().get(0).payload());
    }
}
