"""
Core logic modules for Text Texture Generator addon.
Phase 2 refactoring: Independent core functionality modules.
"""

# Normal map generation functionality (conditionally for free version)
try:
    pass
    from .normal_maps import generate_normal_map_from_alpha
    NORMAL_MAPS_AVAILABLE = True
except ImportError:
    pass
    # Free version - no normal maps functionality
    NORMAL_MAPS_AVAILABLE = False
    def generate_normal_map_from_alpha(*args, **kwargs):
        pass
        """Mock function for free version"""
        return None

# Core texture generation functions
from .generation_engine import generate_texture_image, generate_preview

# Text fitting and positioning helpers
from .text_fitting import (
    calculate_available_text_area,
    largest_rectangle_in_histogram,
    calculate_text_position,
    find_optimal_font_size,
    calculate_text_scaling,
    check_text_overlap,
    resolve_text_conflicts
)

# Text processing and rendering functions
from .text_processor import (
    wrap_text_to_width,
    render_text_with_stroke,
    calculate_text_metrics,
    apply_text_effects,
    optimize_text_layout,
    rectangles_overlap,
    find_non_overlapping_position,
    validate_text_rendering
)

# Export all functions for easy importing
__all__ = [
    # Core generation functions
    'generate_texture_image',
    'generate_preview',
    
    # Normal maps
    'generate_normal_map_from_alpha',
    
    # Text fitting
    'calculate_available_text_area',
    'largest_rectangle_in_histogram',
    'calculate_text_position',
    'find_optimal_font_size',
    'calculate_text_scaling',
    'check_text_overlap',
    'resolve_text_conflicts',
    
    # Text processing
    'wrap_text_to_width',
    'render_text_with_stroke',
    'calculate_text_metrics',
    'apply_text_effects',
    'optimize_text_layout',
    'rectangles_overlap',
    'find_non_overlapping_position',
    'validate_text_rendering'
]
