import { ApiHelper } from '/js/util/api.js';

export const OemOrderDataService = {
    Create: async function (data) {
        return await ApiHelper.sendRequest('/api/OemOrder/Create', "POST", data);
    },
    Update: async function (data) {
        return await ApiHelper.sendRequest('/api/OemOrder/Update', 'PATCH', data);
    },
    Delete: async function (id) {
        return await ApiHelper.sendRequest(`/api/OemOrder/Delete?id=${id}`, "DELETE");
    },
    GetProductListWithStock: async function (queryData) {
        return await ApiHelper.sendRequest('/api/OemOrder/GetProductListWithStock', "POST", queryData);
    },
    GetAvailableStockList: async function (productId, attrId) {
        return await ApiHelper.sendRequest(`/api/OemOrder/GetAvailableStockList?productId=${productId}&attrId=${attrId}`, "GET");
    },
    AddProduct: async function (data) {
        return await ApiHelper.sendRequest('/api/OemOrder/AddProduct', "POST", data);
    },
    CalculateFreightage: async function (data) {
        return await ApiHelper.sendRequest('/api/OemOrder/CalculateFreightage', "POST", data);
    },
    ConfirmQC: async function (id) {
        return await ApiHelper.sendRequest(`/api/OemOrder/ConfirmQC?id=${id}`, "PATCH");
    },
    RestoreQC: async function (id) {
        return await ApiHelper.sendRequest(`/api/OemOrder/RestoreQC?id=${id}`, "PATCH");
    }
}