export const Z_MODAL_OVERLAY_BASE = 50;
export const Z_MODAL_PANEL_BASE = 51;
export const Z_FLOATING_BASE = 100;
export const Z_FLOATING_ABOVE_PANEL = 10;

const STACK_LAYER_STEP = 10;

export function getOverlayZ(stackIndex = 0): number {
  return Z_MODAL_OVERLAY_BASE + Math.max(0, stackIndex) * STACK_LAYER_STEP;
}

export function getPanelZ(stackIndex = 0): number {
  return Z_MODAL_PANEL_BASE + Math.max(0, stackIndex) * STACK_LAYER_STEP;
}

export function getFloatingZ(panelZ?: number): number {
  return panelZ != null
    ? panelZ + Z_FLOATING_ABOVE_PANEL
    : Z_FLOATING_BASE;
}
