import { ExtensionType } from 'src/types'

const defaultConfig = {
  backgroundColor: '#fff',
  borderColor: '#000',
  borderWidth: 0,
}

export const getThemeConfig = (theme, type) => {
  const { css: { variables } } = theme

  switch (type) {
    case ExtensionType.Rect:
      return {
        ...defaultConfig,
        backgroundColor: variables['--dp-bg-1_2'] ? variables['--dp-bg-1_2'] : defaultConfig.backgroundColor,
        borderColor: variables['--dp-border-1'] ? variables['--dp-border-1'] : defaultConfig.borderColor
      }
    case ExtensionType.Ellipse:
      return {
        ...defaultConfig,
        backgroundColor: variables['--dp-bg-1_2'] ? variables['--dp-bg-1_2'] : defaultConfig.backgroundColor,
        borderColor: variables['--dp-border-1'] ? variables['--dp-border-1'] : defaultConfig.borderColor
      }
    case ExtensionType.Line:
      return {
        ...defaultConfig,
        borderWidth: 1,
        borderColor: variables['--dp-border-1'] ? variables['--dp-border-1'] : defaultConfig.borderColor
      }
    case ExtensionType.Arrow:
      return {
        ...defaultConfig,
        backgroundColor: variables['--dp-text-primary'] ? variables['--dp-text-primary'] : defaultConfig.backgroundColor,
        borderColor: variables['--dp-border-1'] ? variables['--dp-border-1'] : defaultConfig.borderColor
      }
    case ExtensionType.PlusSign:
      return {
        ...defaultConfig,
        backgroundColor: variables['--dp-text-primary'] ? variables['--dp-text-primary'] : defaultConfig.backgroundColor,
        borderColor: variables['--dp-border-1'] ? variables['--dp-border-1'] : defaultConfig.borderColor
      }
    case ExtensionType.MinusSign:
      return {
        ...defaultConfig,
        backgroundColor: variables['--dp-text-primary'] ? variables['--dp-text-primary'] : defaultConfig.backgroundColor,
        borderColor: variables['--dp-border-1'] ? variables['--dp-border-1'] : defaultConfig.borderColor
      }
    case ExtensionType.TimesSign:
      return {
        ...defaultConfig,
        backgroundColor: variables['--dp-text-primary'] ? variables['--dp-text-primary'] : defaultConfig.backgroundColor,
        borderColor: variables['--dp-border-1'] ? variables['--dp-border-1'] : defaultConfig.borderColor
      }
    case ExtensionType.DivisionSign:
      return {
        ...defaultConfig,
        backgroundColor: variables['--dp-text-primary'] ? variables['--dp-text-primary'] : defaultConfig.backgroundColor,
        borderColor: variables['--dp-border-1'] ? variables['--dp-border-1'] : defaultConfig.borderColor
      }
    case ExtensionType.EqualSign:
      return {
        ...defaultConfig,
        backgroundColor: variables['--dp-text-primary'] ? variables['--dp-text-primary'] : defaultConfig.backgroundColor,
        borderColor: variables['--dp-border-1'] ? variables['--dp-border-1'] : defaultConfig.borderColor
      }
    case ExtensionType.LeftParenthesis:
      return {
        ...defaultConfig,
        backgroundColor: variables['--dp-text-primary'] ? variables['--dp-text-primary'] : defaultConfig.backgroundColor,
        borderColor: variables['--dp-border-1'] ? variables['--dp-border-1'] : defaultConfig.borderColor
      }
    case ExtensionType.RightParenthesis:
      return {
        ...defaultConfig,
        backgroundColor: variables['--dp-text-primary'] ? variables['--dp-text-primary'] : defaultConfig.backgroundColor,
        borderColor: variables['--dp-border-1'] ? variables['--dp-border-1'] : defaultConfig.borderColor
      }
    default:
      return defaultConfig
  }
}