import { BadRequestException } from "@nestjs/common";
import { uuidSchema } from "@customer-portal/domain/common";

export function parseUuidOrThrow(id: string, message = "Invalid ID format"): string {
  const result = uuidSchema.safeParse(id);
  if (!result.success) {
    throw new BadRequestException(message);
  }
  return result.data;
}
