from functions.Shopify.Products import \
    updateSingleProduct as updateUserShopifyProduct
from functions.WooCommerce.Products import \
    updateSingleProduct as updateSingleWooProduct
from V2.functions.Etsy.Products import updateSingleEtsyProduct
from V2.functions.Shops.main import Shop
from V2.functions.Squarespace.Products import updateSingleSquarespaceProduct


def updateSingleProduct(params):
    platformProductId = params.get('id')
    shop = Shop.get(params.get("shopId"))
    if not shop:return
    if shop.platformId == "1":
        return updateSingleEtsyProduct(shop,platformProductId)
    elif shop.platformId == "2":
        return updateUserShopifyProduct(platformProductId,shop.to_dict())
    elif shop.platformId == "3": 
        return updateSingleWooProduct(shop,platformProductId)
    elif shop.platformId == "10":
        return updateSingleSquarespaceProduct(shop, platformProductId)
    return "Not implemented"
