"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActionColumnApiImpl = void 0;
const ApiBase_1 = require("./ApiBase");
const ActionColumnRenderer_1 = require("../../agGrid/ActionColumnRenderer");
const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
class ActionColumnApiImpl extends ApiBase_1.ApiBase {
    getActionColumns() {
        var _a;
        return (_a = this.getActionColumnOptions().actionColumns) !== null && _a !== void 0 ? _a : [];
    }
    getColDefsForActionColumns() {
        const defaultSpecialColumnSettings = this.getGridApi().internalApi.deriveSpecialColumnSettingsFromAgGridDefaultColDef();
        const defaultActionColumnSettings = Object.assign(Object.assign({}, defaultSpecialColumnSettings), { resizable: true, suppressMenu: false, suppressMovable: false });
        return this.getActionColumnApi()
            .getActionColumns()
            .map((actionColumn) => {
            const actionColumnSettings = Object.assign(Object.assign({}, defaultActionColumnSettings), actionColumn.actionColumnSettings);
            const newColDef = {
                headerName: actionColumn.friendlyName ? actionColumn.friendlyName : actionColumn.columnId,
                colId: actionColumn.columnId,
                hide: false,
                editable: false,
                width: actionColumnSettings.width,
                resizable: actionColumnSettings.resizable,
                suppressHeaderMenuButton: actionColumnSettings.suppressMenu,
                suppressMovable: actionColumnSettings.suppressMovable,
                filter: false,
                sortable: false,
                enableRowGroup: false,
                cellRenderer: this.getGridApi().getVariant() === 'react'
                    ? ActionColumnRenderer_1.ReactActionColumnRenderer
                    : ActionColumnRenderer_1.ActionColumnRenderer,
                type: [GeneralConstants_1.AB_SPECIAL_COLUMN, 'abColDefObject'],
            };
            this.getAdaptableApi().logInfo('Setting up Action Column: ' + actionColumn.columnId);
            return newColDef;
        });
    }
}
exports.ActionColumnApiImpl = ActionColumnApiImpl;
