from typing import Any
from motor.motor_asyncio import AsyncIOMotorCollection
from uuid import uuid4

class SearchModel:
    def __init__(self, collection: AsyncIOMotorCollection):
        self.collection = collection

    async def save(self, data: dict) -> Any:
        # Auto-generate UUIDs
        data["searchId"] = str(uuid4())
        data["userId"] = str(uuid4())  # or assign from session/user context

        return await self.collection.insert_one(data)
