import globals from '../globals';
import { getThemeRefs } from '../../helpers/themeHelpers';
import { CodeSnippetClass } from '../../components/descope-code-snippet/CodeSnippetClass';

const globalRefs = getThemeRefs(globals);

const vars = CodeSnippetClass.cssVarList;

const light = {
  color1: '#fa0',
  color2: '#d73a49',
  color3: '#6f42c1',
  color4: '#005cc5',
  color5: '#e36209',
  color6: '#6a737d',
  color7: '#22863a',
  color8: '#24292e',
  color9: '#735c0f',
  color10: '#f0fff4',
  color11: '#b31d28',
  color12: '#ffeef0',
  color13: '#032f62',
};

const dark = {
  color1: '#c9d1d9',
  color2: '#ff7b72',
  color3: '#d2a8ff',
  color4: '#79c0ff',
  color5: '#ffa657',
  color6: '#8b949e',
  color7: '#7ee787',
  color8: '#c9d1d9',
  color9: '#735c0f',
  color10: '#f0fff4',
  color11: '#67060c',
  color12: '#ffeef0',
  color13: '#a5d6ff',
};

const CodeSnippet = {
  [vars.rootBgColor]: globalRefs.colors.surface.main,
  [vars.rootTextColor]: globalRefs.colors.surface.contrast,
  [vars.docTagTextColor]: light.color2,
  [vars.keywordTextColor]: light.color2,
  [vars.metaKeywordTextColor]: light.color2,
  [vars.templateTagTextColor]: light.color2,
  [vars.templateVariableTextColor]: light.color2,
  [vars.typeTextColor]: light.color2,
  [vars.variableLanguageTextColor]: light.color2,
  [vars.titleTextColor]: light.color3,
  [vars.titleClassTextColor]: light.color3,
  [vars.titleClassInheritedTextColor]: light.color3,
  [vars.titleFunctionTextColor]: light.color3,
  [vars.attrTextColor]: light.color4,
  [vars.attributeTextColor]: light.color4,
  [vars.literalTextColor]: light.color4,
  [vars.metaTextColor]: light.color4,
  [vars.numberTextColor]: light.color4,
  [vars.operatorTextColor]: light.color4,
  [vars.variableTextColor]: light.color4,
  [vars.selectorAttrTextColor]: light.color4,
  [vars.selectorClassTextColor]: light.color4,
  [vars.selectorIdTextColor]: light.color4,
  [vars.regexpTextColor]: light.color13,
  [vars.stringTextColor]: light.color13,
  [vars.metaStringTextColor]: light.color13,
  [vars.builtInTextColor]: light.color5,
  [vars.symbolTextColor]: light.color5,
  [vars.commentTextColor]: light.color6,
  [vars.codeTextColor]: light.color6,
  [vars.formulaTextColor]: light.color6,
  [vars.nameTextColor]: light.color7,
  [vars.quoteTextColor]: light.color7,
  [vars.selectorTagTextColor]: light.color7,
  [vars.selectorPseudoTextColor]: light.color7,
  [vars.substTextColor]: light.color8,
  [vars.sectionTextColor]: light.color4,
  [vars.bulletTextColor]: light.color9,
  [vars.emphasisTextColor]: light.color8,
  [vars.strongTextColor]: light.color8,
  [vars.additionTextColor]: light.color7,
  [vars.additionBgColor]: light.color10,
  [vars.deletionTextColor]: light.color2,
  [vars.deletionBgColor]: light.color10,
  /* purposely ignored */
  // [vars.charEscapeTextColor]: '',
  // [vars.linkTextColor]: '',
  // [vars.paramsTextColor]: '',
  // [vars.propertyTextColor]: '',
  // [vars.punctuationTextColor]: '',
  // [vars.tagTextColor  ]: '',
};

export const codeSnippetDarkThemeOverrides = {
  codeSnippet: {
    [vars.rootBgColor]: globalRefs.colors.surface.main,
    [vars.rootTextColor]: globalRefs.colors.surface.contrast,
    [vars.docTagTextColor]: dark.color2,
    [vars.keywordTextColor]: dark.color2,
    [vars.metaKeywordTextColor]: dark.color2,
    [vars.templateTagTextColor]: dark.color2,
    [vars.templateVariableTextColor]: dark.color2,
    [vars.typeTextColor]: dark.color2,
    [vars.variableLanguageTextColor]: dark.color2,
    [vars.titleTextColor]: dark.color3,
    [vars.titleClassTextColor]: dark.color3,
    [vars.titleClassInheritedTextColor]: dark.color3,
    [vars.titleFunctionTextColor]: dark.color3,
    [vars.attrTextColor]: dark.color4,
    [vars.attributeTextColor]: dark.color4,
    [vars.literalTextColor]: dark.color4,
    [vars.metaTextColor]: dark.color4,
    [vars.numberTextColor]: dark.color4,
    [vars.operatorTextColor]: dark.color4,
    [vars.variableTextColor]: dark.color4,
    [vars.selectorAttrTextColor]: dark.color4,
    [vars.selectorClassTextColor]: dark.color4,
    [vars.selectorIdTextColor]: dark.color4,
    [vars.regexpTextColor]: dark.color13,
    [vars.stringTextColor]: dark.color13,
    [vars.metaStringTextColor]: dark.color13,
    [vars.builtInTextColor]: dark.color5,
    [vars.symbolTextColor]: dark.color5,
    [vars.commentTextColor]: dark.color6,
    [vars.codeTextColor]: dark.color6,
    [vars.formulaTextColor]: dark.color6,
    [vars.nameTextColor]: dark.color7,
    [vars.quoteTextColor]: dark.color7,
    [vars.selectorTagTextColor]: dark.color7,
    [vars.selectorPseudoTextColor]: dark.color7,
    [vars.substTextColor]: dark.color8,
    [vars.sectionTextColor]: dark.color4,
    [vars.bulletTextColor]: dark.color9,
    [vars.emphasisTextColor]: dark.color8,
    [vars.strongTextColor]: dark.color8,
    [vars.additionTextColor]: dark.color7,
    [vars.additionBgColor]: dark.color10,
    [vars.deletionTextColor]: dark.color2,
    [vars.deletionBgColor]: dark.color10,
  },
};

export default CodeSnippet;
export { vars };
