/**
 * @author 1902 Software
 * @copyright Copyright © 2023 1902 Software (https://1902software.com/magento/)
 * @package WriteTextAI_WriteTextAI
 */

define(['ko', 'domReady!'], function (ko) {
    'use strict';

    var disableBulkSelectByType = {
        Product: ko.observable(false),
        Category: ko.observable(false)
    },
        isLoadingByType = {
            Product: ko.observable(false),
            Category: ko.observable(false)
    },
        disabledRowIdsByType = {
            Product: ko.observable([]),
            Category: ko.observable([])
    };

    var DESELECT_STORAGE_KEY_BY_TYPE = {
        Product: 'wtai_product_grid_deselect_signal',
        Category: 'wtai_category_grid_deselect_signal'
    };

    var normalizeRecordType = function (recordType) {
        return recordType === 'Category' ? 'Category' : 'Product';
    };

    return {
        getDisableBulkSelect: function (recordType) {
            return disableBulkSelectByType[normalizeRecordType(recordType)];
        },
        getIsLoading: function (recordType) {
            return isLoadingByType[normalizeRecordType(recordType)];
        },
        getDisabledRowIds: function (recordType) {
            return disabledRowIdsByType[normalizeRecordType(recordType)];
        },
        getDeselectStorageKey: function (recordType) {
            return DESELECT_STORAGE_KEY_BY_TYPE[normalizeRecordType(recordType)];
        },
        isLocalAction: false
    };
});
