"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _stack = require("@react-navigation/stack");
var _react = _interopRequireDefault(require("react"));
var _reactI18next = require("react-i18next");
var _HeaderButton = _interopRequireWildcard(require("../components/buttons/HeaderButton"));
var _HeaderHome = _interopRequireDefault(require("../components/buttons/HeaderHome"));
var _theme = require("../contexts/theme");
var _ListProofRequests = _interopRequireDefault(require("../screens/ListProofRequests"));
var _ProofChangeCredential = _interopRequireDefault(require("../screens/ProofChangeCredential"));
var _ProofDetails = _interopRequireDefault(require("../screens/ProofDetails"));
var _ProofRequestDetails = _interopRequireDefault(require("../screens/ProofRequestDetails"));
var _ProofRequestUsageHistory = _interopRequireDefault(require("../screens/ProofRequestUsageHistory"));
var _ProofRequesting = _interopRequireDefault(require("../screens/ProofRequesting"));
var _navigators = require("../types/navigators");
var _testable = require("../utils/testable");
var _defaultStackOptions = require("./defaultStackOptions");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const ProofRequestStack = () => {
  const Stack = (0, _stack.createStackNavigator)();
  const theme = (0, _theme.useTheme)();
  const {
    t
  } = (0, _reactI18next.useTranslation)();
  const defaultStackOptions = (0, _defaultStackOptions.createDefaultStackOptions)(theme);
  return /*#__PURE__*/_react.default.createElement(Stack.Navigator, {
    screenOptions: {
      ...defaultStackOptions
    }
  }, /*#__PURE__*/_react.default.createElement(Stack.Screen, {
    name: _navigators.Screens.ProofRequests,
    component: _ListProofRequests.default,
    options: {
      title: t('Screens.ChooseProofRequest')
    }
  }), /*#__PURE__*/_react.default.createElement(Stack.Screen, {
    name: _navigators.Screens.ProofRequestDetails,
    component: _ProofRequestDetails.default,
    options: () => ({
      title: ''
    })
  }), /*#__PURE__*/_react.default.createElement(Stack.Screen, {
    name: _navigators.Screens.ProofChangeCredential,
    component: _ProofChangeCredential.default,
    options: {
      title: t('Screens.ProofChangeCredential')
    }
  }), /*#__PURE__*/_react.default.createElement(Stack.Screen, {
    name: _navigators.Screens.ProofRequesting,
    component: _ProofRequesting.default,
    options: _ref => {
      let {
        navigation
      } = _ref;
      return {
        title: '',
        headerLeft: () => /*#__PURE__*/_react.default.createElement(_HeaderButton.default, {
          buttonLocation: _HeaderButton.ButtonLocation.Left,
          accessibilityLabel: t('Global.Back'),
          testID: (0, _testable.testIdWithKey)('BackButton'),
          onPress: () => navigation.navigate(_navigators.Screens.ProofRequests, {}),
          icon: "arrow-left"
        })
      };
    }
  }), /*#__PURE__*/_react.default.createElement(Stack.Screen, {
    name: _navigators.Screens.ProofDetails,
    component: _ProofDetails.default,
    options: _ref2 => {
      let {
        navigation,
        route
      } = _ref2;
      return {
        title: '',
        headerLeft: () => /*#__PURE__*/_react.default.createElement(_HeaderButton.default, {
          buttonLocation: _HeaderButton.ButtonLocation.Left,
          accessibilityLabel: t('Global.Back'),
          testID: (0, _testable.testIdWithKey)('BackButton'),
          onPress: () => {
            if (route.params.isHistory) {
              navigation.goBack();
            } else {
              navigation.navigate(_navigators.Screens.ProofRequests, {});
            }
          },
          icon: "arrow-left"
        }),
        headerRight: () => /*#__PURE__*/_react.default.createElement(_HeaderHome.default, null)
      };
    }
  }), /*#__PURE__*/_react.default.createElement(Stack.Screen, {
    name: _navigators.Screens.ProofRequestUsageHistory,
    component: _ProofRequestUsageHistory.default,
    options: () => ({
      title: t('Screens.ProofRequestUsageHistory'),
      headerRight: () => /*#__PURE__*/_react.default.createElement(_HeaderHome.default, null)
    })
  }));
};
var _default = ProofRequestStack;
exports.default = _default;
//# sourceMappingURL=ProofRequestStack.js.map