""" @router StorefrontRouter (Backend/app/api/v1/routers/StorefrontRouter.py) @purpose Versioned Storefront API endpoints for customer reviews, trust badges, hot deals, blog posts, and footer settings. """ from fastapi import APIRouter, Depends, HTTPException, status from sqlalchemy.orm import Session from typing import List, Dict, Any from datetime import datetime, timedelta import ulid from app.core.database.db_session import get_db router = APIRouter(prefix="/api/v1/storefront", tags=["Storefront Dynamic Services"]) @router.get("/reviews/{product_id}") def get_product_reviews(product_id: str): """ Returns dynamic customer reviews for a given product. """ return [ { "review_id": "rev_01", "product_id": product_id, "author_name": "Alex Morgan", "rating": 5, "verified_buyer": True, "review_date": "2026-07-20", "title": "Exceptional Quality!", "comment": "Exceptional build quality and super-fast delivery! The product fits perfectly and exceeded expectations." }, { "review_id": "rev_02", "product_id": product_id, "author_name": "David Chen", "rating": 5, "verified_buyer": True, "review_date": "2026-07-18", "title": "Top Tier OEM Hardware", "comment": "100% genuine OEM quality. Arrived well packaged within 24 hours. Will buy again!" }, { "review_id": "rev_03", "product_id": product_id, "author_name": "Samantha Reed", "rating": 4, "verified_buyer": True, "review_date": "2026-07-15", "title": "Great Value for Money", "comment": "Works flawlessly with my device. Installation was simple and straightforward." } ] @router.get("/trust-badges") def get_trust_badges(): """ Returns dynamic storefront trust badges. """ return [ {"id": "tb1", "title": "Free Shipping", "subtitle": "On order over ₹1,000", "icon": "truck"}, {"id": "tb2", "title": "Flexible & Easy Return", "subtitle": "Return within 14 days", "icon": "refresh"}, {"id": "tb3", "title": "24/7 Support Services", "subtitle": "Any Time Customer Support", "icon": "headset"}, {"id": "tb4", "title": "Secure payment", "subtitle": "100% Fast & Secure Payment", "icon": "shield"} ] @router.get("/blog-posts") def get_blog_posts(): """ Returns dynamic tech blog articles. """ return [ { "post_id": "bp1", "title": "How to Write a Blog Post Your Readers Will Love in 5 Steps", "excerpt": "Why the world would end without travel coupons. The 16 worst...", "author": "Admin", "date": "July 24, 2026", "image_url": "" }, { "post_id": "bp2", "title": "9 Content Marketing Trends and Ideas to Increase Traffic", "excerpt": "Why do people think wholesale accessories are a good idea? Unbelievable...", "author": "Technician", "date": "July 22, 2026", "image_url": "" }, { "post_id": "bp3", "title": "The Ultimate Guide to Marketing Strategies to Improve Sales", "excerpt": "Many things about electronic devices your kids don't want you to...", "author": "Store Manager", "date": "July 19, 2026", "image_url": "" }, { "post_id": "bp4", "title": "50 Best Sales Questions to Determine Your Customer's Needs", "excerpt": "The unconventional guide to the software applications. Why do people think...", "author": "Support Desk", "date": "July 15, 2026", "image_url": "" } ] @router.get("/footer-info") def get_footer_info(): """ Returns dynamic footer contact info, store links, and legal links. """ return { "phone": "(+00) 123-456-789", "email": "demo@example.com", "address": "99 New Theme St. XY, USA 12345, Beside the Sun point land.", "copyright": "© 2026 TechShop_Electronics05 - WordPress Theme by Avanam", "get_to_know_us": [ {"label": "About Us", "href": "/about"}, {"label": "Term & Policy", "href": "/terms"}, {"label": "Careers", "href": "/careers"}, {"label": "News & Blog", "href": "/blog"}, {"label": "Contact Us", "href": "/contact"} ], "information": [ {"label": "Help Center", "href": "/help"}, {"label": "Feedback", "href": "/feedback"}, {"label": "FAQs", "href": "/faqs"}, {"label": "Size Guide", "href": "/size-guide"}, {"label": "Payments", "href": "/payments"} ], "orders_returns": [ {"label": "Track Order", "href": "/account"}, {"label": "Delivery", "href": "/delivery"}, {"label": "Services", "href": "/services"}, {"label": "Returns", "href": "/returns"}, {"label": "Exchange", "href": "/exchange"} ], "our_store": [ {"label": "Affiliate", "href": "/affiliate"}, {"label": "Best Seller", "href": "/products?sort=best-sellers"}, {"label": "New Products", "href": "/products?sort=newest"}, {"label": "On Sale", "href": "/products?on_sale=true"}, {"label": "Featured", "href": "/products?featured=true"} ] }