import { apiServiceZdesk } from "../../utils/axios";
const defaultPath = '/customer-custom-field-configs';
export async function postCustomerCustomFieldConfigs(service, payload) {
    const { data, status } = await apiServiceZdesk(service).post(defaultPath, payload);
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to postCustomerCustomFieldConfigs');
}
export async function getCustomerCustomFieldConfigs(service, payload) {
    const { data, status } = await apiServiceZdesk(service).get(defaultPath, {
        params: payload
    });
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to getCustomerCustomFieldConfigs');
}
export async function patchCustomerCustomFieldConfigs(service, payload) {
    const { data, status } = await apiServiceZdesk(service).patch(defaultPath, payload);
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to patchCustomerCustomFieldConfigs');
}
export async function putCustomerCustomFieldConfigsOrder(service, payload) {
    const { data, status } = await apiServiceZdesk(service).put(`${defaultPath}/order`, payload);
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to putCustomerCustomFieldConfigsOrder');
}
export async function deleteCustomerCustomFieldConfigs(service, payload) {
    const { data, status } = await apiServiceZdesk(service).delete(defaultPath, { data: payload });
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to deleteCustomerCustomFieldConfigs');
}
export async function getCustomerCustomFieldConfigsCustomer(service, payload) {
    const { data, status } = await apiServiceZdesk(service).get(`${defaultPath}/customer`, {
        params: payload
    });
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to getCustomerCustomFieldConfigsCustomer');
}
const defaultPathCustomerCustomFields = '/customer-custom-fields';
export async function postCustomerCustomField(service, payload) {
    const { data, status } = await apiServiceZdesk(service).post(defaultPathCustomerCustomFields, payload);
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to postCustomerCustomField');
}
export async function getCustomerCustomField(service, payload) {
    const { data, status } = await apiServiceZdesk(service).get(defaultPathCustomerCustomFields, {
        params: payload
    });
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to getCustomerCustomField');
}
export async function patchCustomerCustomField(service, payload) {
    const { data, status } = await apiServiceZdesk(service).patch(defaultPathCustomerCustomFields, payload);
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to patchCustomerCustomField');
}
const defaultPathCustomerComment = '/customer-comment';
export async function getCustomerComment(service, payload) {
    const { data, status } = await apiServiceZdesk(service).get(defaultPathCustomerComment, {
        params: payload
    });
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to getCustomerComment');
}
export async function postCustomerComment(service, payload) {
    const { data, status } = await apiServiceZdesk(service).post(defaultPathCustomerComment, payload);
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to postCustomerComment');
}
export async function patchCustomerComment(service, payload) {
    const { data, status } = await apiServiceZdesk(service).patch(defaultPathCustomerComment, payload);
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to patchCustomerComment');
}
export async function deleteCustomerComment(service, payload) {
    const { data, status } = await apiServiceZdesk(service).delete(defaultPathCustomerComment, { data: payload });
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to deleteCustomerComment');
}
const defaultPathCustomerCommentReply = '/customer-reply-comment';
export async function postCustomerCommentReply(service, payload) {
    const { data, status } = await apiServiceZdesk(service).post(defaultPathCustomerCommentReply, payload);
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to postCustomerCommentReply');
}
export async function patchCustomerCommentReply(service, payload) {
    const { data, status } = await apiServiceZdesk(service).patch(defaultPathCustomerCommentReply, payload);
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to patchCustomerCommentReply');
}
export async function deleteCustomerCommentReply(service, payload) {
    const { data, status } = await apiServiceZdesk(service).delete(defaultPathCustomerCommentReply, { data: payload });
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to deleteCustomerCommentReply');
}
const defaultPathCustomerCommentLog = '/customer-comment-log';
export async function getCustomerCommentLog(service, payload) {
    const { data, status } = await apiServiceZdesk(service).get(defaultPathCustomerCommentLog, {
        params: payload
    });
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to getCustomerCommentLog');
}
const defaultPathTagConfigs = '/customer-tag-configs';
export async function postCustomerTagConfigs(service, payload) {
    const { data, status } = await apiServiceZdesk(service).post(defaultPathTagConfigs, payload.data);
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to postCustomerTagConfigs');
}
export async function getCustomerTagConfigs(service, payload) {
    const { data, status } = await apiServiceZdesk(service).get(defaultPathTagConfigs, {
        params: payload
    });
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to getCustomerTagConfigs');
}
export async function deleteCustomerTagConfigs(service, payload) {
    const { data, status } = await apiServiceZdesk(service).delete(defaultPathTagConfigs, { data: payload.data });
    // Status code 20x is success
    if (status.toString().startsWith('20')) {
        return data;
    }
    throw new Error('Failed to deleteCustomerTagConfigs');
}
