# Path: src/page_object_pattern/home_page.py
# class HomePage(BasePage):
#     """
#     Home page
#     """
#     SEARCH_CONTAINER = 'searchInput'
#     SEARCH_BUTTON = 'searchButton'
#     CREATE_ACCOUNT = 'pt-createaccount'
#     LOGIN = 'pt-login'
# 
#     def set_search_query(self, query: str):
#         """
#         Search for a string
#         :param query: string you are looking for
#         """
#         self._driver.find_element_by_id(HomePage.SEARCH_CONTAINER).send_keys(query)
# 
#     def check_search(self):
#         """
#         Check search button is visible
#         """
#         return self._driver.find_element_by_id(HomePage.SEARCH_BUTTON).is_displayed()
# 
#     def search(self):
#         """
#         Click on search button
#         """
#         self._driver.find_element_by_id(HomePage.SEARCH_BUTTON).click()
# 
#     def check_login(self):
#         """
#         Check Login button is visible
#         """
#         return self._driver.find_element_by_id(HomePage.LOGIN).is_displayed()
# 
#     def login(self):
#         """
#         Press login button
#         """
#         self._driver.find_element_by_id(HomePage.LOGIN).click()
# 
#     def check_create_account(self):
#         """
#         Check create account button available
#         """
#         return self._driver.find_element_by_id(HomePage.CREATE_ACCOUNT).is_displayed()
# 
#     def create_account(self):
#         """
#         Press create account button
#         """
#         self._driver.find_element_by_id(HomePage.CREATE_ACCOUNT).click()
# 
# Path: src/page_object_pattern/search_page.py
# class SearchPage(BasePage):
#     """
#     Search page
#     """
#     HEADING = 'firstHeading'
#     SEE_ALSO = 'See_also'
#     DOMAIN_ARTICLES = 'Domain-specific_articles'
#     READING = 'Further_reading'
#     REF = 'References'
#     EXTERNAL_LINKS = 'External_links'
# 
#     def heading_text(self):
#         """
#         :return: Get the heading text
#         """
#         return self._driver.find_element_by_id(SearchPage.HEADING).text
# 
#     def see_also_text(self):
#         """
#         :return: see also text
#         """
#         return self._driver.find_element_by_xpath(SearchPage.SEE_ALSO).text
# 
#     def domain_articles_text(self):
#         """
#         :return: domain article title
#         """
#         return self._driver.find_element_by_xpath(SearchPage.DOMAIN_ARTICLES).text
# 
#     def reading_text(self):
#         """
#         :return: reading text
#         """
#         return self._driver.find_element_by_xpath(SearchPage.READING).text
# 
#     def ref_text(self):
#         """
#         :return: reference text value
#         """
#         return self._driver.find_element_by_xpath(SearchPage.REF).text
# 
#     def external_links_text(self):
#         """
#         :return: external links text value
#         """
#         return self._driver.find_element_by_xpath(SearchPage.EXTERNAL_LINKS).text
# 
# Path: src/utils.py
# def get_selenium_driver(browser_name: str) -> Union[Chrome, Firefox]:
#     """
#     Return the same instance to the Selenium driver.
# 
#     :param browser_name: the name of the browser: chrome or mozilla
#     :type browser_name: str
#     :return: an instance of the required driver.
#     :rtype: Union[Chrome, Mozilla]
#     """
#     if browser_name.upper() == 'CHROME':
#         return SingletonFactory.build(Chrome)
# 
#     elif browser_name.upper() == 'Mozilla':
#         return SingletonFactory.build(Firefox)
# 
#     else:
#         raise NotImplementedError


