/**
 * Canonical position constants for parent-child relationships.
 * Use these instead of hardcoded strings throughout the codebase.
 */
const POSITIONS = Object.freeze({
  UPSTREAM: 'upstream',
  DOWNSTREAM: 'downstream',
  AT_EQUIPMENT: 'atEquipment',
  DELTA: 'delta',
});

const POSITION_VALUES = Object.freeze(Object.values(POSITIONS));

function isValidPosition(pos) {
  return POSITION_VALUES.includes(pos);
}

module.exports = { POSITIONS, POSITION_VALUES, isValidPosition };
