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

package com.azure.resourcemanager.powerbidedicated.generated;

import com.azure.resourcemanager.powerbidedicated.models.CapacitySku;
import com.azure.resourcemanager.powerbidedicated.models.CapacitySkuTier;
import com.azure.resourcemanager.powerbidedicated.models.DedicatedCapacityAdministrators;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/** Samples for Capacities Create. */
public final class CapacitiesCreateSamples {
    /*
     * x-ms-original-file: specification/powerbidedicated/resource-manager/Microsoft.PowerBIdedicated/stable/2021-01-01/examples/createCapacity.json
     */
    /**
     * Sample code: Create capacity.
     *
     * @param manager Entry point to PowerBIDedicatedManager.
     */
    public static void createCapacity(com.azure.resourcemanager.powerbidedicated.PowerBIDedicatedManager manager) {
        manager
            .capacities()
            .define("azsdktest")
            .withRegion("West US")
            .withExistingResourceGroup("TestRG")
            .withSku(new CapacitySku().withName("A1").withTier(CapacitySkuTier.PBIE_AZURE))
            .withTags(mapOf("testKey", "testValue"))
            .withAdministration(
                new DedicatedCapacityAdministrators()
                    .withMembers(Arrays.asList("azsdktest@microsoft.com", "azsdktest2@microsoft.com")))
            .create();
    }

    @SuppressWarnings("unchecked")
    private static <T> Map<String, T> mapOf(Object... inputs) {
        Map<String, T> map = new HashMap<>();
        for (int i = 0; i < inputs.length; i += 2) {
            String key = (String) inputs[i];
            T value = (T) inputs[i + 1];
            map.put(key, value);
        }
        return map;
    }
}
