"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StyledBadge = void 0;
const Badge_1 = __importDefault(require("@mui/material/Badge"));
const styled_1 = require("../styled");
const getBgColor = ({ $customColor, theme, $variantColor, }) => {
    const colors = {
        contained: {
            grey: theme.palette.grey[800],
            primary: theme.palette.primary[800],
            error: theme.palette.red[800],
            success: theme.palette.green[800],
            warning: theme.palette.yellow[800],
            white: theme.palette.primary.contrastText,
            transparent: 'transparent',
        },
        light: {
            grey: theme.palette.grey[300],
            primary: theme.palette.primary[100],
            error: theme.palette.red[100],
            success: theme.palette.green[100],
            warning: theme.palette.yellow[100],
            white: theme.palette.grey[100],
            transparent: 'transparent',
        },
    };
    return colors[$variantColor][$customColor];
};
const getTextColor = ({ $customColor, theme, $variantColor, }) => {
    const lightTextColor = {
        grey: theme.palette.grey[900],
        primary: theme.palette.primary[800],
        error: theme.palette.red[800],
        success: theme.palette.green[800],
        warning: theme.palette.yellow[800],
        default: theme.palette.primary.contrastText,
    };
    if ($customColor === 'transparent') {
        return theme.palette.grey[900];
    }
    if ($customColor === 'white') {
        return theme.palette.grey[900];
    }
    if ($variantColor === 'contained') {
        return theme.palette.common.white;
    }
    return lightTextColor[$customColor || 'default'];
};
exports.StyledBadge = (0, styled_1.styled)(Badge_1.default, {
    shouldForwardProp: (prop) => !['$customColor', '$withBorder', '$variantColor'].includes(prop),
}) `
  .MuiBadge-badge {
    cursor: default;
    user-select: none;

    min-width: 24px;
    height: 20px;
    padding: ${({ theme }) => theme.spacing(0, 1)};

    font-size: ${({ theme }) => theme.typography.caption.fontSize};
    line-height: ${({ theme }) => theme.typography.caption.lineHeight};
    color: ${({ $customColor, theme, $variantColor }) => getTextColor({
    $customColor,
    theme,
    $variantColor,
})};

    background-color: ${({ $customColor, theme, $variantColor }) => getBgColor({
    $customColor,
    theme,
    $variantColor,
})};
    border-radius: ${({ theme }) => theme.shape.medium};
    box-shadow: ${({ $withBorder, theme }) => $withBorder ? `0 0 0 2px ${theme.palette.background.default}` : 'none'};

    ${({ theme }) => theme.breakpoints.down('sm')} {
      font-size: ${({ theme }) => theme.typography.body1.fontSize};
    }
  }

  .MuiBadge-dot {
    width: 8px;
    min-width: unset;
    height: 8px;
  }
`;
