//
// Copyright 2023 Google LLC
// SPDX-License-Identifier: Apache-2.0
//

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

$supported-tokens: (
    'active-indicator-color',
    'indicator-height',
    'indicator-shape',
    'indicator-width',
    'active-focus-icon-color',
    'active-focus-label-text-color',
    'active-focus-state-layer-color',
    'active-hover-icon-color',
    'active-hover-label-text-color',
    'active-hover-state-layer-color',
    'active-icon-color',
    'active-label-text-color',
    'active-label-text-weight',
    'active-pressed-icon-color',
    'active-pressed-label-text-color',
    'active-pressed-state-layer-color',
    'bottom-container-shape',
    'container-height',
    'container-shape',
    'container-shape-end-end',
    'container-shape-end-start',
    'container-shape-start-end',
    'container-shape-start-start',
    'container-width',
    'focus-state-layer-opacity',
    'headline-color',
    'headline-font',
    'headline-line-height',
    'headline-size',
    'headline-tracking',
    'headline-type',
    'headline-weight',
    'hover-state-layer-opacity',
    'icon-size',
    'inactive-focus-icon-color',
    'inactive-focus-label-text-color',
    'inactive-focus-state-layer-color',
    'inactive-hover-icon-color',
    'inactive-hover-label-text-color',
    'inactive-hover-state-layer-color',
    'inactive-icon-color',
    'inactive-label-text-color',
    'inactive-pressed-icon-color',
    'inactive-pressed-label-text-color',
    'inactive-pressed-state-layer-color',
    'label-text-font',
    'label-text-line-height',
    'label-text-size',
    'label-text-tracking',
    'label-text-type',
    'label-text-weight',
    'large-badge-label-color',
    'large-badge-label-font',
    'large-badge-label-line-height',
    'large-badge-label-size',
    'large-badge-label-tracking',
    'large-badge-label-type',
    'large-badge-label-weight',
    'modal-container-color',
    'modal-container-elevation',
    'pressed-state-layer-opacity',
    'standard-container-color',
    'standard-container-elevation'
);

// prettier-ignore
$unsupported-tokens: (

);

$_default: (
    'md-sys-color': md-sys-color.values-light(),
    'md-sys-elevation': md-sys-elevation.values(),
    'md-sys-shape': md-sys-shape.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-navigation-drawer.values($deps, $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,
        $renamed-tokens: (
            'active-indicator-height': 'indicator-height',
            'active-indicator-shape': 'indicator-shape',
            'active-indicator-width': 'indicator-width',
        )
    );

    @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-navigation-drawer-container-shape, #{$value});
            }

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

    @return $tokens;
}
