@use 'sass:map';
@use '~@angular/material' as mat;

@mixin color($theme) {
  $config: mat.get-color-config($theme);
  $foreground: map-get($config, foreground);
  $is-dark-theme: map-get($config, is-dark);
  $outline-color: mat.get-color-from-palette($foreground, divider, if($is-dark-theme, 0.3, 0.12));
  $outline-color-hover: mat.get-color-from-palette($foreground, divider, if($is-dark-theme, 1, 0.87));
  $label-color: mat.get-color-from-palette($foreground, secondary-text, if($is-dark-theme, 0.7, 0.6));

  mtna-field-set {
    & > fieldset {
      border-color: $outline-color;
    }
    &:hover > fieldset {
      border-color: $outline-color-hover;
    }
    & > fieldset > legend {
      color: $label-color;
    }
  }
}

@mixin typography($theme) {
}

@mixin theme($theme) {
  $config: mat.get-color-config($theme);
  @if $config != null {
    @include color($theme);
  }

  $typography-config: mat.get-typography-config($theme);
  @if $typography-config != null {
    @include typography($theme);
  }
}
