@mixin oui-button-theme($theme) {
  $primary: map-get($theme, primary);
  $accent: map-get($theme, accent);
  $warn: map-get($theme, warn);
  $background: map-get($theme, background);
  $foreground: map-get($theme, foreground);
  .oui-button {
    @include oui-button-theme-palette($theme);
    @include oui-progress-button-stages($theme);
  }
  .oui-link-button {
    @include oui-link-button-theme-palette($theme);
    @include oui-progress-link-button-stages($theme);
  }
  .oui-ghost-button {
    @include oui-ghost-button-theme-palette($theme);
    @include oui-progress-ghost-button-stages($theme);
  }
}
/*generating themes for oui-button(Primary buttons)*/
@mixin oui-button-theme-palette($theme) {
  $primary: map-get($theme, primary);
  $accent: map-get($theme, accent);
  $warn: map-get($theme, warn);
  $background: map-get($theme, background);
  $foreground: map-get($theme, foreground);
  &.oui-primary {
    background: map-get($primary, default);
    color: map-get($primary, default-contrast);
    &:hover,
    &[class^='cdk'],
    &.cdk-keyboard-focused {
      background: map-get($primary, darker);
      color: map-get($primary, default-contrast);
    }
  }
  &.oui-accent {
    background: map-get($accent, default);
    color: map-get($accent, default-contrast);
    &:hover,
    &[class^='cdk'],
    &.cdk-keyboard-focused {
      background: map-get($accent, darker);
      color: map-get($accent, default-contrast);
    }
  }
  &.oui-warn {
    background: map-get($warn, default);
    color: map-get($warn, default-contrast);
    &:hover,
    &[class^='cdk'],
    &.cdk-keyboard-focused {
      background: map-get($warn, darker);
      color: map-get($warn, default-contrast);
    }
  }
  &.oui-primary[disabled],
  &.oui-accent[disabled],
  &.oui-warn[disabled] {
    background: map-get($background, disabled-button);
    color: map-get($foreground, disabled-button);
  }
}

/*generating themes for oui-link-button(link buttons)*/
@mixin oui-link-button-theme-palette($theme) {
  $primary: map-get($theme, primary);
  $accent: map-get($theme, accent);
  $warn: map-get($theme, warn);
  $foreground: map-get($theme, foreground);
  &.oui-primary {
    color: $oui-blue;
  }
  &.oui-accent {
    color: $oui-blue;
  }
  &.oui-warn {
    color: $oui-blue;
  }
  &.oui-primary[disabled],
  &.oui-accent[disabled],
  &.oui-warn[disabled] {
    color: map-get($foreground, disabled-ghost-button);
  }
}

/*generating themes for oui-ghost-button(ghost buttons)*/
@mixin oui-ghost-button-theme-palette($theme) {
  $primary: map-get($theme, primary);
  $accent: map-get($theme, accent);
  $warn: map-get($theme, warn);
  $background: map-get($theme, background);
  $foreground: map-get($theme, foreground);
  &.oui-primary {
    color: map-get($primary, default);
    border-color: map-get($primary, default);
    &:hover,
    &[class^='cdk'],
    &.cdk-keyboard-focused {
      background: map-get($primary, darker);
      color: map-get($primary, default-contrast);
    }
  }
  &.oui-accent {
    color: map-get($accent, default);
    border-color: map-get($accent, default);
    &:hover,
    &[class^='cdk'],
    &.cdk-keyboard-focused {
      background: map-get($accent, darker);
      color: map-get($accent, default-contrast);
    }
  }
  &.oui-warn {
    color: map-get($warn, default);
    border-color: map-get($warn, default);
    &:hover,
    &[class^='cdk'],
    &.cdk-keyboard-focused {
      background: map-get($warn, darker);
      color: map-get($warn, default-contrast);
    }
  }
  &.oui-primary[disabled],
  &.oui-accent[disabled],
  &.oui-warn[disabled],
  &.oui-stage-progress {
    color: map-get($foreground, disabled-link-button);
    border-color: map-get($background, disabled-button-border);
  }
}

@mixin oui-progress-button-stages($theme) {
  $foreground: map-get($theme, foreground);
  &.oui-stage-progress {
    color: map-get($foreground, text) !important;
  }
  &.oui-stage-done {
    color: map-get($foreground, text) !important;
  }
}
@mixin oui-progress-link-button-stages($theme) {
  $foreground: map-get($theme, foreground);
  &.oui-stage-progress {
    color: map-get($foreground, text) !important;
  }
  &.oui-stage-done {
    color: map-get($foreground, text) !important;
  }
}
@mixin oui-progress-ghost-button-stages($theme) {
  $foreground: map-get($theme, foreground);
  &.oui-stage-progress {
    color: map-get($foreground, text) !important;
  }
  &.oui-stage-done {
    color: map-get($foreground, text) !important;
  }
}
