"""
Project:    Shuffle & Skirmish Market Scraper
Author:     Edward Middleton-Smith
            Shuffle & Skirmish

Technology: Business Objects
Feature:    Games Lore Product Scraper Class
"""

# Internal
from product_scraper import Product_Scraper
# External

class Games_Lore_Product_Scraper(Product_Scraper):
    NAME_DOMAIN_GAMES_LORE: str = 'Games Lore'

    def __init__(self):
        super().__init__(domain = self.NAME_DOMAIN_GAMES_LORE)

    @classmethod
    def parse_cost(cls, cost_text):
        return super().parse_cost(cost_text = cost_text)
        
    async def scrape_cost_and_active_playwright(self, browser, url):
        cost_selector = 'div.columns > div.column.main > div.product-info-main > div.product-info-price > div.price-box > span.special-price > span.price-container > span.price-wrapper > span.price'
        active_selector = '.stock > span:nth-child(1)'
        cost_text, active = await super().scrape_cost_and_active_playwright(
              browser = browser
            , url = url
            , page_load_element_selector = cost_selector
            , cost_selector = cost_selector
            , active_selector = active_selector
            , invalid_active_statuses = ["OUT OF STOCK"]
        )
        cost = self.parse_cost(cost_text = cost_text)
        return cost, active
