import { UniDriver } from '@wix/wix-ui-test-utils/unidriver';
import { baseUniDriverFactory } from '../../unidriver';
import {
  ButtonUniDriver,
  MessageModalLayoutUniDriver,
  TextButtonUniDriver,
} from '@wix/design-system/dist/testkit/unidriver';

export const ReorderModeToolbarUniDriver = (
  base: UniDriver,
  body: UniDriver,
) => {
  const toolbar = baseUniDriverFactory(base);

  return {
    ...toolbar,
    getTitle: () => base.$('[data-hook="reorder-mode-toolbar-title"]'),
    getLearnMoreBtn: () =>
      TextButtonUniDriver(
        base.$('[data-hook="reorder-mode-toolbar-learn-more-cta"]'),
        body,
      ),
    getCancelButton: () =>
      ButtonUniDriver(
        base.$('[data-hook="reorder-mode-toolbar-cancel-cta"]'),
        body,
      ),
    getSaveButton: () =>
      ButtonUniDriver(
        base.$('[data-hook="reorder-mode-toolbar-save-cta"]'),
        body,
      ),
    getCancelModal: () =>
      MessageModalLayoutUniDriver(
        body.$('[data-hook="reorder-mode-discard-changes-modal"]'),
        body,
      ),
  };
};
