var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { FluentIcon } from '../../../../utilities/iconLibrary';
import './UdpActionCard.css';
/**
 * UdpActionCard - An accessible workflow card component
 *
 * @param {Object} props
 * @param {React.Component} props.icon - Fluent UI icon component
 * @param {string} props.iconColor - Icon color (CSS var, hex, or system color: info, warning, error, success, note)
 * @param {string} props.primaryText - Main heading text
 * @param {string} props.secondaryText - Description text
 * @param {string} [props.href] - External link URL
 * @param {string} [props.to] - React Router link path
 * @param {function} [props.onClick] - Click handler
 * @param {string} [props.className] - Additional CSS classes
 */
export const UdpActionCard = (_a) => {
    var { icon, iconColor = 'info', primaryText, secondaryText, href, to, onClick, className = '' } = _a, rest = __rest(_a, ["icon", "iconColor", "primaryText", "secondaryText", "href", "to", "onClick", "className"]);
    // Resolve icon color to CSS variable or direct value
    const getIconColor = () => {
        const systemColors = {
            info: 'var(--info-color-main)',
            warning: 'var(--warning-color-main)',
            error: 'var(--error-color-main)',
            success: 'var(--success-color-main)',
            note: 'var(--note-color-main)',
            primary: 'var(--primary-color-main)',
            secondary: 'var(--secondary-color-main)',
        };
        // Check if it's a system color
        if (systemColors[iconColor]) {
            return systemColors[iconColor];
        }
        // Check if it's already a CSS variable
        if (iconColor.startsWith('var(--')) {
            return iconColor;
        }
        // Otherwise, treat as hex or named color
        return iconColor;
    };
    const resolvedIconColor = getIconColor();
    // Safety check: ensure icon prop is provided
    if (!icon) {
        console.error('UdpActionCard: icon prop is required');
        return null;
    }
    // Card content
    const cardContent = (React.createElement(React.Fragment, null, React.createElement("div", { className: "udp-action-card__icon", style: { color: resolvedIconColor } }, React.createElement(FluentIcon, { component: icon, size: 48, customSize: true })), React.createElement("div", { className: "udp-action-card__content" }, React.createElement("div", { className: "udp-action-card__primary-text" }, primaryText), React.createElement("div", { className: "udp-action-card__secondary-text" }, secondaryText))));
    // Determine which element to render
    const commonProps = Object.assign({ className: `udp-action-card ${className}`, style: { '--card-border-color': resolvedIconColor } }, rest);
    // External link
    if (href) {
        return (React.createElement("a", Object.assign({}, commonProps, { href: href, rel: "noopener noreferrer" }), cardContent));
    }
    // Router link
    if (to) {
        return (React.createElement(Link, Object.assign({}, commonProps, { to: to }), cardContent));
    }
    // Button with onClick
    if (onClick) {
        return (React.createElement("button", Object.assign({}, commonProps, { onClick: onClick, type: "button" }), cardContent));
    }
    // Default: non-interactive div
    return (React.createElement("div", Object.assign({}, commonProps, { role: "article" }), cardContent));
};
UdpActionCard.propTypes = {
    icon: PropTypes.elementType.isRequired,
    iconColor: PropTypes.string,
    primaryText: PropTypes.string.isRequired,
    secondaryText: PropTypes.string.isRequired,
    href: PropTypes.string,
    to: PropTypes.string,
    onClick: PropTypes.func,
    className: PropTypes.string,
};
//# sourceMappingURL=UdpActionCard.js.map