//! Static CSS registry for zero-allocation animated icon CSS lookup
//!
//! This module provides pre-compiled static CSS data for animated icons,
//! implementing a zero-allocation registry pattern.
//!
//! 🤖 AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
//! Generated by: generate_animated_icon_registry.py

use super::animated_icon_type::AnimatedIconType;

/// Static CSS for Heart animation
static HEART_CSS: &str = r#"[data-name="HeartAnimate"]:hover {
    animation: HeartAnimation 1.2s ease-in-out;
}

@keyframes HeartAnimation {
    0% { transform: scale(1); }
    14% { transform: scale(1.15); }
    28% { transform: scale(1); }
    42% { transform: scale(1.08); }
    56% { transform: scale(1); }
    100% { transform: scale(1); }
}"#;

/// Static CSS for Plus animation
static PLUS_CSS: &str = r#"[data-name="PlusAnimate"] {
    transition: transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

[data-name="PlusAnimate"]:hover {
    transform: rotate(180deg);
}"#;

/// Get CSS for a specific animated icon
///
/// Returns None if the icon has no animation CSS.
/// This is a zero-allocation O(1) lookup.
pub fn get_icon_css(icon_type: AnimatedIconType) -> Option<&'static str> {
    match icon_type {
        AnimatedIconType::Heart => Some(HEART_CSS),
        AnimatedIconType::Plus => Some(PLUS_CSS),
    }
}

/// Check if an icon has animation CSS
pub fn has_animation_css(icon_type: AnimatedIconType) -> bool {
    get_icon_css(icon_type).is_some()
}

/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/*                        🧪 TESTS 🧪                         */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_css_registry_returns_static_references() {
        // Test that CSS registry returns static string references
        if let Some(css) = get_icon_css(AnimatedIconType::Heart) {
            // The CSS should be a static string reference
            let ptr1 = css.as_ptr();
            let css2 = get_icon_css(AnimatedIconType::Heart).unwrap();
            let ptr2 = css2.as_ptr();
            assert_eq!(ptr1, ptr2, "CSS should be static reference");
        }
    }

    #[test]
    fn test_has_animation_css_consistency() {
        // Test that has_animation_css is consistent with get_icon_css
        let icon = AnimatedIconType::Heart;
        let has_css = has_animation_css(icon);
        let css_option = get_icon_css(icon);

        assert_eq!(has_css, css_option.is_some());
    }
}
