@use 'sass:map';
@use '../mixins' as *;
@use '../functions' as *;
@use '../schemas/charts' as *;
@use '../../utils' as *;
@use '../../typography/mixins' as *;
@use '../../typography/functions' as *;

////
/// @package theming
/// @group themes
/// @access public
/// @author <a href="https://github.com/simeonoff" target="_blank">Simeon Simeonoff</a>
////

/// @param {Map} $schema [$light-material-schema] - The schema used as basis for styling the component.
/// @param {Map} $target ['angular'] - The target platform to be used when scoping the theme variables.
/// @param {Color} $others-category-fill [null] - Sets the fill color for others category.
/// @param {Number} $others-category-opacity [null] - Sets the opacity for others category.
/// @param {Color} $others-category-stroke [null] - Sets the others category stroke color.
/// @param {Number} $others-category-stroke-thickness [null] - Sets the others category stroke thickness.
/// @param {Color} $selected-slice-fill [null] - Sets the fill color of the selected slice.
/// @param {Number} $selected-slice-opacity [null] - Sets the opacity of the selected slice.
/// @param {Color} $selected-slice-stroke [null] - Sets the stroke color of the selected slice.
/// @param {Number} $selected-slice-stroke-thickness [null] - Sets the stroke thickness of the selected slice.
/// @requires extend
///
/// @example scss
///   $my-chart-theme: doughnut-chart-theme($brushes: (orange, blue, pink));
///   // Pass the theme to the css-vars mixin
///   @include css-vars($my-chart-theme);
@function doughnut-chart-theme(
    $schema: $light-material-schema,
    $target: 'angular',

    $brushes: null,
    $outlines: null,
    $others-category-fill: null,
    $others-category-opacity: null,
    $others-category-stroke: null,
    $others-category-stroke-thickness: null,
    $selected-slice-fill: null,
    $selected-slice-opacity: null,
    $selected-slice-stroke: null,
    $selected-slice-stroke-thickness: null
) {
    $name: 'doughnut-chart';
    $selector: map.get(
        (
            'angular': 'igx-doughnut-chart',
            'webc': 'igc-doughnut-chart',
            'blazor': 'igb-doughnut-chart',
        ),
        $target
    );
    $chart-schema: ();

    @if map.has-key($schema, $name) {
        $chart-schema: map.get($schema, $name);
    } @else {
        $chart-schema: $schema;
    }

    $theme: digest-schema($chart-schema);

    @return extend(
        $theme,
        (
            name: 'ring-series',
            selector: $selector,
            brushes: $brushes,
            outlines: $outlines,
            others-category-fill: $others-category-fill,
            others-category-opacity: $others-category-opacity,
            others-category-stroke: $others-category-stroke,
            others-category-stroke-thickness: $others-category-stroke-thickness,
            selected-slice-fill: $selected-slice-fill,
            selected-slice-opacity: $selected-slice-opacity,
            selected-slice-stroke: $selected-slice-stroke,
            selected-slice-stroke-thickness: $selected-slice-stroke-thickness,
        )
    );
}
