from typing import List

from clarabot_nano.__main__ import ClarabotNanoLauncher
from clarabot_nano.common.i18n import LOCALIZATION

LOCALIZATION.install()


class DevelopmentClarabotNanoLauncher(ClarabotNanoLauncher):
    @classmethod
    def get_launch_targets(cls) -> List[str]:
        dev_targets = []
        for lt in super(DevelopmentClarabotNanoLauncher, cls).get_launch_targets():
            if lt.endswith(".winterrupt"):
                dev_targets.append(lt)
            else:
                cbn_pkg, _, mod_pth = lt.partition(".")
                assert cbn_pkg == "clarabot_nano"
                if mod_pth == "core":
                    dev_targets.append(f"{cbn_pkg}.development.{mod_pth}")
                else:
                    dev_targets.append(f"{cbn_pkg}.development.spawn.{mod_pth}")
        dev_targets.append("clarabot_nano.development.spawn.debug")
        return dev_targets

    @classmethod
    def get_name(cls) -> str:
        return f"{super(DevelopmentClarabotNanoLauncher, cls).get_name()} (DEV)"


if __name__ == "__main__":
    DevelopmentClarabotNanoLauncher.parse_target_module().main()
