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

import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.common.order.vo.UserAddrVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import com.tmerclub.cloud.user.dto.UserAddrDTO;

import java.util.List;

/**
 * @author lanhai
 */
public class AddrApi {
    public static void addAddr(UserAddrDTO userAddrDTO){
        String url = Constant.API_URL + "/tmerclub_user/userAddr";
        HttpUtil.post(url, userAddrDTO, UrlEnum.API);
    }

    public static List<UserAddrVO> dvyList(){
        String url = Constant.API_URL + "/tmerclub_user/userAddr/list";
        List list = HttpUtil.get(url, List.class, UrlEnum.API);
        return JSON.parseArray(JSON.toJSONString(list), UserAddrVO.class);
    }
//    public static UserAddrVO addrInfo(Long addrId) {
//        String url = Constant.API_URL + "/tmerclub_user/userAddr?addrId=" + addrId;
//        return HttpUtil.get(url, UserAddrVO.class, UrlEnum.API);
//    }

    public static void updateAddr(UserAddrDTO userAddrDTO){
        String url = Constant.API_URL + "/tmerclub_user/userAddr";
        HttpUtil.put(url, userAddrDTO, UrlEnum.API);
    }

//    public static void deleteDvy(Long addrId){
//        String url = Constant.API_URL +"/p/address/deleteAddr/{addrId}";
//        HttpUtil.delete(url);
//    }
//
//    public static List<RefundAddr> refundAddrList(){
//        String url = Constant.SHOP_URL + "/shop/refundAddr/list";
//        List list = HttpUtil.get(url, List.class);
//        return JSON.parseArray(JSON.toJSONString(list), RefundAddr.class);
//    }
//
//    public static void addRefundAddr(RefundAddr refundAddr){
//        String url = Constant.SHOP_URL + "/shop/refundAddr";
//        HttpUtil.post(url,refundAddr);
//    }
}
