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

package com.azure.resourcemanager.appcomplianceautomation.generated;

import com.azure.core.util.Context;
import com.azure.resourcemanager.appcomplianceautomation.models.ReportProperties;
import com.azure.resourcemanager.appcomplianceautomation.models.ReportResourcePatch;
import com.azure.resourcemanager.appcomplianceautomation.models.ResourceMetadata;
import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/** Samples for ReportOperation Update. */
public final class ReportOperationUpdateSamples {
    /*
     * x-ms-original-file: specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/preview/2022-11-16-preview/examples/Report_Update.json
     */
    /**
     * Sample code: Report_Update.
     *
     * @param manager Entry point to AppComplianceAutomationManager.
     */
    public static void reportUpdate(
        com.azure.resourcemanager.appcomplianceautomation.AppComplianceAutomationManager manager) {
        manager
            .reportOperations()
            .update(
                "testReportName",
                new ReportResourcePatch()
                    .withProperties(
                        new ReportProperties()
                            .withOfferGuid("0000")
                            .withTimeZone("GMT Standard Time")
                            .withTriggerTime(OffsetDateTime.parse("2022-03-04T05:11:56.197Z"))
                            .withResources(
                                Arrays
                                    .asList(
                                        new ResourceMetadata()
                                            .withResourceId(
                                                "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint")
                                            .withTags(mapOf("key1", "value1"))))),
                Context.NONE);
    }

    @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;
    }
}
