from __future__ import annotations

from dataclasses import dataclass, field
from typing import Literal, Any



@dataclass
class RouterConfig:
    """Configuration parameters for the A* Router."""

    node_limit: int = 1000000
    snap_size: float = 5.0
    # Sparse Sampling Configuration
    max_straight_length: float = 2000.0
    num_straight_samples: int = 5
    min_straight_length: float = 5.0
    
    # Offsets for SBends (None = automatic grid-based selection)
    sbend_offsets: list[float] | None = None
    
    # Deprecated but kept for compatibility during refactor
    straight_lengths: list[float] = field(default_factory=list) 
    
    bend_radii: list[float] = field(default_factory=lambda: [50.0, 100.0])
    sbend_radii: list[float] = field(default_factory=lambda: [50.0, 100.0, 500.0])
    snap_to_target_dist: float = 1000.0
    bend_penalty: float = 250.0
    sbend_penalty: float = 500.0
    bend_collision_type: Literal["arc", "bbox", "clipped_bbox"] | Any = "arc"
    bend_clip_margin: float = 10.0


@dataclass
class CostConfig:
    """Configuration parameters for the Cost Evaluator."""

    unit_length_cost: float = 1.0
    greedy_h_weight: float = 1.1
    congestion_penalty: float = 10000.0
    bend_penalty: float = 250.0
    sbend_penalty: float = 500.0
    min_bend_radius: float = 50.0
