import { randomBytes } from 'crypto';

export function generateLabCaseAccessToken(): string {
  return randomBytes(32).toString('base64url');
}

export function buildLabCaseShareUrl(accessToken: string, locale = 'en'): string {
  const appUrl = (process.env.FRONTEND_URL || 'http://localhost:3001').replace(/\/$/, '');
  const normalizedLocale = locale.trim() || 'en';
  return `${appUrl}/${normalizedLocale}/lab-case/${accessToken}`;
}
