90 lines
4.7 KiB
Python
90 lines
4.7 KiB
Python
"""Sample supplier adapter — static catalog of ~25 realistic products.
|
|
|
|
Home / gadgets / office niche, retail range $50-$500 after markup.
|
|
Used by scripts/seed.py to bootstrap a demo supplier.
|
|
"""
|
|
from app.engines.suppliers.base import SupplierAdapter, register_adapter
|
|
|
|
# (sku, title, category, cost, inventory, shipping_cost, shipping_time, brand)
|
|
CATALOG = [
|
|
("SPL-1001", "Aurora LED Desk Lamp with Wireless Charger", "office", 38.00, 42, 6.50, "3-5 days", "Lumina"),
|
|
("SPL-1002", "ErgoMesh Pro Office Chair", "office", 145.00, 12, 24.00, "5-7 days", "ErgoMesh"),
|
|
("SPL-1003", "Standing Desk Converter 32\"", "office", 118.00, 20, 19.50, "4-6 days", "DeskUp"),
|
|
("SPL-1004", "Mechanical Keyboard TKL (Brown Switch)", "office", 62.00, 55, 5.00, "3-5 days", "KeyForge"),
|
|
("SPL-1005", "Precision Wireless Mouse Pro", "office", 24.00, 120, 3.50, "2-4 days", "CursorPro"),
|
|
("SPL-1006", "Noise-Cancelling Over-Ear Headphones", "gadgets", 89.00, 38, 8.00, "3-5 days", "Auralis"),
|
|
("SPL-1007", "Smart Watch Series X (GPS + HR)", "gadgets", 96.00, 27, 7.50, "4-6 days", "PulseTech"),
|
|
("SPL-1008", "4K Action Camera Waterproof", "gadgets", 132.00, 18, 9.00, "4-6 days", "AdventureCam"),
|
|
("SPL-1009", "Mini Bluetooth Speaker 20W", "gadgets", 31.00, 90, 4.00, "2-4 days", "SoundPod"),
|
|
("SPL-1010", "Fast Wireless Charging Pad 15W", "gadgets", 38.00, 200, 2.50, "2-4 days", "VoltEdge"),
|
|
("SPL-1011", "Smart Home Hub with Voice Control", "home", 74.00, 33, 6.00, "3-5 days", "NestLink"),
|
|
("SPL-1012", "Robot Vacuum S5 (Self-Charging)", "home", 210.00, 9, 22.00, "6-8 days", "CleanBot"),
|
|
("SPL-1013", "HEPA Air Purifier for Large Rooms", "home", 128.00, 15, 18.00, "5-7 days", "PureAir"),
|
|
("SPL-1014", "Compact Espresso Machine 15-Bar", "home", 178.00, 8, 21.00, "5-7 days", "BrewMaster"),
|
|
("SPL-1015", "Cordless Stick Vacuum with LED Light", "home", 155.00, 11, 20.00, "5-7 days", "CleanBot"),
|
|
("SPL-1016", "Smart Thermostat (WiFi)", "home", 92.00, 40, 5.50, "3-5 days", "NestLink"),
|
|
("SPL-1017", "Smart LED Strip Kit 5m (RGB)", "home", 38.00, 140, 3.00, "2-4 days", "GlowSpace"),
|
|
("SPL-1018", "Gooseneck Electric Kettle 1L", "home", 44.00, 60, 7.00, "3-5 days", "BrewMaster"),
|
|
("SPL-1019", "Cast Iron Dutch Oven 6qt", "home", 68.00, 25, 16.00, "5-7 days", "Hearthstone"),
|
|
("SPL-1020", "Bamboo Electric Standing Desk 55\"", "office", 265.00, 6, 38.00, "7-10 days", "DeskUp"),
|
|
("SPL-1021", "Ultrawide Monitor 34\" 3440x1440", "office", 310.00, 7, 32.00, "6-8 days", "ViewMax"),
|
|
("SPL-1022", "Duplex Document Scanner", "office", 98.00, 22, 11.00, "4-6 days", "ScanFast"),
|
|
("SPL-1023", "Aluminum Laptop Stand (Adjustable)", "office", 38.00, 85, 4.50, "2-4 days", "DeskUp"),
|
|
("SPL-1024", "Smart Body Composition Scale", "home", 38.00, 70, 5.00, "3-5 days", "PulseTech"),
|
|
("SPL-1025", "Ergonomic Footrest with Massage", "office", 40.00, 48, 6.00, "3-5 days", "ErgoMesh"),
|
|
("SPL-1026", "USB-C Hub 8-in-1 (4K HDMI)", "gadgets", 38.00, 110, 3.00, "2-4 days", "VoltEdge"),
|
|
("SPL-1027", "Portable Power Station 300Wh", "gadgets", 348.00, 5, 34.00, "7-10 days", "VoltEdge"),
|
|
]
|
|
|
|
DESCRIPTIONS = {
|
|
"office": "Professional-grade office equipment designed for comfort and productivity.",
|
|
"home": "Thoughtfully designed home essentials that blend function with style.",
|
|
"gadgets": "Modern tech gadget with reliable performance and everyday practicality.",
|
|
}
|
|
|
|
|
|
@register_adapter
|
|
class SampleSupplierAdapter(SupplierAdapter):
|
|
adapter_type = "sample"
|
|
|
|
def get_products(self):
|
|
return [
|
|
{
|
|
"sku": sku,
|
|
"title": title,
|
|
"description": DESCRIPTIONS[category],
|
|
"category": category,
|
|
"brand": brand,
|
|
"cost": cost,
|
|
"inventory": inventory,
|
|
"shipping_cost": shipping_cost,
|
|
"shipping_time": shipping_time,
|
|
"image_url": f"https://placehold.co/600x600/png?text={sku}",
|
|
}
|
|
for (sku, title, category, cost, inventory, shipping_cost, shipping_time, brand) in CATALOG
|
|
]
|
|
|
|
def get_inventory(self):
|
|
return [
|
|
{"supplier_sku": sku, "inventory": inventory}
|
|
for (sku, _, _, _, inventory, _, _, _) in CATALOG
|
|
]
|
|
|
|
def get_price(self, sku):
|
|
for row in CATALOG:
|
|
if row[0] == sku:
|
|
return row[3]
|
|
return None
|
|
|
|
def create_order(self, items):
|
|
return {"adapter": "sample", "ref": f"sample:{len(items)}:items", "items": items}
|
|
|
|
def get_order_status(self, ref):
|
|
return "confirmed"
|
|
|
|
def get_tracking(self, ref):
|
|
return None
|
|
|
|
def cancel_order(self, ref):
|
|
return {"ref": ref, "status": "cancelled"}
|