"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.TableGridSwitchFoldersUniDriver = TableGridSwitchFoldersUniDriver;
exports.default = void 0;
var _unidriver = require("../../unidriver");
var _CollectionToolbarUni = require("../CollectionToolbar/CollectionToolbar.uni.driver");
var _TableFoldersUni = _interopRequireDefault(require("../TableFolders/TableFolders.uni.driver"));
var _GridFoldersUni = _interopRequireDefault(require("../Grid/GridFolders.uni.driver"));
var _SummaryBarUni = require("../SummaryBar/SummaryBar.uni.driver");
function TableGridSwitchFoldersUniDriver(base, body) {
  const getToolbar = () => (0, _CollectionToolbarUni.CollectionToolbarUniDriver)(base.$('[data-hook="collection-toolbar"]'), body);
  const getTable = () => (0, _TableFoldersUni.default)(base, body);
  const getGrid = () => (0, _GridFoldersUni.default)(base, body);
  const getSummaryBar = () => (0, _SummaryBarUni.SummaryBarUniDriver)(base, body);
  return {
    ...(0, _unidriver.baseUniDriverFactory)(base),
    /**
     * Wait until root element to exist
     * @param timeout - time to wait until bailing
     */
    wait: timeout => base.wait(timeout),
    /** Get layout switch button */
    getSwitchButton: () => getToolbar().getSwitchButton(),
    /** Get layout switch button divider */
    getSwitchButtonDivider: () => getToolbar().getSwitchButtonDivider(),
    /** Get [TableFoldersUniDriver](./?path=/story/base-components-collections-tablefolders-tablefolders--tablefolders) driver */
    getTable,
    /** Get [GridFoldersUniDriver](./?path=/story/base-components-collections-gridfolders-gridfolders--gridfolders) driver */
    getGrid,
    /** Indicates grid is currently shown */
    isShowingGrid: () => base.$(`[data-hook="toolbar-collection-content"]`).exists(),
    /** Indicates table is currently shown */
    isShowingTable: async () => !(await base.$(`[data-hook="toolbar-collection-content"]`).exists()),
    /**
     * Gets collection summary bar
     */
    getSummaryBar
    // Casting to 'any' to avoid overly complex inferred type error (TS7056).
    // The return type is too large for TypeScript to serialize, so we simplify it here.
    // This cast does not affect runtime behavior.
  };
}
var _default = exports.default = TableGridSwitchFoldersUniDriver;
//# sourceMappingURL=TableGridSwitchFolders.uni.driver.js.map