@use 'sass:map';
@use 'sass:meta';
@use '@angular/material' as mat;
@use '../core/tokens/m2-utils';

@function get-tokens($theme) {
  $system: m2-utils.get-system($theme);

  $is-dark: false;
  @if meta.type-of($theme) == 'map' {
    $is-dark: mat.get-theme-type($theme) == dark;
  }

  $hue: 100;
  @if $is-dark {
    $hue: 900;
  }

  @return (
    base: (
      alert-container-shape: 4px,
    ),
    color: (
      alert-outline-color: transparent,
      alert-background-color: mat.m2-get-color-from-palette(mat.$m2-gray-palette, $hue),
      alert-text-color: map.get($system, on-surface),

      alert-info-outline-color: transparent,
      alert-info-background-color: mat.m2-get-color-from-palette(mat.$m2-blue-palette, $hue),
      alert-info-text-color: map.get($system, on-surface),

      alert-success-outline-color: transparent,
      alert-success-background-color: mat.m2-get-color-from-palette(mat.$m2-green-palette, $hue),
      alert-success-text-color: map.get($system, on-surface),

      alert-warning-outline-color: transparent,
      alert-warning-background-color: mat.m2-get-color-from-palette(mat.$m2-amber-palette, $hue),
      alert-warning-text-color: map.get($system, on-surface),

      alert-danger-outline-color: transparent,
      alert-danger-background-color: mat.m2-get-color-from-palette(mat.$m2-red-palette, $hue),
      alert-danger-text-color: map.get($system, on-surface),
    ),
    typography: (),
    density: ()
  )
}
