# _user_config_path_migrator.py
#
# Project: AutoArchive
# License: GNU GPLv3
#
# Copyright (C) 2003 - 2026 Róbert Čerňanský



from typing import override

from AutoArchive._infrastructure.app_dir.app_dir import AppDir
from AutoArchive._ui.cmdline._cmdline_ui import CmdlineUi
from AutoArchive._update._file_system import _FileSystem
from AutoArchive._update._user_dir_migrator_base import _UserDirMigratorBase



class _UserConfigPathMigrator(_UserDirMigratorBase):

    def __init__(self, fileSystem: _FileSystem, oldConfigDir: AppDir, newConfigDir: AppDir, cmdlineUi: CmdlineUi):
        super().__init__(fileSystem, oldConfigDir, newConfigDir, cmdlineUi)



    @property
    @override
    def dirName_(self) -> str:
        return "user configuration"



    @override
    def moveContent_(self, oldUserDir: AppDir, newUserDir: AppDir):
        self.fileSystem_.moveWithBackup(oldUserDir.path, newUserDir.path, self.cmdLineUi_)



    @override
    def isOldUserDirExisting_(self) -> bool:
        return self.fileSystem_.exists(self.oldUserDir_.path)
