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

import com.tmerclub.cloud.api.platform.dto.OfflineHandleEventDTO;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;

/**
 * @author lpj
 */
public class PlatformProductApi {
    /**
     * 平台违规下架商品
     */
    public static void offline(OfflineHandleEventDTO offlineHandleEventDTO) {
        String url = Constant.API_URL + "/tmerclub_product/mp/spu/batch_offline";
        HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
    }

    /**
     * 平台获取最新下架信息
     */
    public static OfflineHandleEventVO platformGetOfflineHandleEvent(Long productId) {
        String url = Constant.API_URL + "/tmerclub_product/mp/spu/getOfflineHandleEvent/" + productId;
        return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.PLATFORM);
    }

    /**
     * 平台审核平台活动
     */
    public static void audit(OfflineHandleEventDTO offlineHandleEventDTO) {
        String url = Constant.API_URL + "/tmerclub_product/mp/spu/audit";
        HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
    }

    /**
     * 平台置顶商品
     */
    public static void toTop(Long productId) {
        String url = Constant.API_URL + "/tmerclub_product/p/spu/to_top?spuId=" + productId;
        HttpUtil.put(url, UrlEnum.PLATFORM);
    }

    /**
     * 平台删除商品
     */
    public static void platformDeleteProduct(Long productId) {
        String url = Constant.API_URL + "/tmerclub_product/mp/spu?spuId=" + productId;
        HttpUtil.delete(url, UrlEnum.PLATFORM);
    }
}
