# #region TestStorageAuditFixes [C:3] [TYPE Module] [SEMANTICS test,storage,typo,audit]
# @BRIEF Verify Class 7 typo fix — "repositorys" → "repositories" across all storage/git modules.
# @RELATION BINDS_TO -> [StorageModels]
# @RELATION BINDS_TO -> [GitServiceBase]
# @TEST_EDGE: typo_regression -> FileCategory.REPOSITORY == "repositories" (not "repositorys")
# @TEST_EDGE: default_path -> StorageConfig().repo_path defaults to "repositories"
# @TEST_EDGE: git_typo_regression -> No "repositorys" string exists in storage/git source files
from pathlib import Path
import sys

sys.path.insert(0, str(Path(__file__).parent.parent / "src"))


class TestStorageAuditFixes:
    """Verify the "repositorys" → "repositories" typo fix."""

    # #region test_repository_typo_fixed [C:2] [TYPE Function]
    # @BRIEF FileCategory.REPOSITORY equals "repositories", NOT "repositorys".
    def test_repository_typo_fixed(self):
        from src.models.storage import FileCategory
        assert FileCategory.REPOSITORY == "repositories"
        assert FileCategory.REPOSITORY.value == "repositories"
    # #endregion test_repository_typo_fixed

    # #region test_repo_path_default_fixed [C:2] [TYPE Function]
    # @BRIEF StorageConfig().repo_path defaults to "repositories".
    def test_repo_path_default_fixed(self):
        from src.models.storage import StorageConfig
        config = StorageConfig()
        assert config.repo_path == "repositories"
    # #endregion test_repo_path_default_fixed

    # #region test_storage_model_compiles [C:2] [TYPE Function]
    # @BRIEF All storage model classes import without errors.
    def test_storage_model_compiles(self):
        # Verify instantiation of StoredFile with all required fields
        from datetime import datetime

        from src.models.storage import FileCategory, StoredFile
        f = StoredFile(
            name="test.txt",
            path="backups/test.txt",
            size=42,
            created_at=datetime.now(),
            category=FileCategory.BACKUP,
        )
        assert f.name == "test.txt"
        assert f.size == 42
        assert f.category == FileCategory.BACKUP
    # #endregion test_storage_model_compiles

    # #region test_backup_category_unchanged [C:2] [TYPE Function]
    # @BRIEF FileCategory.BACKUP still equals "backups" (not affected by typo fix).
    def test_backup_category_unchanged(self):
        from src.models.storage import FileCategory
        assert FileCategory.BACKUP == "backups"
    # #endregion test_backup_category_unchanged

    # #region test_storage_config_fields_have_correct_types [C:2] [TYPE Function]
    # @BRIEF StorageConfig fields are all strings with correct defaults.
    def test_storage_config_fields_have_correct_types(self):
        from src.models.storage import StorageConfig
        config = StorageConfig()
        assert isinstance(config.root_path, str)
        assert isinstance(config.backup_path, str)
        assert isinstance(config.repo_path, str)
        assert config.root_path == "/app/storage"
        assert config.backup_path == "backups"
    # #endregion test_storage_config_fields_have_correct_types
# #endregion TestStorageAuditFixes
