from flask import Blueprint, request

from functions.Products import updateUserProducts
from functions.products import MockImages
from functions.products.CsvProducts import csvProducts
from functions.products.ManualProduct import (createDraftProduct,
                                              createManualProductFromMapping,
                                              manualProduct)
from functions.products.Mapping import manualProductWithPlacementDetails
from functions.products.SubmitProduct import submitProduct
from functions.products.UpdateSingleProduct import updateSingleProduct
from functions.Response import sendResponse

ProductsBlueprint = Blueprint("products", __name__)

@ProductsBlueprint.put("/sync/<id>")
def syncSingleProduct(id):
    return sendResponse(updateSingleProduct, request, id)

@ProductsBlueprint.get("/sync")
def syncProducts():
    return sendResponse(updateUserProducts, request)

@ProductsBlueprint.post("/new")
def manualProductF():
    return sendResponse(manualProduct, request)
    
@ProductsBlueprint.post("/new-with-placements")
def manualProductWithPlacements():
    return sendResponse(manualProductWithPlacementDetails, request)

@ProductsBlueprint.post("/new/post-mapping")
def manualProductPostMapping():
    return sendResponse(createManualProductFromMapping, request, authRequired=False)

@ProductsBlueprint.post("/new/csv")
def csvProductsF():
    return sendResponse(csvProducts, request)

@ProductsBlueprint.post("/")
def saveManualProduct():
    return sendResponse(manualProduct, request)

@ProductsBlueprint.post("/generateVariantMockImage")
def generateVariantMockImage():
    return sendResponse(MockImages.generateVariantMockImage, request, authRequired=False)

@ProductsBlueprint.post("/submit")
def submitProductToPlatform():
    return sendResponse(submitProduct, request)

@ProductsBlueprint.post("/create-draft-product")
def createDraftProducts():
    return sendResponse(createDraftProduct, request)