import type { ThemeConfig } from 'antd';

import antdDefaultTheme from './antdDefaultTheme';

const managerLessValues = {
  publicPath: 'publicPath',
  borderRadiusBase: '6px',
  borderRadiusSM: '8px',
  borderRadiusXS: '6px',
  colorSuccess: '#00b42a',
  colorWarning: '#ff7d00',
  colorText: '#14161a',
  colorTextSecondary: '#40454d',
  colorTextTertiary: '#707680',
  colorTextQuaternary: '#a4aab2',
  colorBorder: 'rgba(0, 0, 0, 0.15)',
  colorBorderSecondary: 'rgba(0, 0, 0, 0.06)',
  colorFillQuaternary: 'rgba(0, 0, 0, 0.02)',
  colorFillTertiary: 'rgba(0, 0, 0, 0.04)',
  colorFillSecondary: 'rgba(0, 0, 0, 0.06)',
  colorFill: 'rgba(0, 0, 0, 0.15)',
  colorPrimaryBg: '#e8f3ff',
  colorPrimary: '#165dff',
  colorPrimaryBgHover: '#bedaff',
  colorPrimaryBorder: '#94bfff',
  colorPrimaryBorderHover: '#6aa1ff',
  colorPrimaryHover: '#4080ff',
  colorPrimaryActive: '#0e42d2',
  colorPrimaryTextActive: '#0e42d2',
  colorPrimaryText: '#165dff',
  colorPrimaryTextHover: '#4080ff',
  colorSuccessBg: '#e8ffea',
  colorSuccessBgHover: '#aff0b5',
  colorSuccessBorder: '#7be188',
  colorSuccessBorderHover: '#4cd263',
  colorSuccessHover: '#23c343',
  colorSuccessActive: '#009a29',
  colorSuccessTextActive: '#009a29',
  colorSuccessTextHover: '#23c343',
  colorSuccessText: '#00b42a',
  colorWarningBg: '#fff7e8',
  colorWarningBgHover: '#ffe4ba',
  colorWarningBorder: '#ffcf8b',
  colorWarningBorderHover: '#ffb65d',
  colorWarningHover: '#ff9a2e',
  colorWarningTextHover: '#ff9a2e',
  colorWarningText: '#ff7d00',
  colorWarningActive: '#d25f00',
  colorWarningTextActive: '#d25f00',
  colorErrorText: '#f53f3f',
  colorErrorBg: '#ffece8',
  colorErrorBgHover: '#fdcdc5',
  colorErrorBorder: '#fbaca3',
  colorErrorBorderHover: '#f98981',
  colorErrorHover: '#f76560',
  colorErrorTextHover: '#f76560',
  colorErrorActive: '#cb272d',
  colorErrorTextActive: '#cb272d',
  colorBgSpotlight: 'rgba(0, 0, 0, 0.9)',
  colorBgMask: 'rgba(0, 0, 0, 0.5)',
  fontSizeBase: 12,
  tableSecondBg: '#fafafa',
} as const;

export const antdManagerThemeTokens: ThemeConfig['token'] = {
  borderRadius: 6,
  borderRadiusSM: 8,
  borderRadiusXS: 6,
  colorSuccess: managerLessValues.colorSuccess,
  colorWarning: managerLessValues.colorWarning,
  colorText: managerLessValues.colorText,
  colorTextSecondary: managerLessValues.colorTextSecondary,
  colorTextTertiary: managerLessValues.colorTextTertiary,
  colorTextQuaternary: managerLessValues.colorTextQuaternary,
  colorBorder: managerLessValues.colorBorder,
  colorBorderSecondary: managerLessValues.colorBorderSecondary,
  colorFillQuaternary: managerLessValues.colorFillQuaternary,
  colorFillTertiary: managerLessValues.colorFillTertiary,
  colorFillSecondary: managerLessValues.colorFillSecondary,
  colorFill: managerLessValues.colorFill,
  colorPrimary: managerLessValues.colorPrimary,
  colorInfo: managerLessValues.colorPrimary,
  colorError: managerLessValues.colorErrorText,
  colorPrimaryBg: managerLessValues.colorPrimaryBg,
  colorPrimaryBgHover: managerLessValues.colorPrimaryBgHover,
  colorPrimaryBorder: managerLessValues.colorPrimaryBorder,
  colorPrimaryBorderHover: managerLessValues.colorPrimaryBorderHover,
  colorPrimaryHover: managerLessValues.colorPrimaryHover,
  colorPrimaryActive: managerLessValues.colorPrimaryActive,
  colorPrimaryTextActive: managerLessValues.colorPrimaryTextActive,
  colorPrimaryText: managerLessValues.colorPrimaryText,
  colorPrimaryTextHover: managerLessValues.colorPrimaryTextHover,
  colorSuccessBg: managerLessValues.colorSuccessBg,
  colorSuccessBgHover: managerLessValues.colorSuccessBgHover,
  colorSuccessBorder: managerLessValues.colorSuccessBorder,
  colorSuccessBorderHover: managerLessValues.colorSuccessBorderHover,
  colorSuccessHover: managerLessValues.colorSuccessHover,
  colorSuccessActive: managerLessValues.colorSuccessActive,
  colorSuccessTextActive: managerLessValues.colorSuccessTextActive,
  colorSuccessTextHover: managerLessValues.colorSuccessTextHover,
  colorSuccessText: managerLessValues.colorSuccessText,
  colorWarningBg: managerLessValues.colorWarningBg,
  colorWarningBgHover: managerLessValues.colorWarningBgHover,
  colorWarningBorder: managerLessValues.colorWarningBorder,
  colorWarningBorderHover: managerLessValues.colorWarningBorderHover,
  colorWarningHover: managerLessValues.colorWarningHover,
  colorWarningTextHover: managerLessValues.colorWarningTextHover,
  colorWarningText: managerLessValues.colorWarningText,
  colorWarningActive: managerLessValues.colorWarningActive,
  colorWarningTextActive: managerLessValues.colorWarningTextActive,
  colorErrorText: managerLessValues.colorErrorText,
  colorErrorBg: managerLessValues.colorErrorBg,
  colorErrorBgHover: managerLessValues.colorErrorBgHover,
  colorErrorBorder: managerLessValues.colorErrorBorder,
  colorErrorBorderHover: managerLessValues.colorErrorBorderHover,
  colorErrorHover: managerLessValues.colorErrorHover,
  colorErrorTextHover: managerLessValues.colorErrorTextHover,
  colorErrorActive: managerLessValues.colorErrorActive,
  colorErrorTextActive: managerLessValues.colorErrorTextActive,
  colorBgSpotlight: managerLessValues.colorBgSpotlight,
  colorBgMask: managerLessValues.colorBgMask,
  fontSize: managerLessValues.fontSizeBase,
};

const antdManagerTheme: ThemeConfig = {
  ...antdDefaultTheme,
  token: {
    ...(antdDefaultTheme.token || {}),
    ...antdManagerThemeTokens,
  },
};

export default antdManagerTheme;
