
import RequestManager from '../request';


/**
 * 添加收货地址
 * @param {Object} data 地址信息
 * @returns {Promise}
 */
export const addAddress = async (data) => {
    return await RequestManager.post('/addAddress', data);
};

/**
 * 更新收货地址
 * @param {Object} data 地址信息
 * @returns {Promise}
 */
export const updateAddress = async (data) => {
    return await RequestManager.post('/updateAddress', data);
};

/**
 * 获取默认收货地址
 * @returns {Promise}
 */
export const getDefaultAddress = async () => {
    return await RequestManager.get('/getDefaultAddress');
};

/**
 * 获取收货地址列表
 * @returns {Promise}
 */
export const getAddressList = async () => {
    return await RequestManager.get('/getAddressList');
};

/**
 * 删除收货地址
 * @param {Object} data 包含地址ID的对象
 * @returns {Promise}
 */
export const deleteAddress = async (data) => {
    return await RequestManager.post('/deleteAddress', data);
};

/**
 * 设置默认收货地址
 * @param {Object} data 包含地址ID的对象
 * @returns {Promise}
 */
export const setDefaultAddress = async (data) => {
    return await RequestManager.post('/setDefaultAddress', data);
};

/**
 * 获取地址详情
 * @param {Object} data 包含地址ID的对象
 * @returns {Promise}
 */
export const getAddressDetail = async (id) => {
    return await RequestManager.get('/getAddressDetail', { id });
};