import { UseMutationOptions } from 'react-query';
import { HeatPumpConfig } from './config';
import { HeatPumpState } from './state';

export type Mode = {
  mode: number;
};

export type Temperature = {
  temperature: number;
};

export type Value = {
  value: number;
};

export type HPHeatingConfig = Partial<
  Pick<
    HeatPumpConfig,
    'heating_floor_temperature' | 'heating_hysteresis' | 'room_electric_heating_mode'
  >
>;

export type HPDefrostingConfig = Partial<
  Pick<
    HeatPumpConfig,
    | 'defrost_into_temperature'
    | 'defrost_mode'
    | 'defrost_exit_temperature'
    | 'defrost_maximum_time'
    | 'defrost_entry_cycle_time'
  >
>;

export type HPWaterTankConfig = Partial<
  Pick<HeatPumpConfig, 'water_tank_temperature' | 'water_tank_hysteresis'>
>;

export type HPCoolingConfig = Partial<Pick<HeatPumpConfig, 'cooling_temperature'>>;

export type HPGeneralConfig = Partial<
  Pick<HeatPumpConfig, 'model' | 'shutdown_protection_temperature'>
>;

export type HeatPump = {
  hp_state: HeatPumpState;
  hp_config: HeatPumpConfig;
};

export type OldConfiguration = { oldConfiguration?: HeatPumpConfig };

export type UpdateConfig<T> = Omit<
  UseMutationOptions<void, Response, T, OldConfiguration>,
  'mutationFn'
>;
