@use '../../m2/palette';
@use './md-sys-color-internal';
@use 'sass:map';

@function md-sys-color-values-dark($palettes) {
  $values: (
    primary: map.get($palettes, primary, default),
    on-primary: map.get($palettes, primary, default-contrast),
    inverse-primary: map.get($palettes, primary, 600),
    secondary: map.get($palettes, accent, default),
    on-secondary: map.get($palettes, accent, default-contrast),
    inverse-secondary: map.get($palettes, accent, 600),
    error: map.get($palettes, warn, default),
    on-error: map.get($palettes, warn, default-contrast),
    inverse-error: map.get($palettes, warn, 600),
    shadow: black,
    surface: map.get(palette.$grey-palette, 800),
    on-surface: white,
    surface-variant: #4a4a4a,
    on-surface-variant: rgba(white, 0.7),
    background: #303030,
    inverse-surface: white,
    inverse-on-surface: rgba(black, 0.87),
    outline: rgba(white, 0.12),
    outline-variant: rgba(white, 0.38),
    error-container: map.get($palettes, warn, 900),
    on-background: white,
    on-error-container: map.get($palettes, warn, 50),
    on-primary-container: map.get($palettes, primary, 50),
    on-primary-fixed: map.get($palettes, primary, default-contrast),
    on-primary-fixed-variant: map.get($palettes, primary, default-contrast),
    on-secondary-container: map.get($palettes, accent, 50),
    on-secondary-fixed: map.get($palettes, accent, default-contrast),
    on-secondary-fixed-variant: map.get($palettes, accent, default-contrast),
    on-tertiary: map.get($palettes, accent, default-contrast),
    on-tertiary-container: map.get($palettes, accent, 50),
    on-tertiary-fixed: map.get($palettes, accent, default-contrast),
    on-tertiary-fixed-variant: map.get($palettes, accent, default-contrast),
    primary-container: map.get($palettes, primary, 900),
    primary-fixed: map.get($palettes, primary, default),
    primary-fixed-dim: map.get($palettes, primary, default),
    scrim: black,
    secondary-container: map.get($palettes, accent, 900),
    secondary-fixed: map.get($palettes, accent, default),
    secondary-fixed-dim: map.get($palettes, accent, default),
    surface-bright: map.get(palette.$grey-palette, 800),
    surface-container: map.get(palette.$grey-palette, 800),
    surface-container-high: map.get(palette.$grey-palette, 800),
    surface-container-highest: map.get(palette.$grey-palette, 800),
    surface-container-low: map.get(palette.$grey-palette, 800),
    surface-container-lowest: map.get(palette.$grey-palette, 800),
    surface-dim: map.get(palette.$grey-palette, 800),
    surface-tint: map.get(palette.$grey-palette, 800),
    tertiary: map.get($palettes, accent, default),
    tertiary-container: map.get($palettes, accent, 900),
    tertiary-fixed: map.get($palettes, accent, default),
    tertiary-fixed-dim: map.get($palettes, accent, default),
  );

  $values: map.merge($values, md-sys-color-internal.values-dark($palettes));

  @return $values;
}

@function md-sys-color-values-light($palettes) {
  $values: (
    primary: map.get($palettes, primary, default),
    on-primary: map.get($palettes, primary, default-contrast),
    inverse-primary: map.get($palettes, primary, 300),
    secondary: map.get($palettes, accent, default),
    on-secondary: map.get($palettes, accent, default-contrast),
    inverse-secondary: map.get($palettes, accent, 300),
    error: map.get($palettes, warn, default),
    on-error: map.get($palettes, warn, default-contrast),
    inverse-error: map.get($palettes, warn, 300),
    shadow: black,
    surface: white,
    on-surface: rgba(black, 0.87),
    surface-variant: #f6f6f6,
    on-surface-variant: rgba(black, 0.54),
    background: map.get(palette.$grey-palette, 50),
    inverse-surface: map.get(palette.$grey-palette, 800),
    inverse-on-surface: white,
    outline: rgba(black, 0.12),
    outline-variant: rgba(black, 0.38),
    error-container: map.get($palettes, warn, 50),
    on-background: rgba(black, 0.87),
    on-error-container: map.get($palettes, warn, 700),
    on-primary-container: map.get($palettes, primary, 700),
    on-primary-fixed: map.get($palettes, primary, default-contrast),
    on-primary-fixed-variant: map.get($palettes, primary, default-contrast),
    on-secondary-container: map.get($palettes, accent, 700),
    on-secondary-fixed: map.get($palettes, accent, default-contrast),
    on-secondary-fixed-variant: map.get($palettes, accent, default-contrast),
    on-tertiary: map.get($palettes, accent, default-contrast),
    on-tertiary-container: map.get($palettes, accent, 700),
    on-tertiary-fixed: map.get($palettes, accent, default-contrast),
    on-tertiary-fixed-variant: map.get($palettes, accent, default-contrast),
    primary-container: map.get($palettes, primary, 50),
    primary-fixed: map.get($palettes, primary, default),
    primary-fixed-dim: map.get($palettes, primary, default),
    scrim: black,
    secondary-container: map.get($palettes, accent, 50),
    secondary-fixed: map.get($palettes, accent, default),
    secondary-fixed-dim: map.get($palettes, accent, default),
    surface-bright: white,
    surface-container: white,
    surface-container-high: white,
    surface-container-highest: white,
    surface-container-low: white,
    surface-container-lowest: white,
    surface-dim: white,
    surface-tint: white,
    tertiary: map.get($palettes, accent, default),
    tertiary-container: map.get($palettes, accent, 50),
    tertiary-fixed: map.get($palettes, accent, default),
    tertiary-fixed-dim: map.get($palettes, accent, default),
  );

  $values: map.merge($values, md-sys-color-internal.values-light($palettes));

  @return $values;
}
