package com.tmerclub.cloud.systemtest.data.platform;

import com.tmerclub.cloud.common.order.bo.DeliveryModeBO;
import com.tmerclub.cloud.common.product.dto.SkuDTO;
import com.tmerclub.cloud.common.product.dto.SpuDTO;
import com.tmerclub.cloud.common.product.dto.SpuLangDTO;
import com.tmerclub.cloud.common.util.Json;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lpj
 */
public class ScoreSpuData {
    public static SpuDTO getScoreSpu(Long deliveryTemplateId, Long priceFee, Long scorePriceFee) {
        SpuDTO spuDTO = new SpuDTO();
        spuDTO.setName("接口自动化积分商品");
        spuDTO.setSellingPoint("商品卖点");
        spuDTO.setDetail("测试商品详情");
        spuDTO.setDeliveryTemplateId(deliveryTemplateId);
        spuDTO.setMainImgUrl("/test.png");
        spuDTO.setImgUrls("/test.png");
        spuDTO.setMarketPriceFee(88L);
        spuDTO.setPriceFee(priceFee);
        spuDTO.setScoreFee(scorePriceFee);
        spuDTO.setHasSkuImg(0);
        spuDTO.setSkuList(getSkuList(priceFee, scorePriceFee));
        spuDTO.setSupplierSpuType(0);

        List<SpuLangDTO> spuLangDTOList = new ArrayList<>();
        SpuLangDTO spuLangDTO = new SpuLangDTO();
        spuLangDTO.setLang(1);
        spuLangDTO.setSpuName("接口自动化积分商品");
        spuLangDTOList.add(spuLangDTO);
        spuDTO.setSpuLangList(spuLangDTOList);

        spuDTO.setTotalStock(100);
        DeliveryModeBO deliveryModeBO = new DeliveryModeBO();
        deliveryModeBO.setHasShopDelivery(true);
        deliveryModeBO.setHasUserPickUp(true);
        deliveryModeBO.setHasCityDelivery(false);
        spuDTO.setDeliveryMode(Json.toJsonString(deliveryModeBO));

        spuDTO.setSpuMold(0);
        spuDTO.setPreSaleType(-1);
        spuDTO.setSpuOrigin(0);

        return spuDTO;
    }


    public static List<SkuDTO> getSkuList(Long priceFee, Long scorePriceFee){
        List<SkuDTO> skuList = new ArrayList<>();
        SkuDTO skuDTO = new SkuDTO();
        skuDTO.setChangeStock(100);
        skuDTO.setPriceFee(priceFee);
        skuDTO.setScoreFee(scorePriceFee);
        skuDTO.setMarketPriceFee(88L);
        skuDTO.setStock(100);
        skuDTO.setStatus(1);
        skuList.add(skuDTO);
        return skuList;
    }

}
