/*!
 * SPDX-License-Identifier: Apache-2.0
 *
 * The OpenSearch Contributors require contributions made to
 * this file be licensed under the Apache-2.0 license or a
 * compatible open source license.
 *
 * Modifications Copyright OpenSearch Contributors. See
 * GitHub history for details.
 */

@function ouiCallOutColor($type: 'primary', $returnBackgroundOrForeground: 'background') {
  @if (map-has-key($ouiCallOutTypes, $type)) {
    $color: map-get($ouiCallOutTypes, $type);
    $backgroundColor: tintOrShade($color, 90%, 70%);
    $foregroundColor: shadeOrTint(makeHighContrastColor($color, $backgroundColor), 0%, 20%);

    @if ($returnBackgroundOrForeground == 'background') {
      @return $backgroundColor;
    } @else if ($returnBackgroundOrForeground == 'foreground') {
      @return $foregroundColor;
    } @else {
      @warn 'Incorrect value provided as $returnBackgroundOrForeground';
    }
  } @else {
    @warn 'Incorrect type of call out provided. See the $ouiCallOutTypes map for allowed values.';
  }
}

@mixin ouiCallOutTitle($size: null) {
  @if ($size == 's') {
    @include ouiTitle('xxs');
    font-weight: $ouiFontWeightRegular;
  } @else {
    @include ouiTitle('xs');
    font-weight: $ouiFontWeightRegular;
  }
}


/* OUI -> EUI Aliases */
@function euiCallOutColor($type: 'primary', $returnBackgroundOrForeground: 'background') { @return ouiCallOutColor($type, $returnBackgroundOrForeground); }
@mixin euiCallOutTitle($size: null) { @include ouiCallOutTitle($size); }
/* End of Aliases */
