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

export const UniversalDataService = {
    GetSystemName: async function () {
        return (await ApiHelper.sendRequest('/api/Openness/GetSystemName', "GET")).data;
    },
    GetMenuTrees: async function () {
        return (await ApiHelper.sendRequest(`/api/Universal/GetMenuTrees`, "GET")).data;
    },
    GetAuthCode: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetAuthCode', "GET")).data;
    },
    GetServiceCounty: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetServiceCounty', "GET")).data;
    },
    GetStockPrintConfig: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetStockPrintConfig', "GET")).data;
    },
    GetContractCustomerLessor: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetContractCustomerLessor', "GET")).data;
    },
    GetContractStoreSupplier: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetContractStoreSupplier', "GET")).data;
    },
    GetPackingTitle: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetPackingTitle', "GET")).data;
    },
    GetRecycleTitle: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetRecycleTitle', "GET")).data;
    },
    GetPostCode: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetPostCode', "GET")).data;
    },
    GetMarket: async function () {
        var res = (await ApiHelper.sendRequest('/api/Universal/GetMarket', "GET")).data;
        res.forEach(function (item) {
            if (item.status == 0) {
                item.name = item.name + " (停用)";
            }
        });
        return res;
    },
    GetMarketInvoiceType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetMarketInvoiceType', "GET")).data;
    },
    GetMarketBillType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetMarketBillType', "GET")).data;
    },
    GetStore: async function () {
        var res = (await ApiHelper.sendRequest('/api/Universal/GetStore', "GET")).data;
        res.forEach(function (item) {
            if (item.status == 0) {
                item.name = item.name + " (停用)";
            }
        });
        return res;
    },
    GetMember: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetMember', "GET")).data;
    },
    GetAdvertisementPosition: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetAdvertisementPosition', "GET")).data;
    },
    GetParentCategory: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetParentCategory', "GET")).data;
    },
    GetProductCategory: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetProductCategory', "GET")).data;
    },
    GetAttributesType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetAttributesType', "GET")).data;
    },
    GetProductType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetProductType', "GET")).data;
    },
    GetStockStatus: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetStockStatus', "GET")).data;
    },
    GetOemStockStatus: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOemStockStatus', "GET")).data;
    },
    GetOemStockEventType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOemStockEventType', "GET")).data;
    },
    GetStockRepairingStatus: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetStockRepairingStatus', "GET")).data;
    },
    GetOrderMainType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOrderMainType', "GET")).data;
    },
    GetRentedFor: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetRentedFor', "GET")).data;
    },
    GetOrderMainPayMethod: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOrderMainPayMethod', "GET")).data;
    },
    GetShippingMethod: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetShippingMethod', "GET")).data;
    },
    GetOrderMainStatus: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOrderMainStatus', "GET")).data;
    },
    GetPaymentStatus: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetPaymentStatus', "GET")).data;
    },
    GetOrderSource: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOrderSource', "GET")).data;
    },
    GetBillType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetBillType', "GET")).data;
    },
    GetInvoiceType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetInvoiceType', "GET")).data;
    },
    GetPeriodType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetPeriodType', "GET")).data;
    },
    GetOrderDetailStatus: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOrderDetailStatus', "GET")).data;
    },
    GetOtherShippingMethod: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOtherShippingMethod', "GET")).data;
    },
    GetVerified: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetVerified', "GET")).data;
    },
    GetBuyType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetBuyType', "GET")).data;
    },
    GetOrderOtherType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOrderOtherType', "GET")).data;
    },
    GetOrderOtherBillingTarget: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOrderOtherBillingTarget', "GET")).data;
    },
    GetPackingType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetPackingType', "GET")).data;
    },
    GetPackingStatus: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetPackingStatus', "GET")).data;
    },
    GetRecycleStatus: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetRecycleStatus', "GET")).data;
    },
    GetRecycleType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetRecycleType', "GET")).data;
    },
    GetChargeType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetChargeType', "GET")).data;
    },
    GetltSeatWidthAttrs: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetltSeatWidthAttrs', "GET")).data;
    },
    GetOemltSeatWidthAttrs: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOemltSeatWidthAttrs', "GET")).data;
    },
    GetUserType: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetUserType', "GET")).data;
    },
    UploadImage: async function (formData) {
        return await ApiHelper.sendRequest('/api/Universal/UploadImage', "POST", formData, null, { headers: { 'Content-Type': null } });
    },
    UploadFile: async function (formData) {
        return await ApiHelper.sendRequest('/api/Universal/UploadFile', "POST", formData, null, { headers: { 'Content-Type': null } });
    },
    GetQRCode: async function (url) {
        return await ApiHelper.sendRequest('/api/Universal/GetQRCode', "POST", { url: url });
    },
    GetBarcode: async function (txt, showTxt, fontSize, width, height) {
        return await ApiHelper.sendRequest('/api/Universal/GetBarcode', "POST",
            { txt: txt, showTxt: showTxt, fontSize: fontSize, width: width, height: height }
        );
    },
    GetShortcut: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetShortcut', "GET")).data;
    },
    GetOrderCount: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetOrderCount', "GET")).data;
    },
    GetStockMaintain: async function () {
        return (await ApiHelper.sendRequest('/api/Universal/GetStockMaintain', "GET")).data;
    }
}