"""
Remote Filesystem Strategy implementation.
Filesystem operations are restricted in REMOTE mode for security.
"""

import logging
from typing import List, Dict, Any
from pathlib import Path

from ..base import FilesystemStrategy
from ...core.context import DSSContext

# Configure module logger
logger = logging.getLogger(__name__)


class RemoteFilesystemStrategy(FilesystemStrategy):
    """
    Implements filesystem operations via remote API calls.

    Note: Direct filesystem access is restricted in REMOTE mode for security.
    Most operations will raise NotImplementedError or return empty results.
    Users should use LOCAL mode for filesystem operations.
    """

    def __init__(self, context: DSSContext):
        """Initialize with context."""
        self.context = context

    async def read_file(self, path: str) -> str:
        """
        Read file contents.

        NOT AVAILABLE in REMOTE mode for security reasons.

        Raises:
            NotImplementedError: Always, as direct file access is restricted.
        """
        logger.error("Filesystem read operations are not available in REMOTE mode.")
        raise NotImplementedError(
            "Direct filesystem access is restricted in REMOTE mode. "
            "Please use LOCAL mode for file operations, or use API-based file uploads."
        )

    async def list_directory(self, path: str) -> List[str]:
        """
        List directory contents.

        NOT AVAILABLE in REMOTE mode for security reasons.

        Raises:
            NotImplementedError: Always, as directory listing is restricted.
        """
        logger.error("Filesystem list operations are not available in REMOTE mode.")
        raise NotImplementedError(
            "Directory listing is restricted in REMOTE mode. "
            "Please use LOCAL mode for filesystem operations."
        )

    async def search_files(self, pattern: str, path: str = ".") -> List[str]:
        """
        Search for files matching a pattern.

        NOT AVAILABLE in REMOTE mode for security reasons.

        Raises:
            NotImplementedError: Always, as file search is restricted.
        """
        logger.error("Filesystem search operations are not available in REMOTE mode.")
        raise NotImplementedError(
            "File search is restricted in REMOTE mode. "
            "Please use LOCAL mode for filesystem operations."
        )

    async def get_file_info(self, path: str) -> Dict[str, Any]:
        """
        Get file metadata.

        NOT AVAILABLE in REMOTE mode for security reasons.

        Raises:
            NotImplementedError: Always, as file info access is restricted.
        """
        logger.error("Filesystem info operations are not available in REMOTE mode.")
        raise NotImplementedError(
            "File metadata access is restricted in REMOTE mode. "
            "Please use LOCAL mode for filesystem operations."
        )
