import { keysTheme } from "data/dataMx";
import { ButtonColor, ButtoniconTypeDesign, CustomColor } from "./ButtonProps";

export const getColorFromTheme = (customColor: CustomColor): keysTheme => {
  switch (customColor) {
    case "light":
      return "neutral700";
    default:
      return "neutral100";
  }
};

export const getOnPrincipalColorFromTheme = (
  customColor: CustomColor | "primary" | "secondary"
): keysTheme => {
  switch (customColor) {
    case "light":
      return "neutral200";
    case "dark":
    case "neutral":
      return "neutral700";
    default:
      return `${customColor}300`;
  }
};

export const getPrincipalColorFromTheme = (
  customColor: CustomColor
): keysTheme => {
  switch (customColor) {
    case "dark":
      return "neutral700";

    case "light":
      return "neutral100";
    case "neutral":
      return "neutral500";
    default:
      return customColor;
  }
};

export const getColorFromButtonIcon = (
  color: ButtonColor,
  customColor: CustomColor,
  typeButtonIcon: ButtoniconTypeDesign
): keysTheme => {
  if (typeButtonIcon != "default") {
    if (color == "custom") {
      return getPrincipalColorFromTheme(customColor);
    } else {
      return color;
    }
  } else {
    return getColorFromTheme(customColor);
  }
};

export const getOnColorFromButtonIcon = (
  color: ButtonColor,
  customColor: CustomColor,
  typeButtonIcon: ButtoniconTypeDesign
): keysTheme => {
  if (typeButtonIcon != "default") {
    if (color == "custom") {
      return getOnPrincipalColorFromTheme(customColor);
    } else {
      return `${color}300`;
    }
  } else {
    return getColorFromTheme(customColor);
  }
};