from src.page_object_pattern.home_page import HomePage
from src.page_object_pattern.search_page import SearchPage
from src.utils import get_selenium_driver
"""


class FacadePage:
    """
    Facade class delegates the client requests to the actual subsystems
    """
    __driver = get_selenium_driver('chrome')

    def get_driver(self):
        """

        :return: selenium driver
        """
        return self.__driver

    @staticmethod
    def get_home_page():
        """
        Implement home page sub-system
        :return: HomePage class
        """
        return HomePage(FacadePage.__driver)

    @staticmethod
    def get_search_page():
        """
        Implement search page sub-system
        :return: SearchPage class
        """

# Path: src/page_object_pattern/home_page.py
# class HomePage(BasePage):
#     """
#     Home page
#     """
#     SEARCH_CONTAINER = 'searchInput'
#     SEARCH_BUTTON = 'searchButton'
#     CREATE_ACCOUNT = 'pt-createaccount'
#     LOGIN = 'pt-login'
# 
#     def set_search_query(self, query: str):
#         """
#         Search for a string
#         :param query: string you are looking for
#         """
#         self._driver.find_element_by_id(HomePage.SEARCH_CONTAINER).send_keys(query)
# 
#     def check_search(self):
#         """
#         Check search button is visible
#         """
#         return self._driver.find_element_by_id(HomePage.SEARCH_BUTTON).is_displayed()
# 
#     def search(self):
#         """
#         Click on search button
#         """
#         self._driver.find_element_by_id(HomePage.SEARCH_BUTTON).click()
# 
#     def check_login(self):
#         """
#         Check Login button is visible
#         """
#         return self._driver.find_element_by_id(HomePage.LOGIN).is_displayed()
# 
#     def login(self):
#         """
#         Press login button
#         """
#         self._driver.find_element_by_id(HomePage.LOGIN).click()
# 
#     def check_create_account(self):
#         """
#         Check create account button available
#         """
#         return self._driver.find_element_by_id(HomePage.CREATE_ACCOUNT).is_displayed()
# 
#     def create_account(self):
#         """
#         Press create account button
#         """
#         self._driver.find_element_by_id(HomePage.CREATE_ACCOUNT).click()
# 
# Path: src/page_object_pattern/search_page.py
# class SearchPage(BasePage):
#     """
#     Search page
#     """
#     HEADING = 'firstHeading'
#     SEE_ALSO = 'See_also'
#     DOMAIN_ARTICLES = 'Domain-specific_articles'
#     READING = 'Further_reading'
#     REF = 'References'
#     EXTERNAL_LINKS = 'External_links'
# 
#     def heading_text(self):
#         """
#         :return: Get the heading text
#         """
#         return self._driver.find_element_by_id(SearchPage.HEADING).text
# 
#     def see_also_text(self):
#         """
#         :return: see also text
#         """
#         return self._driver.find_element_by_xpath(SearchPage.SEE_ALSO).text
# 
#     def domain_articles_text(self):
#         """
#         :return: domain article title
#         """
#         return self._driver.find_element_by_xpath(SearchPage.DOMAIN_ARTICLES).text
# 
#     def reading_text(self):
#         """
#         :return: reading text
#         """
#         return self._driver.find_element_by_xpath(SearchPage.READING).text
# 
#     def ref_text(self):
#         """
#         :return: reference text value
#         """
#         return self._driver.find_element_by_xpath(SearchPage.REF).text
# 
#     def external_links_text(self):
#         """
#         :return: external links text value
#         """
#         return self._driver.find_element_by_xpath(SearchPage.EXTERNAL_LINKS).text
# 
# Path: src/utils.py
# def get_selenium_driver(browser_name: str) -> Union[Chrome, Firefox]:
#     """
#     Return the same instance to the Selenium driver.
# 
#     :param browser_name: the name of the browser: chrome or mozilla
#     :type browser_name: str
#     :return: an instance of the required driver.
#     :rtype: Union[Chrome, Mozilla]
#     """
#     if browser_name.upper() == 'CHROME':
#         return SingletonFactory.build(Chrome)
# 
#     elif browser_name.upper() == 'Mozilla':
#         return SingletonFactory.build(Firefox)
# 
#     else:
#         raise NotImplementedError


# Path: src/facade/FacadePage.py
from src.page_object_pattern.home_page import HomePage
from src.page_object_pattern.search_page import SearchPage
from src.utils import get_selenium_driver

"""


class FacadePage:
    """
    Facade class delegates the client requests to the actual subsystems
    """
    __driver = get_selenium_driver('chrome')

    def get_driver(self):
        """

        :return: selenium driver
        """
        return self.__driver

    @staticmethod
    def get_home_page():
        """
        Implement home page sub-system
        :return: HomePage class
        """
        return HomePage(FacadePage.__driver)

    @staticmethod
    def get_search_page():
        """
        Implement search page sub-system
        :return: SearchPage class
        """

        return SearchPage(FacadePage.__driver)