@use "sass:map";
@use "../../dev" as *;
@use "../../variables" as *;

/// Shape radius tokens
$object_shape_radius: (
    squared: 0,
    rounded: q(2),
    pill: 50vh
) !default;

/// General-purpose shape mixin
/// @param {String} $variant - One of `squared`, `rounded`, `pill`
/// @group ObjectShape
@mixin object--corner($variant) {
    @if map.has-key($object_shape_radius, $variant) {
        border-radius: map.get($object_shape_radius, $variant) !important;
    } @else {
        @warn "Unknown shape variant: #{$variant}";
    }
}

/// Mixin to apply rounded corners to specific corners of an element.
/// @param {Number} $top-left - The radius for the top-left corner.
/// @param {Number} $top-right - The radius for the top-right corner.
/// @param {Number} $bottom-right - The radius for the bottom-right corner.
/// @param {Number} $bottom-left - The radius for the bottom-left corner.
@mixin object--corner--custom(
    $top-left: 0,
    $top-right: 0,
    $bottom-right: 0,
    $bottom-left: 0
) {
    border-top-left-radius: $top-left !important;
    border-top-right-radius: $top-right !important;
    border-bottom-right-radius: $bottom-right !important;
    border-bottom-left-radius: $bottom-left !important;
}

/// Mixin for setting a border radius of 0 (no border radius).
@mixin object--corner--0 {
    border-radius: 0;
}

/// Mixin for setting a border radius of 50% (creates a circular border radius for square elements).
@mixin object--corner--50 {
    border-radius: 50%;
}

/// Mixin for setting a border radius of 100% (makes an element fully round).
@mixin object--corner--100 {
    border-radius: 100%;
}

/// Specific mixins for shape variants
@mixin object--corner--squared {
    @include object--corner(squared);
}

@mixin object--corner--rounded {
    @include object--corner(rounded);
}

@mixin object--corner--pill {
    @include object--corner(pill);
}

/// Generate utility classes for each shape variant
@each $key, $val in $object_shape_radius {
    .object--corner--#{$key} {
        border-radius: $val !important;
    }
}

// @mixin border_radius { @include border_radius_04; }

// Border Radius Classes
// ----------------------------------------------------------------------------

// /// Class to apply rounded corners only to the top of an element.
// .border_rounded--top {
//     @include rounded_corners(q(4), q(5));
// }

// Applying Mixins for Border Radius
// .border_radius_small { @include border_radius(4); }
// .border_radius_medium { @include border_radius(8); }
// .border_radius_large { @include border_radius(12); }
// .border_radius_circle { @include border_radius(24); }
