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


import com.tmerclub.cloud.common.order.dto.OrderDTO;
import com.tmerclub.cloud.common.order.dto.SubmitOrderDTO;
import com.tmerclub.cloud.common.order.vo.OrderSelfStationVO;
import com.tmerclub.cloud.common.order.vo.ShopCartOrderMergerVO;
import com.tmerclub.cloud.order.dto.OrderStationDTO;
import com.tmerclub.cloud.order.vo.OrderShopVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;

import java.util.List;

/**
 * @author Tu
 */

public class MyOrderApi {
    public static ShopCartOrderMergerVO confirm(OrderDTO orderParam){
        String url = Constant.API_URL+"/tmerclub_order/order/confirm";
        return HttpUtil.post(url, orderParam, UrlEnum.API, ShopCartOrderMergerVO.class);
    }

    public static void confirmScoreOrder(OrderDTO orderParam){
        String url = Constant.API_URL+"/tmerclub_order/score_order/confirm";
        HttpUtil.post(url, orderParam, UrlEnum.API);
    }

    public static List<Long> submit(SubmitOrderDTO submitOrderDTO){
        String url = Constant.API_URL+"/tmerclub_order/order/submit";
        return HttpUtil.post(url, submitOrderDTO,UrlEnum.API, List.class);
    }

    public static void cancel(Long orderNumber){
        String url = Constant.API_URL+"/tmerclub_order/my_order/cancel/"+orderNumber;
        HttpUtil.put(url,UrlEnum.API);
    }

    public static void receipt(Long orderNumber){
        String url = Constant.API_URL + "/tmerclub_order/my_order/receipt/"+orderNumber;
        HttpUtil.put(url,UrlEnum.API);
    }

    public static OrderShopVO orderDetail(Long orderNumber){
        String url = Constant.API_URL + "/tmerclub_order/my_order/order_detail?orderId="+orderNumber;
        return HttpUtil.get(url,OrderShopVO.class,UrlEnum.API);
    }

    public static void delete(Long orderNumber){
        String url = Constant.API_URL + "/tmerclub_order/my_order/"+orderNumber;
        HttpUtil.delete(url,UrlEnum.API);
    }

    /**
     * 自提订单门店详情
     */
    public static OrderSelfStationVO stationOrderDetail(Long orderId) {
        String url = Constant.API_URL + "/tmerclub_order/my_station_order/station_detail?orderId=" + orderId + "&lat=22.943953938872706&lng=113.39070900424778";
        return HttpUtil.get(url, OrderSelfStationVO.class, UrlEnum.API);
    }

    /**
     * 用户扫商家码核销订单
     */
    public static void orderStationByOrderId(OrderStationDTO orderStationDTO) {
        String url = Constant.API_URL + "/tmerclub_order/my_station_order/orderStationByOrderId";
        HttpUtil.put(url, orderStationDTO, UrlEnum.API);
    }
}
