import { getTestData, type TestUserData } from "./dbSetup.js";

/**
 * Test utilities for accessing test user data in tests
 */

export function getTestUser(key: "owner" | "collab" | "temp"): TestUserData {
  const testData = getTestData();
  const user = testData.users[key];
  if (!user) {
    throw new Error(`Test user '${key}' not found. Ensure test database is initialized.`);
  }
  return user;
}

export function getAuthHeader(key: "owner" | "collab" | "temp"): Record<string, string> {
  const user = getTestUser(key);
  return {
    Authorization: `Bearer ${user.accessToken}`,
  };
}

export function getAllTestUsers(): Record<string, TestUserData> {
  const testData = getTestData();
  return testData.users;
}

export { type TestUserData } from "./dbSetup.js";
