/**
 * Generates a unique Salesforce ticket ID.
 *
 * The ID is a string of 18 characters starting with the prefix 're'.
 * It is generated by concatenating the current timestamp (in base 36) and a random string.
 * This method is likely to generate a unique ID each time it's called, but it's not guaranteed.
 *
 * @returns {string} The generated Salesforce ticket ID.
 */
export function generateSfTicketId(): string {
  let timestamp = Date.now().toString(36);
  while (timestamp.length < 9) {
    timestamp += '0'; // pad with zeros if necessary
  }
  timestamp = timestamp.substring(0, 9); // ensure the timestamp is of length 9

  let randomString = '';
  while (randomString.length < 7) {
    randomString += Math.random().toString(36).substring(2, 15); // generate a random string
  }
  randomString = randomString.substring(0, 7); // ensure the random string is of length 7

  return 're' + timestamp + randomString; // concatenate 're', timestamp, and randomString
}
