/* stylelint-disable @stylistic/block-opening-brace-space-before */
/* stylelint-disable declaration-property-value-disallowed-list */
/* stylelint-disable property-disallowed-list */
@use 'sass:map';
@use './../colors/tokens.scss' as color;
@use './../spacing/tokens.scss' as spacing;
@use './tokens';

/**
  Generates border, i. e.:
  border: 2px solid $primary-dark;
*/
@mixin border($width, $style, $color) {
  @if map.has-key(spacing.$pixel-tokens, $width) and
    map.has-key(tokens.$border-styles, $style) and
    map.has-key(color.$colors, $color)
  {
    border: map.get(spacing.$pixel-tokens, $width)
      map.get(tokens.$border-styles, $style)
      map.get(color.$colors, $color);
  } @else {
    @error 'Unknown border parameter. Please check foundations/borders/mixins.scss for accepted arguments.';
  }
}

/**
 Generates outline i.e. outline: 2px solid $primary-dark;
*/
@mixin outline($width, $style, $color) {
  @if map.has-key(spacing.$pixel-tokens, $width) and
    map.has-key(tokens.$border-styles, $style) and
    map.has-key(color.$colors, $color)
  {
    outline: map.get(spacing.$pixel-tokens, $width)
      map.get(tokens.$border-styles, $style)
      map.get(color.$colors, $color);
    outline-offset: -(map.get(spacing.$pixel-tokens, $width));
  } @else {
    @error 'Unknown border parameter. Please check foundations/borders/mixins.scss for accepted arguments.';
  }
}

@mixin border-radius($width) {
  @if map.has-key(spacing.$pixel-tokens, $width) {
    border-radius: map.get(spacing.$pixel-tokens, $width);
  } @else {
    @error 'Unknown border-radius of #{$width}. It can only be "1px", "2px" or "3px"';
  }
}

@mixin border-none() {
  border: none;
}

@mixin outline-none() {
  outline: none;
}
