import { type PopperPlacementType } from '@mui/material/Popper/BasePopper.types';

export const MAX_HEIGHT = 360;
export const MAX_WIDTH = 312;

export const positionMap = {
  left: {
    anchorOrigin: {
      vertical: 'bottom' as const,
      horizontal: 'start' as const,
    },
  },
  right: {
    anchorOrigin: {
      vertical: 'bottom' as const,
      horizontal: 'end' as const,
    },
  },
  center: {
    anchorOrigin: {
      vertical: 'bottom' as const,
      horizontal: null,
    },
  },
  'top-right': {
    anchorOrigin: {
      vertical: 'top' as const,
      horizontal: 'right' as const,
    },
  },
};

export const transformOriginMap: Record<PopperPlacementType, string> = {
  'bottom-start': 'top left',
  'top-start': 'bottom left',
  'bottom-end': 'top right',
  'top-end': 'bottom right',
  bottom: 'top center',
  top: 'bottom center',
  auto: 'auto',
  'auto-start': 'auto',
  'auto-end': 'auto',
  right: 'auto',
  left: 'auto',
  'right-start': 'top left',
  'right-end': 'bottom left',
  'left-start': 'auto',
  'left-end': 'auto',
};
