from __future__ import annotations

import gin


@gin.configurable
class SegConfig:
    """Open-vocabulary segmentation parameters."""

    def __init__(
        self,
        prompts: list[str] | None = None,
        threshold: float = 0.3,
        default_resolution: int = 1008,
    ) -> None:
        self.prompts = prompts # or ["background", "building", "road", "vegetation", "water",]
        self.threshold = threshold
        self.default_resolution = default_resolution
        # Derived.
        self.num_classes = len(self.prompts)


def get_seg_cfg(path2cfg: str) -> SegConfig:
    """Load ONLY segmentation config (for isolated testing)."""
    gin.clear_config()
    gin.parse_config_file(f"{path2cfg}segmentation.gin")
    return SegConfig()
