'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _regenerator = require('babel-runtime/regenerator');

var _regenerator2 = _interopRequireDefault(_regenerator);

var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');

var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);

var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');

var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _ArbitrablePermissionList = require('kleros-interaction/build/contracts/ArbitrablePermissionList');

var _ArbitrablePermissionList2 = _interopRequireDefault(_ArbitrablePermissionList);

var _eth = require('../../../constants/eth');

var ethConstants = _interopRequireWildcard(_eth);

var _Arbitrable2 = require('./Arbitrable');

var _Arbitrable3 = _interopRequireDefault(_Arbitrable2);

var _deployContractAsync = require('../../../utils/deployContractAsync');

var _deployContractAsync2 = _interopRequireDefault(_deployContractAsync);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Provides interaction with an Arbitrable Transaction contract deployed on the blockchain.
 */
var ArbitrablePermissionList = function (_Arbitrable) {
  (0, _inherits3.default)(ArbitrablePermissionList, _Arbitrable);

  /**
   * Constructor ArbitrableTransaction.
   * @param {object} web3Provider instance
   * @param {string} contractAddress of the contract
   */
  function ArbitrablePermissionList(web3Provider, contractAddress) {
    var _this2 = this;

    (0, _classCallCheck3.default)(this, ArbitrablePermissionList);

    var _this = (0, _possibleConstructorReturn3.default)(this, (ArbitrablePermissionList.__proto__ || (0, _getPrototypeOf2.default)(ArbitrablePermissionList)).call(this, web3Provider, _ArbitrablePermissionList2.default, contractAddress));

    _this.getItemByDisputeId = function () {
      var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(disputeId) {
        return _regenerator2.default.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                _context.next = 2;
                return _this.loadContract();

              case 2:
                return _context.abrupt('return', _this.contractInstance.disputeIDToItem(disputeId));

              case 3:
              case 'end':
                return _context.stop();
            }
          }
        }, _callee, _this2);
      }));

      return function (_x) {
        return _ref.apply(this, arguments);
      };
    }();

    return _this;
  }

  /**
   * Deploy ArbitrablePermissionList. TODO
   * @param {object} account Ethereum account (default account[0])
   * @param {number} value funds to be placed in contract
   * @param {object} web3Provider web3 provider object
   * @returns {object} truffle-contract Object | err The deployed contract or an error
   */
  // static deploy = async (
  //   account,
  //   value = ethConstants.TRANSACTION.VALUE,
  //   web3Provider
  // ) => {
  //   // const contractDeployed = await deployContractAsync()
  //   //
  //   // return contractDeployed
  // }

  return ArbitrablePermissionList;
}(_Arbitrable3.default);

exports.default = ArbitrablePermissionList;
//# sourceMappingURL=ArbitrablePermissionList.js.map