"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
var _styles = _interopRequireDefault(require("./styles"));
var _reactNativeCloudCa = require("react-native-cloud-ca");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
const Header = props => {
  var _headerTheme$backgrou, _headerTheme$backgrou2;
  const {
    label,
    leftIconImage,
    leftIconTouchable,
    goBack,
    rightIconImage,
    rightIconTouchable
  } = props;
  const cloudCAProviderContext = _react.default.useContext(_reactNativeCloudCa.CloudCAProviderContext);
  const {
    headerTheme
  } = cloudCAProviderContext;
  const defaultColor = 'rgba(238, 0, 51, 0.9)';
  const rightImageStyleDefault = {
    ..._styles.default.iconStyle,
    tintColor: 'transparent'
  };
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: _styles.default.headerContainer
  }, /*#__PURE__*/_react.default.createElement(_reactNative.StatusBar, {
    backgroundColor: (headerTheme === null || headerTheme === void 0 ? void 0 : headerTheme.overlayColor) || defaultColor
  }), /*#__PURE__*/_react.default.createElement(_reactNative.Image, _extends({}, headerTheme === null || headerTheme === void 0 ? void 0 : headerTheme.backgroundImageProps, {
    style: [_styles.default.headerBackgroundImage, (headerTheme === null || headerTheme === void 0 ? void 0 : (_headerTheme$backgrou = headerTheme.backgroundImageProps) === null || _headerTheme$backgrou === void 0 ? void 0 : _headerTheme$backgrou.style) || {}],
    source: (headerTheme === null || headerTheme === void 0 ? void 0 : headerTheme.imageSource) || require('../../asset/image/BG_Viettel.jpeg'),
    resizeMode: (headerTheme === null || headerTheme === void 0 ? void 0 : (_headerTheme$backgrou2 = headerTheme.backgroundImageProps) === null || _headerTheme$backgrou2 === void 0 ? void 0 : _headerTheme$backgrou2.resizeMode) || 'cover'
  })), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: [_styles.default.overlay, {
      backgroundColor: (headerTheme === null || headerTheme === void 0 ? void 0 : headerTheme.overlayColor) || defaultColor
    }]
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: _styles.default.headerButtonContainer
  }, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, _extends({}, leftIconTouchable, {
    onPress: (leftIconTouchable === null || leftIconTouchable === void 0 ? void 0 : leftIconTouchable.onPress) || goBack
  }), /*#__PURE__*/_react.default.createElement(_reactNative.Image, _extends({}, leftIconImage, {
    style: [_styles.default.iconStyle, (leftIconImage === null || leftIconImage === void 0 ? void 0 : leftIconImage.style) || {}],
    source: (leftIconImage === null || leftIconImage === void 0 ? void 0 : leftIconImage.source) || require('../../asset/icon/IC_PREV_ARROW.png')
  }))), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
    style: _styles.default.headerLabel
  }, label || 'Danh sách thiết bị'), /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, _extends({}, rightIconTouchable, {
    disabled: (rightIconTouchable === null || rightIconTouchable === void 0 ? void 0 : rightIconTouchable.disabled) || true
  }), /*#__PURE__*/_react.default.createElement(_reactNative.Image, _extends({}, rightIconImage, {
    style: [rightImageStyleDefault, (rightIconImage === null || rightIconImage === void 0 ? void 0 : rightIconImage.style) || {}],
    source: (rightIconImage === null || rightIconImage === void 0 ? void 0 : rightIconImage.source) || require('../../asset/icon/IC_ADD.png')
  }))))));
};
var _default = Header;
exports.default = _default;
//# sourceMappingURL=Header.js.map