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

@mixin color($theme, $success) {
  $config: mat.get-color-config($theme);
  $primary: map.get($config, primary);
  $accent: map.get($config, accent);
  $background: map.get($config, background);
  $foreground: map.get($config, foreground);

  rds-c-packaging-option {
    .popover-button {
      &::after {
        background-color: mat.get-color-from-palette($background, background);
      }
      &.disabled {
        color: mat.get-color-from-palette($foreground, disabled-text);
      }
    }
  }
  rds-c-packaging-option.mat-primary {
    @include _rds-c-packaging-option-palette($primary);
  }
  rds-c-packaging-option.mat-accent {
    @include _rds-c-packaging-option-palette($accent);
  }
  rds-c-packaging-option.selected {
    border-color: mat.get-color-from-palette($success, default);
    header {
      color: mat.get-color-from-palette($success, default-contrast);
      background-color: mat.get-color-from-palette($success, default);
      .rds-c-selected-icon {
        color: mat.get-color-from-palette($success, default-contrast);
      }
    }
  }
  rds-c-packaging-processes.mat-primary {
    @include _rds-c-packaging-processes-palette($primary);
  }
  rds-c-packaging-processes.mat-accent {
    @include _rds-c-packaging-processes-palette($accent);
  }
  rds-c-packaging-processes {
    .mat-progress-spinner.success {
      circle {
        stroke: mat.get-color-from-palette($success, default);
      }
    }
  }
}

@mixin typography($theme) {
}

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

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

@mixin _rds-c-packaging-option-palette($themeColor) {
  border-color: mat.get-color-from-palette($themeColor, default);
  header {
    color: mat.get-color-from-palette($themeColor, default-contrast);
    background-color: mat.get-color-from-palette($themeColor, default);
  }
}

@mixin _rds-c-packaging-processes-palette($themeColor) {
  header {
    color: mat.get-color-from-palette($themeColor, default-contrast);
    background-color: mat.get-color-from-palette($themeColor, default);
  }
}
