72 lines
2.0 KiB
Python
72 lines
2.0 KiB
Python
from datetime import datetime
|
|
from dataclasses import field
|
|
from pydantic.dataclasses import dataclass
|
|
|
|
|
|
@dataclass
|
|
class ConsumerConfig:
|
|
# used claude to refactor the consumer building in the discord bot
|
|
"""Configuration for a single retailer's consumer.
|
|
|
|
Attributes:
|
|
monitor_name: Retailer name (matches setup_config key).
|
|
collection: MongoDB collection for this retailer's products.
|
|
channel_ids: Discord webhook/channel routing config.
|
|
min_percentage: Minimum discount % to trigger a ping.
|
|
ping_threshold: Price floor for the secondary 40% rule (e.g. Woot pings
|
|
on 40%+ discounts if the item is >= this price). None disables
|
|
the secondary rule.
|
|
"""
|
|
|
|
monitor_name: str
|
|
collection: object
|
|
channel_ids: dict
|
|
min_percentage: int
|
|
ping_threshold: int | None = None
|
|
|
|
|
|
@dataclass
|
|
class PricingInfo:
|
|
original_price: float
|
|
current_price: float
|
|
price_before_drop: float | None = None
|
|
edu_price: float | None = None
|
|
|
|
|
|
@dataclass
|
|
class AvailabilityInfo:
|
|
available: bool | None = None
|
|
condition: str | None = None
|
|
app_exclusive: bool | None = None
|
|
member_pick: bool | None = None
|
|
member_deal: bool | None = None
|
|
|
|
|
|
@dataclass
|
|
class ProductMetadata:
|
|
image_url: str | None = None
|
|
channel_id: str | None = None
|
|
customization_index: str | None = None
|
|
member_non_member_comparison: str | None = None
|
|
overstock_text: str | None = None
|
|
percentage: int | None = None
|
|
affiliate_url: str | None = None
|
|
|
|
|
|
@dataclass
|
|
class ProductTiming:
|
|
discovered_date: datetime | None = None
|
|
start_date: datetime | None = None
|
|
end_date: datetime | None = None
|
|
|
|
|
|
@dataclass
|
|
class Product:
|
|
product_id: str
|
|
title: str
|
|
url: str
|
|
pricing: PricingInfo
|
|
metadata: ProductMetadata = field(default_factory=ProductMetadata)
|
|
timing: ProductTiming = field(default_factory=ProductTiming)
|
|
availability: AvailabilityInfo = field(default_factory=AvailabilityInfo)
|