"""
BrowserProfile 配置持久化类型存根

提供 VSCode/Pylance 类型提示支持。
"""
from typing import Optional, List, Dict, Any, TYPE_CHECKING
from pathlib import Path

if TYPE_CHECKING:
    from .browser import EasyBrowser


class BrowserProfile:
    """浏览器配置管理"""

    name: str
    storage_dir: Path
    profile_dir: Path

    @property
    def config_file(self) -> Path: ...
    @property
    def cookies_file(self) -> Path: ...
    @property
    def storage_file(self) -> Path: ...
    @property
    def state_file(self) -> Path: ...

    def __init__(
        self,
        name: str,
        storage_dir: str = "./profiles",
    ) -> None: ...

    def exists(self) -> bool: ...
    async def save(self, browser: "EasyBrowser") -> None: ...
    async def load(self, browser: "EasyBrowser") -> bool: ...
    async def save_cookies(self, browser: "EasyBrowser") -> None: ...
    async def load_cookies(self, browser: "EasyBrowser") -> bool: ...
    async def save_storage(self, browser: "EasyBrowser") -> None: ...
    async def load_storage(self, browser: "EasyBrowser") -> bool: ...
    def delete(self) -> bool: ...
    def get_info(self) -> Optional[Dict[str, Any]]: ...

    @classmethod
    def list_profiles(cls, storage_dir: str = "./profiles") -> List["BrowserProfile"]: ...
    @classmethod
    def profile_exists(cls, name: str, storage_dir: str = "./profiles") -> bool: ...
    @classmethod
    def delete_profile(cls, name: str, storage_dir: str = "./profiles") -> bool: ...
    @classmethod
    def clear_all(cls, storage_dir: str = "./profiles") -> None: ...


class ProfileManager:
    """配置管理器"""

    def __init__(self, storage_dir: str = "./profiles") -> None: ...

    def get_profile(self, name: str) -> BrowserProfile: ...
    async def save_profile(self, name: str, browser: "EasyBrowser") -> None: ...
    async def load_profile(self, name: str, browser: "EasyBrowser") -> bool: ...
    def list_profiles(self) -> List[str]: ...
    def delete_profile(self, name: str) -> bool: ...
    def get_profile_info(self, name: str) -> Optional[Dict[str, Any]]: ...
