import _Icon from "@alifd/next/es/icon";
import _Switch from "@alifd/next/es/switch";
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["type", "autoWidth", "defaultChecked", "size", "loading", "disabled", "checkedChildren", "unCheckedChildren", "checkedChildrenIcon", "unCheckedChildrenIcon", "backgroundColor", "style"];
/* eslint-disable @typescript-eslint/no-shadow */
import * as React from 'react';
import "./index.scss";
var MySwitch = function MySwitch(_ref) {
  var type = _ref.type,
    autoWidth = _ref.autoWidth,
    defaultChecked = _ref.defaultChecked,
    size = _ref.size,
    loading = _ref.loading,
    disabled = _ref.disabled,
    checkedChildren = _ref.checkedChildren,
    unCheckedChildren = _ref.unCheckedChildren,
    checkedChildrenIcon = _ref.checkedChildrenIcon,
    unCheckedChildrenIcon = _ref.unCheckedChildrenIcon,
    backgroundColor = _ref.backgroundColor,
    _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _style = style || {};
  _style.backgroundColor = backgroundColor;
  var _otherProps = otherProps || {};
  _otherProps.style = _style;

  // const textClass = ['textda', 'textzhong', 'textxiao']
  // let num = 1
  // if (size === '大') {
  //     num = 0
  // } else if (size === '中') {
  //     num = 1
  // } else {
  //     num = 2
  // }

  var text = function text() {
    return /*#__PURE__*/React.createElement(_Switch, _extends({
      autoWidth: true,
      defaultChecked: defaultChecked,
      checked: defaultChecked,
      loading: loading,
      size: size,
      disabled: disabled,
      checkedChildren: checkedChildren,
      unCheckedChildren: unCheckedChildren
    }, _otherProps));
  };
  var icon = function icon() {
    return /*#__PURE__*/React.createElement(_Switch, _extends({
      autoWidth: true,
      defaultChecked: defaultChecked,
      checked: defaultChecked,
      loading: loading,
      size: size,
      disabled: disabled,
      checkedChildren: /*#__PURE__*/React.createElement(_Icon, {
        type: checkedChildrenIcon,
        size: "xs"
      }),
      unCheckedChildren: /*#__PURE__*/React.createElement(_Icon, {
        type: unCheckedChildrenIcon,
        size: "xs"
      })
    }, _otherProps));
  };
  return function () {
    switch (type) {
      case "文字":
        return text();
        break;
      case "icon":
        return icon();
        break;
      default:
        return null;
    }
  }();
};
export default MySwitch;