// @ts-nocheck
import axios from "axios";
import WM from "./index";

const url = 'https://printerval.com/module/customization/blue/get-campaign-data?product_id=1809755659';

axios.get(url).then(async function (response) {

    const customizationService = WM.initCustomizationTeeinblue(response.data.result);

    // const layerOptions = customizationService.getLayerOptions();
    const mockupLayers = customizationService.getMockupLayers();
    const designLayers = customizationService.getDesignLayers();
    
    customizationService.selectTemplate('template-391321');
    
    // click vào con thỏ
    var layerOptions = customizationService.getLayerOptions();
    var option = layerOptions[0];
    customizationService.changeLayerOptionValue(option.option_items[2], option)

    console.log(customizationService.getTemplateOptions()[0])

    /* // click vào giống thỏ
    var layerOptions = customizationService.getLayerOptions();
    var option = layerOptions.find(l => l.id == 'layer-230205');
    customizationService.changeOptionGroupClipartValue(option.option_items[0], option)
    
    // chọn đúng vào con thỏ
    var layerOptions = customizationService.getLayerOptions();
    var option = layerOptions.find(l => l.id == 'layer-230205');
    customizationService.changeLayerOptionValue(option.option_items[0].options[0], option.option_items[0], option) */

    /* var layerOptions = customizationService.getLayerOptions();
    var option = layerOptions.find(l => l.id == 'layer-230205');
    console.log(option.option_items[0]) */

    // var templateLayers = customizationService.getTemplateLayers();
    // console.log(templateLayers);

    // var layerDesigns = customizationService.getDesignLayers();
    // console.log(layerDesigns.find(l => l.id == 'layer-506028'));

    
    /* 
    var layerOptions = customizationService.getLayerOptions();
    var option = layerOptions[1]; */

    // console.log(option);

    // console.log(customizationService.getDesignLayers());

    /* customizationService.changeLayerOptionValue(option.option_items[1], option);

    console.log(customizationService.getTemplateLayers()[0]); */

    
    // customizationService.changeLayerOptionValue(option.option_items[2], option);

});
