from __future__ import annotations

import gin


@gin.configurable
class InputConfig:
    """Image preprocessing parameters.

    Attributes:
        image_size: Default output resolution (used for DB/satellite images).
        query_image_size: Output resolution for query/drone images.
            If None, falls back to ``image_size``.
    """

    def __init__(
        self,
        image_size: int = 256,
        query_image_size: int | None = None,
        sobel_kernel_size: int = 3,
        edge_normalize: bool = True,
        imagenet_mean: list[float] | None = None,
        imagenet_std: list[float] | None = None,
    ) -> None:
        self.image_size = image_size
        self.query_image_size = query_image_size or image_size
        self.sobel_kernel_size = sobel_kernel_size
        self.edge_normalize = edge_normalize
        self.imagenet_mean = imagenet_mean or [0.485, 0.456, 0.406]
        self.imagenet_std = imagenet_std or [0.229, 0.224, 0.225]


def get_input_cfg(path2cfg: str) -> InputConfig:
    """Load ONLY input config (for isolated testing)."""
    gin.clear_config()
    gin.parse_config_file(f"{path2cfg}input.gin")
    return InputConfig()
