/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
@use 'sass:map';
@use 'sass:math';
@use 'sass:meta';
@use 'sass:string';
@use '../utils';
@use '../core/config';
@use '../tokens/elevation/tokens';

///
/// Emits custom property declarations for all default theme tokens.
/// 
@mixin properties {
  @each $token-name, $token-value in tokens.$tokens {
    @include utils.declare-var(elevation, $token-name, $token-value);
  }
}

///
/// Emits custom property declarations for all z-index theme tokens.
/// 
@mixin z-index-properties {
  @each $token-name, $token-value in tokens.$z-index-tokens {
    @include utils.declare-var(z-index, $token-name, $token-value);
  }
}


///
/// Returns a an elevation value specified by the provided elevation z-value.
/// 
@function value($level) {
  @return string.unquote(tokens.get($level));
}

///
/// Sets a `box-shadow` style specified by the provided elevation z-value.
/// 
@mixin box-shadow($level) {
  box-shadow: #{value($level)};
}

///
/// Sets the z-index of an element based on the level provided.
/// 
/// All z-index values are set as CSS custom properties, so they can be overridden globally.
/// 
@mixin z-index($level) {
  $value: map.get(tokens.$z-index-tokens, $level);
  z-index: var(--#{config.$prefix}-z-index-#{$level}, #{$value});
}

///
/// Returns a global z-index CSS custom property reference (with the fallback value) specified by the provided level.
/// 
/// @param {Number} $level - The z-index level to return.
///
@function z-index-variable($level) {
  @return utils.variable(z-index, tokens.$z-index-tokens, $level);
}
