import { configStore } from "../store/store";
import { apiServiceSso, apiServiceZerva, apiServiceZrmz } from "../utils/axios";
const baseUrl = `/api/channel/profile`;
/**
 * @deprecated use '@Props' memberList instead
 */
export const getProfileMembers = async (request) => {
    const businessId = configStore.get('businessId');
    const { data, status } = await apiServiceSso().get(`${baseUrl}/${businessId}/member`, { params: request });
    if (status === 200) {
        return data;
    }
    throw new Error('Failed to getProfileMembers');
};
export const getProfileSelection = (request) => {
    return apiServiceSso().get(`${baseUrl}-selection`, {
        params: request
    });
};
export const getZervaShopProfileSetting = async (businessId) => {
    const { data } = await apiServiceZerva().get(`api/shop/${businessId}/shop-profile-setting`);
    return data;
};
export const getZrmzShopProfileSetting = async (businessId) => {
    const { data } = await apiServiceZrmz().get(`api/shop/${businessId}/shop-profile-setting`);
    return data;
};
export const getNewReservationSummaryCustomerIds = async (params) => {
    const { business_profile_id, shop_profile_setting_id, ...rest } = params;
    const { data, status } = await apiServiceZerva().get(`api/shop/${business_profile_id}/${shop_profile_setting_id}/zwiz/new-reservation-summary-customer-ids`, { params: rest });
    if (status === 200) {
        return data;
    }
    throw new Error('Failed to getNewReservationSummaryCustomerIds');
};
export const getCustomerIds = async (params) => {
    const { business_profile_id, ...rest } = params;
    const { data, status } = await apiServiceZrmz().get(`api/shop/${business_profile_id}/customer/get-customer-ids`, { params: rest });
    if (status === 200) {
        return data;
    }
    throw new Error('Failed to getNewReservationSummaryCustomerIds');
};
export const getBranches = async (params) => {
    const { businessId, shopId } = params;
    const { data, status } = await apiServiceZerva().get(`api/shop-service/${businessId}/${shopId}/branch`, {
        headers: {
            'accept-language': '',
        },
    });
    if (status === 200) {
        return data;
    }
    throw new Error('Failed to getBranches');
};
export const getAllServiceList = async (params) => {
    const { businessId, shopId } = params;
    const { data, status } = await apiServiceZerva().get(`api/shop-service/${businessId}/${shopId}/all-service-list`, {
        headers: {
            'accept-language': '',
        },
    });
    if (status === 200) {
        return data;
    }
    throw new Error('Failed to getAllServiceList');
};
