export const normalizeUnitList = (units: any, rackHeight?: number) => {
  if (Array.isArray(units) && units.length > 0) {
    return units
  }

  const height = Number(rackHeight) || 0
  if (height <= 0) {
    return []
  }

  return Array.from({ length: height }, (_, idx) => ({
    id: `virtual-${height - idx}`,
    unit_number: height - idx,
    status: 'available',
    asset_name: '',
    asset_code: '',
    asset_type: '',
    occupied_units: 1,
    reserved_for: '',
    power_consumption: 0,
  }))
}
