// see colors-ecl.scss for default values from ECL
$eui-base-colors-raw: (
    'primary': #004494,
    'grey-100': #303030, // fix to 4.5+ contrast ratio
    'info': #006fb4,
    'info-hc': #005a92,
    'success': #467a39,
    'success-hc': #136100,
    'warning': #f29527,
    'warning-hc': #ffaf4e,
    'red': #da2131,
    'red-hc': #b50000,
    'v4-yellow-100': #fc0,
);

$eui-base-colors: (
    primary: map-get($eui-base-colors-raw, 'primary'),
    neutral: map-get($eui-base-colors-raw, 'grey-100'),
    info: map-get($eui-base-colors-raw, 'info'),
    info-hc: map-get($eui-base-colors-raw, 'info-hc'),
    success: map-get($eui-base-colors-raw, 'success'),
    success-hc: map-get($eui-base-colors-raw, 'success-hc'),
    warning: map-get($eui-base-colors-raw, 'warning'),
    warning-hc: map-get($eui-base-colors-raw, 'warning-hc'),
    danger: map-get($eui-base-colors-raw, 'red'),
    danger-hc: map-get($eui-base-colors-raw, 'red-hc'),
    accent: map-get($eui-base-colors-raw, 'v4-yellow-100'),
);

@function getBaseColor($variant) {
    @return map-get($eui-base-colors, $variant);
}

$eui-base-tokens-colors: (
    // 2: forced default main bg color
    grey: getPalette(getBaseColor(neutral), (2:#fcfcfd), true), // hsl(210, 20%, 99%) => a bit lighter than #f9fafb
    primary: getPalette(getBaseColor(primary)),
    info: getPalette(getBaseColor(info), (75: #2277ab)), // AA OK
    success: getPalette(getBaseColor(success), (75: #5d7d55)), // AA OK
    warning: getPalette(
        getBaseColor(warning),
        (
            140: getColorVariant(getBaseColor(warning) , 160), // AA OK
            130: getColorVariant(getBaseColor(warning) , 150), // AA OK
            120: getColorVariant(getBaseColor(warning) , 140), // AA OK
        )
    ),
    danger: getPalette(getBaseColor(danger), (75: #c14b55)),  // AA OK
    accent: getPalette(getBaseColor(accent), (140: #896d00)), // AA OK

    // specific color usage, has to be define to have inversion in dark-mode
    extra-code: (
        100: getColorVariant(#b80056, 100),
        25: getColorVariant(#b80056, 25),
    )
);

$eui-base-tokens-colors-dark: (
    grey: mapReverseValues(map-get($eui-base-tokens-colors, grey)),
    primary: mapReverseValues(map-get($eui-base-tokens-colors, primary)),
    info: mapReverseValues(map-get($eui-base-tokens-colors, info)),
    success: mapReverseValues(map-get($eui-base-tokens-colors, success)),
    warning: mapReverseValues(map-get($eui-base-tokens-colors, warning)),
    danger: mapReverseValues(map-get($eui-base-tokens-colors, danger)),
    accent: mapReverseValues(map-get($eui-base-tokens-colors, accent)),
    extra-code: mapReverseValues(map-get($eui-base-tokens-colors, extra-code)),
);

$eui-base-tokens-colors-high-contrast: (
    // 2: forced default main bg color - 65: AA OK
    grey: getPalette(
        getBaseColor(neutral),
        (
            2:#fff,
            5: #fff,
            25: getColorVariant(getBaseColor(neutral) , 80),
            50: getColorVariant(getBaseColor(neutral) , 80),
            75: getColorVariant(getBaseColor(neutral) , 80)
        ), true),
    primary: getPalette(
        getBaseColor(primary),
        (
            50: getColorVariant(getBaseColor(primary) , 90), // AAA OK
            75: getColorVariant(getBaseColor(primary) , 95), // AAA OK
        )
    ),
    info: getPalette(
        getBaseColor(info-hc),
        (
            50: getColorVariant(getBaseColor(info-hc) , 100), // AAA OK
            75: getColorVariant(getBaseColor(info-hc) , 100), // AAA OK
        )
        ),
    success: getPalette(
        getBaseColor(success-hc),
        (
            50: getColorVariant(getBaseColor(success-hc) , 100), // AAA OK
            75: getColorVariant(getBaseColor(success-hc) , 100), // AAA OK
        )
    ),
    warning: getPalette(
        getBaseColor(warning-hc),
        (
            140: getColorVariant(getBaseColor(warning-hc) , 170), // AAA OK
            130: getColorVariant(getBaseColor(warning-hc) , 165), // AAA OK
            120: getColorVariant(getBaseColor(warning-hc) , 160), // AAA OK
            110: getColorVariant(getBaseColor(warning-hc) , 155), // AAA OK
            50: getColorVariant(getBaseColor(warning-hc) , 100), // AAA OK
            75: getColorVariant(getBaseColor(warning-hc) , 100), // AAA OK
        )
    ),
    danger: getPalette(
        getBaseColor(danger-hc),
        (
            50: getColorVariant(getBaseColor(danger-hc) , 100), // AAA OK
            75: getColorVariant(getBaseColor(danger-hc) , 100), // AAA OK
        )
    ),
    accent: getPalette(
        getBaseColor(accent),
        (
            140: getColorVariant(getBaseColor(accent) , 165), // AAA OK
            130: getColorVariant(getBaseColor(accent) , 162), // AAA OK
            120: getColorVariant(getBaseColor(accent) , 158), // AAA OK
            50: getColorVariant(getBaseColor(accent) , 100), // AAA OK
            75: getColorVariant(getBaseColor(accent) , 100), // AAA OK
        )
    ),

    // specific color usage, has to be define to have inversion in dark-mode
    extra-code: (
        100: getColorVariant(#b80056, 140),
        25: getColorVariant(#b80056, 25),
    )
);
