import 'package:syncrow_web/pages/device_managment/water_heater/models/water_heater_status_model.dart';
import 'package:syncrow_web/pages/routines/models/device_functions.dart';
import 'package:syncrow_web/pages/routines/models/water_heater/water_heater_operational_value.dart';
import 'package:syncrow_web/utils/constants/assets.dart';

abstract class WaterHeaterFunctions
    extends DeviceFunction<WaterHeaterStatusModel> {
  final String type;

  WaterHeaterFunctions({
    required super.deviceId,
    required super.deviceName,
    required super.code,
    required super.operationName,
    required super.icon,
    required this.type,
  });

  List<WaterHeaterOperationalValue> getOperationalValues();
}

class WHRestartStatusFunction extends WaterHeaterFunctions {
  WHRestartStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'relay_status',
          operationName: 'Restart Status',
          icon: Assets.refreshStatusIcon,
        );
       

  @override
  List<WaterHeaterOperationalValue> getOperationalValues() {
    return [
      WaterHeaterOperationalValue(
        icon: Assets.assetsAcPowerOFF,
        description: 'Power OFF',
        value: "off",
      ),
      WaterHeaterOperationalValue(
        icon: Assets.assetsAcPower,
        description: 'Power ON',
        value: 'on',
      ),
      WaterHeaterOperationalValue(
        icon: Assets.refreshStatusIcon,
        description: "Restart  Memory",
        value: 'memory',
      ),
    ];
  }
}

class WHSwitchFunction extends WaterHeaterFunctions {
  WHSwitchFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'switch_1',
          operationName: 'Switch',
          icon: Assets.assetsAcPower,
        );

  @override
  List<WaterHeaterOperationalValue> getOperationalValues() {
    return [
      WaterHeaterOperationalValue(
        icon: Assets.assetsAcPower,
        description: 'ON',
        value: true,
      ),
      WaterHeaterOperationalValue(
        icon: Assets.assetsAcPowerOFF,
        description: 'OFF',
        value: false,
      ),
    ];
  }
}

class TimerConfirmTimeFunction extends WaterHeaterFunctions {
  TimerConfirmTimeFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'countdown_1',
          operationName: 'Timer',
          icon: Assets.targetConfirmTimeIcon,
        );

  @override
  List<WaterHeaterOperationalValue> getOperationalValues() {
    final values = <WaterHeaterOperationalValue>[];

    return values;
  }
}

class BacklightFunction extends WaterHeaterFunctions {
  BacklightFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  })  : 
        super(
          code: 'switch_backlight',
          operationName: 'Backlight',
          icon: Assets.indicator,
        );

  @override
  List<WaterHeaterOperationalValue> getOperationalValues() {
    return [
      WaterHeaterOperationalValue(
        icon: Assets.assetsAcPower,
        description: 'ON',
        value: true,
      ),
      WaterHeaterOperationalValue(
        icon: Assets.assetsAcPowerOFF,
        description: 'OFF',
        value: false,
      ),
    ];
  }
}
