import numpy as np
import pandas as pd
from typing import List

def validate_weights(weights: List[float]) -> bool:
    """Validate if weights sum to approximately 1"""
    return abs(sum(weights) - 1.0) < 1e-10

def normalize_weights(weights: List[float]) -> List[float]:
    """Normalize weights to sum to 1"""
    total = sum(weights)
    return [w / total for w in weights]

def generate_example_data() -> dict:
    """Generate example data for testing"""
    alternatives = ['Site A', 'Site B', 'Site C']
    criteria = ['Cost', 'Solar Radiation', 'Distance to Grid']
    criteria_types = ['min', 'max', 'min']  # min for cost/distance, max for solar
    weights = [0.4, 0.4, 0.2]  # Weights for each criterion
    
    # Decision matrix
    decision_matrix = np.array([
        [500000, 5.2, 15],  # Site A
        [650000, 6.1, 8],   # Site B
        [450000, 4.8, 25]   # Site C
    ])
    
    return {
        'alternatives': alternatives,
        'criteria': criteria,
        'criteria_types': criteria_types,
        'weights': weights,
        'decision_matrix': decision_matrix
    }