import React from "react";
import { classes, privateTokens } from "../Rating.tokens";
import { IconStarFill16, IconStarFill24, IconStarFill36, IconStarHalfFill16, IconStarHalfFill24, IconStarHalfFill36, IconStarOutline16, IconStarOutline24, IconStarOutline36 } from "../../_Icon";
import { Star } from "../Rating.styles";
const iconMap = (componentSize)=>{
    const iconProps = {
        color: 'inherit',
        sizeCustomProperty: privateTokens.iconSize
    };
    switch(componentSize){
        case 'displayL':
        case 'displayM':
        case 'displayS':
        case 'h1':
        case 'h2':
            return {
                fill: /*#__PURE__*/ React.createElement(IconStarFill36, iconProps),
                halfFill: /*#__PURE__*/ React.createElement(IconStarHalfFill36, iconProps),
                outline: /*#__PURE__*/ React.createElement(IconStarOutline36, iconProps)
            };
        case 'h3':
        case 'h4':
        case 'h5':
        case 'h6':
        case 'l':
        case 'm':
            return {
                fill: /*#__PURE__*/ React.createElement(IconStarFill24, iconProps),
                halfFill: /*#__PURE__*/ React.createElement(IconStarHalfFill24, iconProps),
                outline: /*#__PURE__*/ React.createElement(IconStarOutline24, iconProps)
            };
        case 's':
        case 'xs':
        case 'xxs':
            return {
                fill: /*#__PURE__*/ React.createElement(IconStarFill16, iconProps),
                halfFill: /*#__PURE__*/ React.createElement(IconStarHalfFill16, iconProps),
                outline: /*#__PURE__*/ React.createElement(IconStarOutline16, iconProps)
            };
        default:
            return {
                fill: /*#__PURE__*/ React.createElement(IconStarFill24, iconProps),
                halfFill: /*#__PURE__*/ React.createElement(IconStarHalfFill24, iconProps),
                outline: /*#__PURE__*/ React.createElement(IconStarOutline24, iconProps)
            };
    }
};
export const getIcons = ({ innerValue, size, iconQuantity = 5, iconSlot, iconSlotOutline, iconSlotHalf })=>{
    const { fill, halfFill, outline } = iconMap(size);
    if (iconQuantity === 1) {
        return /*#__PURE__*/ React.createElement(Star, {
            className: classes.singleIcon
        }, iconSlot || fill);
    }
    const filledIcons = Array.from({
        length: Math.floor(Number(innerValue))
    }, (_, index)=>/*#__PURE__*/ React.createElement(Star, {
            key: `filled_${index}_${innerValue}`
        }, iconSlot || fill));
    if (Number(innerValue) > 0 && !Number.isInteger(Number(innerValue))) {
        filledIcons.push(/*#__PURE__*/ React.createElement(Star, {
            key: "half-fill"
        }, iconSlotHalf || halfFill));
    }
    const outlineIconsLength = iconQuantity - filledIcons.length;
    const outlineIcons = Array.from({
        length: outlineIconsLength
    }, (_, index)=>/*#__PURE__*/ React.createElement(Star, {
            key: `outline_${index}_${innerValue}`,
            className: classes.iconOutline
        }, iconSlotOutline || outline));
    return [
        ...filledIcons,
        ...outlineIcons
    ];
};
