@use "sass:map";
@use "../core/_index.scss" as *;

/// The border width of the Avatar.
/// @group avatar
$kendo-avatar-border-width: 1px !default;

/// The font family of the Avatar.
/// @group avatar
$kendo-avatar-font-family: var( --kendo-font-family, inherit ) !default;
/// The font size of the Avatar.
/// @group avatar
$kendo-avatar-font-size: var( --kendo-font-size, inherit ) !default;
/// The line height of the Avatar.
/// @group avatar
$kendo-avatar-line-height: var( --kendo-line-height, inherit ) !default;

/// The sizes map of the Avatar.
/// @group avatar
$kendo-avatar-sizes: (
    sm: k-spacing(4),
    md: k-spacing(8),
    lg: k-spacing(16)
) !default;

/// The theme variations for the Avatar.
/// @group avatar
$kendo-avatar-brand-colors: (
    primary: primary,
    error: error,
    success: success,
    info: info,
    secondary: if($kendo-enable-color-system, secondary, neutral),
    tertiary: tertiary,
 ) !default;

// Matrices with Avatar theme colors in the order: bg, color, border
$_tc-avatar-matrix: (
    solid: (
        normal: if($kendo-enable-color-system, (color, on-color, color), (100, $kendo-color-white, 100))
    ),
    outline: (
        normal: if($kendo-enable-color-system, (on-color, color, color), ($kendo-color-white, 100, 100))
    )
) !default;

$_tc-avatar-warning-matrix: (
    solid: (
        normal: if($kendo-enable-color-system, (color, on-color, color), (100, k-get-theme-color-var( neutral-160 ), 100))
    ),
    outline: (
        normal: if($kendo-enable-color-system, (app-surface, color, color), ($kendo-color-white, 100, 100))
    )
) !default;

$_tc-avatar-dark-matrix: (
    solid: (
        normal: if($kendo-enable-color-system, (color, on-color, color), (160, $kendo-color-white, 160))
    ),
    outline: (
        normal: if($kendo-enable-color-system, (on-color, color, color), ($kendo-color-white, 160, 160))
    )
) !default;

$_tc-avatar-light-matrix: (
    solid: (
        normal: if($kendo-enable-color-system, (color, on-color, color), (50, $kendo-color-white, 50))
    ),
    outline: (
        normal: if($kendo-enable-color-system, (app-surface, color, color), ($kendo-color-white, 50, 50))
    )
) !default;

/// The theme colors map for the Avatar variations.
/// @group avatar
$kendo-avatar-theme-colors: () !default;

@each $fill-mode, $ui-states in $_tc-avatar-matrix {
    @each $brand-color, $palette in $kendo-avatar-brand-colors {
        $kendo-avatar-theme-colors: map.deep-merge(
            $kendo-avatar-theme-colors,
            k-generate-fill-mode-theme-variation( $fill-mode, $brand-color, $palette, $ui-states )
        );
    };
}

@each $fill-mode, $ui-states in $_tc-avatar-warning-matrix {
    $kendo-avatar-theme-colors: map.deep-merge(
        $kendo-avatar-theme-colors,
        k-generate-fill-mode-theme-variation( $fill-mode, warning, warning, $ui-states )
    );
}

@each $fill-mode, $ui-states in $_tc-avatar-dark-matrix {
    $kendo-avatar-theme-colors: map.deep-merge(
        $kendo-avatar-theme-colors,
        k-generate-fill-mode-theme-variation( $fill-mode, dark, if($kendo-enable-color-system, dark, neutral), $ui-states )
    );
}

@each $fill-mode, $ui-states in $_tc-avatar-light-matrix {
    $kendo-avatar-theme-colors: map.deep-merge(
        $kendo-avatar-theme-colors,
        k-generate-fill-mode-theme-variation( $fill-mode, light, if($kendo-enable-color-system, light, neutral), $ui-states )
    );
}
