# Path: app/helpers/product_catalog/data_classes.py
# class Product:
#     """
#     Data class for products.
#     """
#     name: str
#     description: str
#     image: str
#     labels: List[str]
#     price: float
#     created_at: int
#     id: str = None
# 
# 
#     @staticmethod
#     def deserialize(document):
#         """
#         Helper function for parsing a Firestore document to a Product object.
# 
#         Parameters:
#            document (DocumentSnapshot): A snapshot of Firestore document.
# 
#         Output:
#            A Product object.
#         """
#         data = document.to_dict()
#         if data:
#             return Product(
#                 id=document.id,
#                 name=data.get('name'),
#                 description=data.get('description'),
#                 image=data.get('image'),
#                 labels=data.get('labels'),
#                 price=data.get('price'),
#                 created_at=data.get('created_at')
#             )
# 
#         return None
# 
# class PromoEntry:
#     """
#     Data class for promotions.
#     """
#     label: str
#     score: float
#     id: str = None
# 
# 
#     @staticmethod
#     def deserialize(document):
#         """
#         Helper function for parsing a Firestore document to a PromoEntry object.
# 
#         Parameters:
#            document (DocumentSnapshot): A snapshot of Firestore document.
# 
#         Output:
#            A PromoEntry object.
#         """
#         data = document.to_dict()
#         if data:
#             return PromoEntry(
#                 id=document.id,
#                 label=data.get('label'),
#                 score=data.get('score')
#             )
# 
#         return None


from dataclasses import asdict
from google.cloud import firestore
from .data_classes import Product, PromoEntry
import os
import uuid
    Parameters:
       product_ids (List[str]): A list of product IDs.

    Output:
       The total price.
    """

    total = 0
    for product_id in product_ids:
        product = get_product(product_id)
        total += product.price
    return total


def get_promos():
    """
    Helper function for getting promoted products.

    Parameters:
       None.

    Output:
       A list of Product objects.
    """

    promos = []
    query = firestore_client.collection('promos').where('label', '==', 'pets').where('score', '>=', 0.7)
    query = query.order_by('score', direction=firestore.Query.DESCENDING).limit(3)
    query_results = query.get()
    for result in query_results:

# Path: app/helpers/product_catalog/data_classes.py
# class Product:
#     """
#     Data class for products.
#     """
#     name: str
#     description: str
#     image: str
#     labels: List[str]
#     price: float
#     created_at: int
#     id: str = None
# 
# 
#     @staticmethod
#     def deserialize(document):
#         """
#         Helper function for parsing a Firestore document to a Product object.
# 
#         Parameters:
#            document (DocumentSnapshot): A snapshot of Firestore document.
# 
#         Output:
#            A Product object.
#         """
#         data = document.to_dict()
#         if data:
#             return Product(
#                 id=document.id,
#                 name=data.get('name'),
#                 description=data.get('description'),
#                 image=data.get('image'),
#                 labels=data.get('labels'),
#                 price=data.get('price'),
#                 created_at=data.get('created_at')
#             )
# 
#         return None
# 
# class PromoEntry:
#     """
#     Data class for promotions.
#     """
#     label: str
#     score: float
#     id: str = None
# 
# 
#     @staticmethod
#     def deserialize(document):
#         """
#         Helper function for parsing a Firestore document to a PromoEntry object.
# 
#         Parameters:
#            document (DocumentSnapshot): A snapshot of Firestore document.
# 
#         Output:
#            A PromoEntry object.
#         """
#         data = document.to_dict()
#         if data:
#             return PromoEntry(
#                 id=document.id,
#                 label=data.get('label'),
#                 score=data.get('score')
#             )
# 
#         return None


# Path: app/helpers/product_catalog/helpers.py
from dataclasses import asdict
from google.cloud import firestore
from .data_classes import Product, PromoEntry
import os
import uuid

    Parameters:
       product_ids (List[str]): A list of product IDs.

    Output:
       The total price.
    """

    total = 0
    for product_id in product_ids:
        product = get_product(product_id)
        total += product.price
    return total


def get_promos():
    """
    Helper function for getting promoted products.

    Parameters:
       None.

    Output:
       A list of Product objects.
    """

    promos = []
    query = firestore_client.collection('promos').where('label', '==', 'pets').where('score', '>=', 0.7)
    query = query.order_by('score', direction=firestore.Query.DESCENDING).limit(3)
    query_results = query.get()
    for result in query_results:

        entry = PromoEntry.deserialize(result)