"use strict";

exports.__esModule = true;
exports.EntityPageUniDriver = void 0;
var _unidriver = require("../../unidriver");
var _unidriver2 = require("@wix/design-system/dist/testkit/unidriver");
var _FormPageContentUni = require("../FormPageContent/FormPageContent.uni.driver");
const EntityPageUniDriver = (base, body) => {
  const formPageContentUniDriver = (0, _FormPageContentUni.FormPageContentUniDriver)(base, body);
  /** Check if the EntityPage.Card shows a skeleton header */
  const cardShowsSkeletonHeader = dataHook => formPageContentUniDriver.getCard(dataHook).showsSkeletonHeader();

  /** Returns EntityPage.Slots driver by dataHook */
  const getSlots = dataHook => ({
    showsSkeletonHeader: () => cardShowsSkeletonHeader(dataHook),
    getChildByDataHook: childDataHook => base.$(`[data-hook="${childDataHook}"]`),
    ...(0, _unidriver.baseUniDriverFactory)(base.$(`[data-hook="${dataHook}"]`))
  });
  const getBadgeAt = index => {
    return (0, _unidriver2.BadgeUniDriver)(base.$(`[data-hook="form-page-header-badge-${index}"]`), body);
  };
  return {
    /** Returns EntityPage.Extensions driver by dataHook */
    getExtensions: getSlots,
    /** Returns EntityPage.Slots driver by dataHook */
    getSlots,
    /** Returns page header driver */
    getPageHeader: () => {
      const pageHeader = (0, _unidriver2.PageHeaderUniDriver)(base.$(`[data-hook="entity-page-header"]`), body);
      return {
        ...pageHeader,
        getBadgeAt
      };
    },
    /** Returns badge driver at index */
    getBadgeAt,
    ...formPageContentUniDriver,
    ...(0, _unidriver.baseUniDriverFactory)(base)
  };
};
exports.EntityPageUniDriver = EntityPageUniDriver;
//# sourceMappingURL=EntityPage.uni.driver.js.map