from __future__ import annotations

import gin


@gin.configurable
class ModelsConfig:
    """Model identifiers and fallback strategies."""

    def __init__(
        self,
        depth_model_id: str = "DA3-LARGE-1.1",
        depth_fallback_id: str = "depth-anything/Depth-Anything-V2-Large-hf",
        chmv2_model_id: str = "facebook/dinov3-vitl16-chmv2-dpt-head",
        seg_model_type: str = "segearth-ov3",
        seg_fallback_type: str = "segformer-b5",
        seg_fallback_id: str = "nvidia/segformer-b5-finetuned-ade-640-640",
        weights_dir: str = "",
    ) -> None:
        self.depth_model_id = depth_model_id
        self.depth_fallback_id = depth_fallback_id
        self.chmv2_model_id = chmv2_model_id
        self.seg_model_type = seg_model_type
        self.seg_fallback_type = seg_fallback_type
        self.seg_fallback_id = seg_fallback_id
        self.weights_dir = weights_dir


def get_models_cfg(path2cfg: str) -> ModelsConfig:
    """Load ONLY models config (for isolated testing)."""
    gin.clear_config()
    gin.parse_config_file(f"{path2cfg}models.gin")
    return ModelsConfig()
