@use '@angular/material' as mat;
@use 'material-functions' as functions;
@use 'material-mixins' as mixins;
@use 'material-fixes' as fixes;
@use '../components/tablePure' as table;
@use '../components/nav-bar' as nav;
@import 'material-typography';
@import 'material-palettes';

@mixin light-theme($primary, $accent, $warn, $set-mat-colors) {
  $theme: functions.define-light-theme(
    (
      color: (
        primary: $primary,
        accent: $accent,
        warn: $warn,
      ),
    )
  );
  @if $set-mat-colors {
    @include mat.all-component-colors($theme);
  }
  @include mixins.apply-mixins($primary, $light-theme-background-palette, $light-theme-foreground-palette, $warn);
  @include table.apply-table-styles($light-theme-background-palette);
}

@mixin dark-theme($primary, $accent, $warn) {
  $theme: functions.define-dark-theme(
    (
      color: (
        primary: $primary,
        accent: $accent,
        warn: $warn,
      ),
    )
  );
  @include mat.all-component-colors($theme);
  @include mixins.apply-mixins($primary, $dark-theme-background-palette, $dark-theme-foreground-palette, $warn);
  @include table.apply-table-styles($dark-theme-background-palette);
}

@mixin apply-themes($primary, $accent, $warn, $set-mat-colors: true) {
  @include mat.button-density(0);
  @include light-theme($primary, $accent, $warn, $set-mat-colors);

  &.theme-dark {
    @include dark-theme($primary, $accent, $warn);
  }
}

@mixin apply-mat-core($theme) {
  @include mat.core();
  @include mat.typography-hierarchy($custom-typography-config);
  @include mat.all-component-themes($theme);
}

