import { type Theme } from '@mui/material';

export const getBackgroundColor = (
  headerRow: boolean,
  selected: boolean | undefined,
  theme: Theme,
) => {
  if (headerRow) {
    return {
      backgroundColor: theme.palette.new.action.background.neutral.hover,
      '&:hover': {
        backgroundColor: theme.palette.new.action.background.neutral.hover,
      },
    };
  }

  if (selected == null) {
    return {
      backgroundColor: theme.palette.new.background.elements.default,
      '&:hover': {
        backgroundColor: theme.palette.new.background.elements.default,
      },
    };
  }

  if (selected) {
    return {
      backgroundColor: `${theme.palette.new.background.elements.brand} !important`,
      '&:hover': {
        backgroundColor: `${theme.palette.new.action.background.neutral.hover} !important`,
      },
    };
  }

  return {
    backgroundColor: theme.palette.new.background.elements.default,
    '&:hover': {
      backgroundColor: theme.palette.new.action.background.neutral.hover,
    },
  };
};
