//
// Copyright 2025 Sandlada & Kai Orion
// SPDX-License-Identifier: MIT
//

@use 'sass:map';
@use 'sass:string';
@use './internal/shape';
@use './internal/validate';
@use './md-sys-color';
@use './md-sys-shape';
@use './md-sys-elevation';
@use './md-sys-state';
@use './md-sys-typescale';
@use './v0_192/md-comp-rich-tooltip';

$supported-tokens: (
    'action-focus-label-text-color',
    'action-focus-state-layer-color',
    'action-focus-state-layer-opacity',
    'action-hover-label-text-color',
    'action-hover-state-layer-color',
    'action-hover-state-layer-opacity',
    'action-label-text-color',
    'action-label-text-font',
    'action-label-text-line-height',
    'action-label-text-size',
    'action-label-text-tracking',
    'action-label-text-type',
    'action-label-text-weight',
    'action-pressed-label-text-color',
    'action-pressed-state-layer-color',
    'action-pressed-state-layer-opacity',
    'container-color',
    'container-elevation',
    'container-shadow-color',
    'container-shape',
    'container-shape-end-end',
    'container-shape-end-start',
    'container-shape-start-end',
    'container-shape-start-start',
    'subhead-color',
    'subhead-font',
    'subhead-line-height',
    'subhead-size',
    'subhead-tracking',
    'subhead-type',
    'subhead-weight',
    'supporting-text-color',
    'supporting-text-font',
    'supporting-text-line-height',
    'supporting-text-size',
    'supporting-text-tracking',
    'supporting-text-type',
    'supporting-text-weight'
);

// prettier-ignore
$unsupported-tokens: (
);

$_default: (
    'md-sys-color': md-sys-color.values-light(),
    'md-sys-shape': md-sys-shape.values(),
    'md-sys-elevation': md-sys-elevation.values(),
    'md-sys-state': md-sys-state.values(),
    'md-sys-typescale': md-sys-typescale.values(),
);

@function values($deps: $_default, $exclude-hardcoded-values: false, $exclude-custom-properties: false) {
    $tokens: md-comp-rich-tooltip.values($deps, $exclude-hardcoded-values: $exclude-hardcoded-values);

    $new-tokens: shape.get-new-logical-shape-tokens($tokens, 'container-shape');

    $tokens: validate.values($tokens, $supported-tokens: $supported-tokens, $unsupported-tokens: $unsupported-tokens, $new-tokens: $new-tokens);

    @if not $exclude-custom-properties {
        @each $token, $value in $tokens {
            @if string.index($token, 'container-shape-') ==1 {
                // Add fallback to shorthand for logical shape properties.
                $value: var(--md-rich-tooltip-container-shape, #{$value});
            }

            $tokens: map.set($tokens, $token, var(--md-rich-tooltip-#{$token}, #{$value}));
        }
    }

    @return $tokens;
}
