import 'package:syncrow_web/pages/device_managment/power_clamp/models/power_clamp_batch_model.dart';
import 'package:syncrow_web/pages/routines/models/device_functions.dart';
import 'package:syncrow_web/pages/routines/models/pc/enrgy_clamp_operational_value.dart';
import 'package:syncrow_web/utils/constants/assets.dart';

abstract class EnergyClampFunctions extends DeviceFunction<PowerClampModel1> {
  final String type;

  EnergyClampFunctions({
    required super.deviceId,
    required super.deviceName,
    required super.code,
    required super.operationName,
    required super.icon,
    required this.type,
    super.step,
    super.unit,
    super.max,
    super.min,
  });

  List<EnergyClampOperationalValue> getOperationalValues();
}

// General & shared
class TotalEnergyConsumedStatusFunction extends EnergyClampFunctions {
  TotalEnergyConsumedStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'EnergyConsumed',
          operationName: 'Total Energy Consumed',
          icon: Assets.energyConsumedIcon,
          min: 0.00,
          max: 20000000.00,
          step: 1,
          unit: "kWh",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class TotalActivePowerConsumedStatusFunction extends EnergyClampFunctions {
  TotalActivePowerConsumedStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'ActivePower',
          operationName: 'Total Active Power',
          icon: Assets.powerActiveIcon,
          min: -19800000,
          max: 19800000,
          step: 0.1,
          unit: "kW",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class VoltagePhaseSequenceDetectionFunction extends EnergyClampFunctions {
  VoltagePhaseSequenceDetectionFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'voltage_phase_seq',
          operationName: 'Voltage phase sequence detection',
          icon: Assets.voltageIcon,
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [
        EnergyClampOperationalValue(
            icon: Assets.voltageIcon, description: '0', value: '0'),
        EnergyClampOperationalValue(
            icon: Assets.voltageIcon, description: '1', value: '1'),
        EnergyClampOperationalValue(
            icon: Assets.voltageIcon, description: '2', value: '2'),
        EnergyClampOperationalValue(
            icon: Assets.voltageIcon, description: '3', value: '3'),
        EnergyClampOperationalValue(
            icon: Assets.voltageIcon, description: '4', value: '4'),
        EnergyClampOperationalValue(
            icon: Assets.voltageIcon, description: '5', value: '5'),
      ];
}

class TotalCurrentStatusFunction extends EnergyClampFunctions {
  TotalCurrentStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'Current',
          operationName: 'Total Current',
          icon: Assets.voltMeterIcon,
          min: 0.000,
          max: 9000.000,
          step: 1,
          unit: "A",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class FrequencyStatusFunction extends EnergyClampFunctions {
  FrequencyStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'Frequency',
          operationName: 'Frequency',
          icon: Assets.frequencyIcon,
          min: 0,
          max: 80,
          step: 1,
          unit: "Hz",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

// Phase A
class EnergyConsumedAStatusFunction extends EnergyClampFunctions {
  EnergyConsumedAStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'EnergyConsumedA',
          operationName: 'Energy Consumed A',
          icon: Assets.energyConsumedIcon,
          min: 0.00,
          max: 20000000.00,
          step: 1,
          unit: "kWh",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class ActivePowerAStatusFunction extends EnergyClampFunctions {
  ActivePowerAStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'ActivePowerA',
          operationName: 'Active Power A',
          icon: Assets.powerActiveIcon,
          min: 200,
          max: 300,
          step: 1,
          unit: "kW",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class VoltageAStatusFunction extends EnergyClampFunctions {
  VoltageAStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'VoltageA',
          operationName: 'Voltage A',
          icon: Assets.voltageIcon,
          min: 0.0,
          max: 500,
          step: 1,
          unit: "V",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class PowerFactorAStatusFunction extends EnergyClampFunctions {
  PowerFactorAStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'PowerFactorA',
          operationName: 'Power Factor A',
          icon: Assets.speedoMeter,
          min: 0.00,
          max: 1.00,
          step: 0.1,
          unit: "",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class CurrentAStatusFunction extends EnergyClampFunctions {
  CurrentAStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'CurrentA',
          operationName: 'Current A',
          icon: Assets.voltMeterIcon,
          min: 0.000,
          max: 3000.000,
          step: 1,
          unit: "A",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

// Phase B
class EnergyConsumedBStatusFunction extends EnergyClampFunctions {
  EnergyConsumedBStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'EnergyConsumedB',
          operationName: 'Energy Consumed B',
          icon: Assets.energyConsumedIcon,
          min: 0.00,
          max: 20000000.00,
          step: 1,
          unit: "kWh",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class ActivePowerBStatusFunction extends EnergyClampFunctions {
  ActivePowerBStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'ActivePowerB',
          operationName: 'Active Power B',
          icon: Assets.powerActiveIcon,
          min: -6600000,
          max: 6600000,
          step: 1,
          unit: "kW",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class VoltageBStatusFunction extends EnergyClampFunctions {
  VoltageBStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'VoltageB',
          operationName: 'Voltage B',
          icon: Assets.voltageIcon,
          min: 0.0,
          max: 500,
          step: 1,
          unit: "V",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class CurrentBStatusFunction extends EnergyClampFunctions {
  CurrentBStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'CurrentB',
          operationName: 'Current B',
          icon: Assets.voltMeterIcon,
          min: 0.000,
          max: 3000.000,
          step: 1,
          unit: "A",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class PowerFactorBStatusFunction extends EnergyClampFunctions {
  PowerFactorBStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'PowerFactorB',
          operationName: 'Power Factor B',
          icon: Assets.speedoMeter,
          min: 0.0,
          max: 1.0,
          step: 0.1,
          unit: "",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

// Phase C
class EnergyConsumedCStatusFunction extends EnergyClampFunctions {
  EnergyConsumedCStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'EnergyConsumedC',
          operationName: 'Energy Consumed C',
          icon: Assets.energyConsumedIcon,
          min: 0.00,
          max: 20000000.00,
          step: 1,
          unit: "kWh",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class ActivePowerCStatusFunction extends EnergyClampFunctions {
  ActivePowerCStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'ActivePowerC',
          operationName: 'Active Power C',
          icon: Assets.powerActiveIcon,
          min: -6600000,
          max: 6600000,
          step: 1,
          unit: "kW",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class VoltageCStatusFunction extends EnergyClampFunctions {
  VoltageCStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'VoltageC',
          operationName: 'Voltage C',
          icon: Assets.voltageIcon,
          min: 0.00,
          max: 500,
          step: 0.1,
          unit: "V",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class CurrentCStatusFunction extends EnergyClampFunctions {
  CurrentCStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'CurrentC',
          operationName: 'Current C',
          icon: Assets.voltMeterIcon,
          min: 0.000,
          max: 3000.000,
          step: 0.1,
          unit: "A",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}

class PowerFactorCStatusFunction extends EnergyClampFunctions {
  PowerFactorCStatusFunction({
    required super.deviceId,
    required super.deviceName,
    required super.type,
  }) : super(
          code: 'PowerFactorC',
          operationName: 'Power Factor C',
          icon: Assets.speedoMeter,
          min: 0.0,
          max: 1.0,
          step: 0.1,
          unit: "",
        );

  @override
  List<EnergyClampOperationalValue> getOperationalValues() => [];
}
