# app/modules/marketplace/routes/pages/platform.py
"""
Marketplace Platform Page Routes (HTML rendering).

Platform (unauthenticated) pages:
- Find shop (Letzshop store browser)
"""

from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse
from sqlalchemy.orm import Session

from app.core.database import get_db
from app.modules.core.utils.page_context import get_platform_context
from app.templates_config import templates

router = APIRouter()


# ============================================================================
# FIND YOUR SHOP (LETZSHOP STORE BROWSER)
# ============================================================================


@router.get("/find-shop", response_class=HTMLResponse, name="platform_find_shop")
async def find_shop_page(
    request: Request,
    db: Session = Depends(get_db),
):
    """
    Letzshop store browser page.

    Allows stores to search for and claim their Letzshop shop.
    """
    context = get_platform_context(request, db)
    context["page_title"] = "Find Your Letzshop Shop"

    return templates.TemplateResponse(
        "marketplace/platform/find-shop.html",
        context,
    )
