"""Base keyboard strategy interface."""

from abc import ABC, abstractmethod

from playwright.async_api import Page


class KeyboardStrategy(ABC):
    """Abstract base class for on-screen keyboard input strategies."""

    # Common special character mapping to Korean names
    SPECIAL_CHAR_KOREAN = {
        "!": "느낌표",
        "@": "골뱅이",
        "#": "우물표시",
        "$": "달러표시",
        "%": "퍼센트",
        "^": "윗꺽쇠",
        "&": "앰퍼센드",
        "*": "별표",
        "(": "소괄호열기",
        ")": "소괄호닫기",
        "-": "빼기",
        "_": "밑줄",
        "=": "같음",
        "+": "더하기",
        "[": "대괄호열기",
        "]": "대괄호닫기",
        "{": "중괄호열기",
        "}": "중괄호닫기",
        "\\": "역슬래시",
        "|": "수직바",
        ";": "세미콜론",
        ":": "콜론",
        "'": "작은따옴표",
        '"': "큰따옴표",
        ",": "쉼표",
        ".": "마침표",
        "<": "작음",
        ">": "큼",
        "/": "슬래시",
        "?": "물음표",
        "~": "물결표시",
        "`": "억음표시",
    }

    @abstractmethod
    async def enter_password(self, page: Page, password: str) -> None:
        """
        Enter password using the on-screen keyboard.

        Args:
            page: Playwright page object
            password: Password to enter
        """
        pass

    @abstractmethod
    async def enter_pin(self, page: Page, pin: str) -> None:
        """
        Enter numeric PIN using the on-screen keyboard.

        Args:
            page: Playwright page object
            pin: PIN to enter
        """
        pass
