import { LOGBOOK_CONTEXT_NAME_PROPOSAL } from '../../../constants/eventTypes';

module.exports = {
  renderingButtons: [
    {
      description: "[newButton] logbook is not public, no 'New Event' Panel",
      isNewButtonEnabled: true,
      text: 'New',
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: false,
      },
      expected: { isEnabled: true, isVisible: true },
    },
    {
      description: '[newButton] logbook is not public, new button not enabled',
      isNewButtonEnabled: false,
      text: 'New',
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: false,
      },
      expected: { isEnabled: false, isVisible: true },
    },
    {
      description: '[newButton] logbook is public, new button not visible',
      isNewButtonEnabled: false,
      text: 'New',
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: true,
      },
      expected: { isEnabled: false, isVisible: false },
    },
    {
      description: '[photoButton] logbook is not public',
      text: 'Take a photo',
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: false,
      },
      expected: { isEnabled: true, isVisible: true },
    },
    {
      description: '[photoButton] logbook is public',
      text: 'Take a photo',
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: true,
      },
      expected: { isEnabled: true, isVisible: false },
    },
    {
      description:
        '[pdfButton] logbook is not public, logbook is empty, no new Event Panel opened',
      text: 'PDF',
      isNewButtonEnabled: true,
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: false,
      },
      eventCountBySelectionFilter: 0,
      expected: { isEnabled: false },
    },
    {
      description:
        '[pdfButton] logbook is not public, logbook is not empty, no new Event Panel opened',
      text: 'PDF',
      isNewButtonEnabled: true,
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: false,
      },
      eventCountBySelectionFilter: 2,
      expected: { isEnabled: true },
    },
    {
      description:
        '[pdfButton] logbook is not public, logbook is not empty, a new Event Panel is opened',
      text: 'PDF',
      isNewButtonEnabled: false,
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: false,
      },
      eventCountBySelectionFilter: 2,
      expected: { isEnabled: false },
    },
    {
      description:
        '[pdfButton] logbook is not public, logbook is empty, a new Event Panel is opened',
      text: 'PDF',
      isNewButtonEnabled: false,
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: false,
      },
      eventCountBySelectionFilter: 0,
      expected: { isEnabled: false },
    },
    {
      description:
        '[pdfButton] logbook is public, logbook is empty, no new Event Panel opened',
      text: 'PDF',
      isNewButtonEnabled: true,
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: true,
      },
      eventCountBySelectionFilter: 0,
      expected: { isEnabled: false },
    },
    {
      description:
        '[pdfButton] logbook is public, logbook is not empty, no new Event Panel opened',
      text: 'PDF',
      isNewButtonEnabled: true,
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: true,
      },
      eventCountBySelectionFilter: 2,
      expected: { isEnabled: true },
    },
    {
      description:
        '[pdfButton] logbook is public, logbook is not empty, a new Event Panel is opened',
      text: 'PDF',
      isNewButtonEnabled: false,
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: true,
      },
      eventCountBySelectionFilter: 2,
      expected: { isEnabled: false },
    },
    {
      description:
        '[pdfButton] logbook is public, logbook is empty, a new Event Panel is opened',
      text: 'PDF',
      isNewButtonEnabled: false,
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: true,
      },
      eventCountBySelectionFilter: 0,
      expected: { isEnabled: false },
    },
  ],

  renderingAutoRefreshMenuItem: [
    {
      description: 'logbook is public',
      autorefreshEventList: false,
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: true,
      },
      expected: {},
    },
    {
      description: 'logbook is not public, is not automatically refreshing',
      autorefreshEventList: false,
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: false,
      },
      expected: {
        text: 'Start refreshing logs',
      },
    },
    {
      description: 'logbook is not public, is automatically refreshing',
      autorefreshEventList: true,
      logbookContext: {
        name: LOGBOOK_CONTEXT_NAME_PROPOSAL,
        isReleased: false,
      },
      expected: {
        text: 'Stop refreshing logs',
      },
    },
  ],
  callingPropFunction: [
    {
      description: 'onSortingButtonClicked',
      isSortingLatestEventsFirst: true,
      eventKey: 3.4,
      expected: 0,
    },
    {
      description: 'onSortingButtonClicked',
      isSortingLatestEventsFirst: false,
      eventKey: 3.4,
      expected: 1,
    },
    {
      description: 'onSortingButtonClicked',
      isSortingLatestEventsFirst: true,
      eventKey: 3.3,
      expected: 1,
    },
    {
      description: 'onSortingButtonClicked',
      isSortingLatestEventsFirst: false,
      eventKey: 3.3,
      expected: 0,
    },
  ],
};
