"use strict";

interface AdminFunctions {
    addProductToCategory(productId: string): void;
    markProductAsHot(productId: string): void;
}

const AdminFunctions: AdminFunctions = (() => {

    function addProductToCategory(productId: string): void {
        const statusElement = $('#status_' + productId);
        statusElement.html('<span class="loading loading-bars loading-sm"></span><span class="ml-[3px]">Processing...</span>');
        setTimeout(() => {
            statusElement.html('');
        }, 1000);
    }

    function markProductAsHot(productId: string): void {
        const statusElement = $('#js-status-hottype-' + productId);
        statusElement.html('<span class="loading loading-bars loading-sm"></span><span class="ml-[3px]">Processing...</span>');
        setTimeout(() => {
            statusElement.html('');
        }, 1000);
    }

    return {
        addProductToCategory,
        markProductAsHot
    };
})();

export default AdminFunctions;
