import { uuidv7 } from 'uuidv7';

export function generateStateId() {
  return uuidv7();
}

export function compareStateIds(id1, id2) {
  // UUIDv7 is time-ordered, so we can compare them directly
  return id1.localeCompare(id2);
}

export function isForward(id1, id2) {
  return compareStateIds(id1, id2) < 0;
}

export function isBackward(id1, id2) {
  return compareStateIds(id1, id2) > 0;
}
