@use 'sass:map';
@use '../../../mx-core/src/base/colors';
@use '../../../mx-core/src/base/opacity';
@use '../../../mx-core/src/components/progress-spinner';

@mixin mx-status-theme($theme) {
  $is-dark: map.get($theme, is-dark);
  $current-theme: colors.$mx-light;

  @if $is-dark == true {
    $current-theme: colors.$mx-dark;
  }

  $status-types: (
    success: map.get($current-theme, successVivid),
    error: map.get($current-theme, errorVivid),
    warning: map.get($current-theme, warningVivid),
    neutral: rgba(map.get($current-theme, onSurface), opacity.$opacity-38)
  );

  .mx-status {
    @each $status-type, $color in $status-types {
      &--#{$status-type} {
        .mx-status__icon {
          color: $color;
        }
        .mx-status__status.mx-status__status--status-type {
          color: $color;
        }
      }
    }

    &__progressing:before {
      @include progress-spinner.spinner-border-color(map.get($current-theme, primary));
    }
    &__status {
      color: map.get($current-theme, onSurface);
      &--on-surface-variant {
        color: map.get($current-theme, onSurfaceVariant);
      }
    }
    &__supporting-text {
      color: map.get($current-theme, onSurfaceVariant);
    }
  }
}
