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

Technology: Business Objects
Feature:    Distro GG Product Scraper Class
"""

# Internal
from product_scraper import Product_Scraper
# External

class Distro_GG_Product_Scraper(Product_Scraper):
    NAME_DOMAIN_DISTRO_GG: str = 'Distro GG'

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

    @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):
        page_load_element_selector = '#main-content'
        cost_selector = '.drawer .drawer-content .grid .items-baseline h2.items-center'
        active_selector = '.drawer .drawer-content .grid div div div button span'
        cost_text, active = await super().scrape_cost_and_active_playwright(
              browser = browser
            , url = url
            , page_load_element_selector = page_load_element_selector
            , cost_selector = cost_selector
            , active_selector = active_selector
            , invalid_active_statuses = ['Pro Subscription required to Request Allocation', None]
        )
        cost = self.parse_cost(cost_text = cost_text)
        return cost, active
