import React, { useEffect, useState } from 'react';
import { Button } from 'react-native';
import { Text, View } from 'native-base';
import { useSetHeatPumpMode } from '../queries/heatpump';

const TempHome = () => {
  const { mutate: setMode } = useSetHeatPumpMode();

  const [value, setValue] = useState(0);
  useEffect(() => {
    setInterval(() => {
      setValue(prev => prev + 1);
    }, 500);
  }, []);

  return (
    <View className="mt-16">
      <Button title="minus" onPress={() => setValue(prev => prev - 1)} />
      <Text>{value}</Text>
      <Button title="plus" onPress={() => setValue(prev => prev + 1)} />
      <Button title="set" onPress={() => setMode({ mode: 2 })} />
    </View>
  );
};

export default TempHome;
