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

package tsptest.builtin.generated;

import java.time.Duration;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import tsptest.builtin.models.Builtin;
import tsptest.builtin.models.Encoded;

@Disabled
public final class BuiltinOpWriteTests extends BuiltinClientTestBase {
    @Test
    @Disabled
    public void testBuiltinOpWriteTests() {
        // method invocation
        builtinClient.write(new Builtin(true, "myString", null, 0, 32L, null, 64L, 32.0, 64.0, Duration.parse("PT15M"),
            LocalDate.parse("2023-08-29"), OffsetDateTime.parse("2019-10-12T07:20:50.520Z"),
            Arrays.asList("a", "b", "c"), null, "https://www.github.com",
            mapOf("max", 15.0D, "min", 14.0D, "average", 14.3D),
            new Encoded().setTimeInSeconds(Duration.parse("PT15M"))
                .setTimeInSecondsFraction(Duration.parse("PT20M0.345S"))
                .setDateTime(OffsetDateTime.parse("1966-03-03T00:06:56.52Z"))
                .setDateTimeRfc7231(OffsetDateTime.parse("1994-11-06T08:49:37Z"))
                .setUnixTimestamp(OffsetDateTime.parse("2023-08-30T02:35:03Z"))
                .setBase64("aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==".getBytes())
                .setBase64url("aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==".getBytes())
                .setCommaDeliminatedArray(Arrays.asList("a", "b", "c")),
            null));
    }

    // Use "Map.of" if available
    @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;
    }
}
