@use '../pseudo/index' as *;
@use '../dive/index' as *;

@use '../../helpers/strings' as *;
@use '../../helpers/numbers' as *;

@mixin increment-list(
    $increments,
    $label,
    $property,
    $value,
    $negatives,
    $pseudos,
    $dives
) {
    @each $increment in $increments {
        $newLabel: '';
        $newValue: $value * $increment;

        @if $increment != 1 and $increment != 0 and $increment != -1 {
            @if $negatives and $increment < 0 {
                @if is-decimal($increment) {
                    $newLabel: -#{$label}-#{second-char($increment)}\.#{slice-end($increment, 4)};
                } @else {
                    $newLabel: -#{$label + $increment};
                }
            } @else {
                @if is-decimal($increment) {
                    $newLabel: #{$label}-#{first-char($increment)}\.#{slice-end($increment, 3)};
                } @else {
                    $newLabel: #{$label}-#{$increment};
                }
            }
        }

        @if $newLabel != '' {
            .#{$newLabel} {
                #{$property}: $newValue !important;
            }
            
            @if $pseudos {
                @include pseudify($newLabel, $property, $newValue, $pseudos);
            }
    
            @if $dives {
                @include diver($newLabel, $property, $newValue);
            }
        }

    }
}
