"""MOMO 市場活動 read-only adapter skeleton。"""

from services.market_intel.adapters.base import (
    AdapterSafetyPolicy,
    CampaignSource,
    MarketIntelAdapter,
)


class MomoMarketAdapter(MarketIntelAdapter):
    platform_code = "momo"
    platform_name = "MOMO 購物網"
    base_url = "https://www.momoshop.com.tw"
    campaign_url_keywords = (
        "edm",
        "cmmedm",
        "lgrpcategory",
        "category",
        "promo",
        "event",
    )
    campaign_text_keywords = (
        "momo",
        "活動",
        "優惠",
        "限時",
        "限時搶購",
        "品牌日",
        "滿額",
        "折價券",
    )
    safety_policy = AdapterSafetyPolicy(
        request_interval_sec=2.0,
        timeout_sec=25,
        max_pages_per_run=8,
    )

    def campaign_sources(self):
        return (
            CampaignSource(
                source_key="momo_edm",
                name="MOMO EDM 活動入口",
                url="https://www.momoshop.com.tw/edm/cmmedm.jsp",
                campaign_type="festival",
                notes="先接既有 EDM / festival 爬蟲語意，正式抓取需另開 feature flag。",
            ),
            CampaignSource(
                source_key="momo_flash_sale",
                name="MOMO 限時搶購入口",
                url="https://www.momoshop.com.tw/category/LgrpCategory.jsp?l_code=2140000000",
                campaign_type="flash_sale",
                notes="只保存公開入口描述；Phase 3 不發 request。",
            ),
        )
