import { Block, View, Image, Text, CoverView } from "@tarojs/components";
import "./FR200.less";

interface Props {
  // isShowNurse: boolean;
  currentWorkModeType: number; // 当前工作模式  1：基础脸部等，只有结束按钮 2.促渗，可以开始暂停和结束 3.水分测试
  isStopNurse: boolean;
  isRuningTest: boolean; // 是否在运行测试
  onEmitStartNurse: Function; // 每次点击item，回调事件和数据给父组件
  onEmitSwitchChange: Function;
  onEmitEndPlan: Function;
}
function Index({
  currentWorkModeType,
  isStopNurse,
  isRuningTest,
  onEmitStartNurse,
  onEmitSwitchChange,
  onEmitEndPlan,
}: Props) {
  const onStartNurse = () => {
    onEmitStartNurse();
  };

  const onSwitchChange = () => {
    onEmitSwitchChange();
  };

  const onEndPlan = () => {
    onEmitEndPlan();
  };

  return (
    <Block>
      <View className="iot-footer">
        {currentWorkModeType === 3 && (
          <Block>
            {!isRuningTest ? (
              <View className="btn " onClick={onStartNurse}>
                启动检测
              </View>
            ) : (
              <View className="btn">检测中...</View>
            )}
          </Block>
        )}

        {currentWorkModeType === 2 && (
          <View className="switch-btn-box">
            <View className="btn-item border-right" onClick={onSwitchChange}>
              {isStopNurse ? (
                <Block>
                  <Image
                    className="btn-icon"
                    src={require("@/img/iot/start_nurse.png")}
                    mode="aspectFill"
                  />
                  <Text className="btn-text">启动光照</Text>
                </Block>
              ) : (
                <Block>
                  <Image
                    className="btn-icon"
                    src={require("@/img/iot/pause_nurse.png")}
                    mode="aspectFill"
                  />
                  <Text className="btn-text">暂停光照</Text>
                </Block>
              )}
            </View>

            <View className="btn-item" onClick={onEndPlan}>
              <Image
                className="btn-icon"
                src={require("@/img/iot/over_nurse.png")}
                mode="aspectFill"
              />
              <Text className="btn-text">结束护理</Text>
            </View>
          </View>
        )}
      </View>
    </Block>
  );
}

export default Index;
