@import './variables';
@import '../colors/variables';

@mixin telia-border-radius($type, $corner: all) {
  @if not map_has_key($border-radius-properties, $corner) {
    @error 'Unknown border radius corner "#{$corner}"';
  }
  @if not map_has_key($border-radiuses, $type) {
    @error 'Unknown border radius type #{$type}';
  }

  #{map-get($border-radius-properties, $corner)}: map-get(
    $border-radiuses,
    $type
  );
}

@mixin telia-border($color, $width: xs, $sides: all) {
  // Check for unvalid attributes
  @if not map_has_key($border-widths, $width) {
    @error 'Unknown border width "#{$width}"';
  }
  @if not map_has_key($colors, $color) {
    @error 'Unknown border color "#{$color}"';
  }
  @if not map_has_key($border-side-properties, $sides) {
    @error 'Unknown border side option "#{$sides}"';
  }

  $width-value: map-get($border-widths, $width);
  $style-value: solid;
  $color-value: map-get($colors, $color);

  // Set the border CSS property
  #{map-get($border-side-properties, $sides)}: $width-value $style-value
    $color-value;
}
