/** Keep in sync with ptw_backend/src/constants/uploadLimits.js */
export const PTW_MAX_UPLOAD_BYTES = 200 * 1024 * 1024;
export const PTW_MAX_UPLOAD_MB = PTW_MAX_UPLOAD_BYTES / (1024 * 1024);

export function validateUploadSize(file, label = "File") {
  if (!file?.size) return null;
  if (file.size > PTW_MAX_UPLOAD_BYTES) {
    const actualMb = (file.size / (1024 * 1024)).toFixed(1);
    return `${label} is ${actualMb} MB. Maximum allowed is ${PTW_MAX_UPLOAD_MB} MB — use a shorter or lower-resolution recording.`;
  }
  return null;
}
