import { {{ clientClassName }} } from "../src/index.js";
import { DefaultAzureCredential, InteractiveBrowserCredential } from "@azure/identity";
import { setLogLevel } from "@azure/logger";
import { describe, it } from "vitest";

describe("snippets", () => {
  it("ReadmeSampleCreateClient_Node", async () => {
    {{#if azureArm}}
    {{#if hasClientSubscriptionId}}
    const subscriptionId = "00000000-0000-0000-0000-000000000000";
    const client = new {{ clientClassName }}(new DefaultAzureCredential(), subscriptionId);
    {{else}}
    const client = new {{ clientClassName }}(new DefaultAzureCredential());
    {{/if}}
    {{else}}
    const client = new {{ clientClassName }}("<endpoint>", new DefaultAzureCredential());
    {{/if}}
  });

  it("ReadmeSampleCreateClient_Browser", async () => {
    {{#if azureArm}}
    {{#if hasClientSubscriptionId}}
    const subscriptionId = "00000000-0000-0000-0000-000000000000";
    const credential = new InteractiveBrowserCredential({
      tenantId: "<YOUR_TENANT_ID>",
      clientId: "<YOUR_CLIENT_ID>",
    });
    const client = new {{ clientClassName }}(credential, subscriptionId);
    {{else}}
    const credential = new InteractiveBrowserCredential({
      tenantId: "<YOUR_TENANT_ID>",
      clientId: "<YOUR_CLIENT_ID>",
    });
    const client = new {{ clientClassName }}(credential);
    {{/if}}
    {{else}}
    const credential = new InteractiveBrowserCredential({
      tenantId: "<YOUR_TENANT_ID>",
      clientId: "<YOUR_CLIENT_ID>",
    });
    const client = new {{ clientClassName }}("<endpoint>", credential);
    {{/if}}
  });

  it("SetLogLevel", async () => {
    setLogLevel("info");
  });
});