import { Identifier } from "./id.js";

export namespace Examples {
  export const Id = (prefix: keyof typeof Identifier.prefixes) =>
    `${Identifier.prefixes[prefix]}_XXXXXXXXXXXXXXXXXXXXXXXXX`;

  export const User = {
    id: Id("user"),
    name: "Jane Doe",
    email: "email@example.com",
    customerID: "0bfcb712-df13-4454-81a8-fbee66eddca4",
  };

  export const Organisation = {
    id: Id("organisation"),
    name: "John",
    slug: "johns_org", // Team slug (not null, unique)
    ownerID: User.id,
  };

  export const SteamAccount = {
    id: "74839300282033", // Steam ID
    ownerID: User.id,
    name: "JD The 65th",
    realName: "John Doe",
    memberSince: new Date("2010-01-26T21:00:00.000Z"),
    avatarHash: "3a5e805fd4c1e04e26a97af0b9c6fab2dee91a19",
    limitations: {
      isLimited: false,
      tradeBanState: "none" as const,
      isVacBanned: false,
      visibilityState: 3,
      privacyState: "public" as const,
    },
    profileUrl: "The65thJD", //"https://steamcommunity.com/id/XXXXXXXXXXXXXXXX/",
    lastSyncedAt: new Date("2025-04-26T20:11:08.155Z"),
  };

  export const Token = {
    id: Id("apiPersonal"),
    token: "nst_test_******XXXX",
    created: new Date("2024-06-29 19:36:19.000"),
  };

  export const Session = {
    id: Id("session"),
    description: "A gaming session for streaming gameplay",
    retry: {
      maxAttempts: 3,
      factor: 2,
      minTimeoutInMs: 1000,
      maxTimeoutInMs: 30000,
      randomize: true,
    },
    queue: {
      name: "gaming-queue",
      concurrencyLimit: 5,
    },
    machine: "ns3-large" as const,
    maxDuration: 3600,
    relayUrl: "https://relay.nestri.io",
    resolution: "1920x1080" as const,
    framerate: 60,
    room: "game-room-123",
    gpuVendor: "nvidia",
    gpuName: "RTX 4090",
    gpuIndex: 0,
    gpuCardPath: "/dev/dri/renderD128",
    videoCodec: "h264",
    videoEncoder: "nvenc",
    videoRateControl: "cbr" as const,
    videoCqp: 26,
    videoBitrate: 6000,
    videoBitrateMax: 8000,
    videoEncoderType: "hardware" as const,
    videoBitDepth: 8 as const,
    audioCaptureMethod: "pipewire" as const,
    audioCodec: "opus",
    audioEncoder: "opusenc",
    audioRateControl: "cbr" as const,
    audioBitrate: 128,
    audioBitrateMax: 192,
    zeroCopy: false,
    verbose: false,
    run: "async (payload, { ctx, signal }) => { /* session logic */ }",
  };

  export const App = {
    id: Id("app"),
    secret: "sec_******XXXX",
    name: "Example App",
    redirectURI: "https://web.example.com/v1/callback",
  };

  export const Member = {
    id: Id("member"),
    ownerID: User.id,
    orgID: Organisation.id,
    role: "admin" as const,
  };
}
