import 'package:syncrow_app/features/scene/enum/ac_values.dart';
import 'package:syncrow_app/features/scene/enum/operation_dialog_type.dart';
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';

class ACFunctionsHelper {
  static List<SceneStaticFunction> tabToRunAcFunctions(
      String deviceId, String deviceName, functionValue) {
    return [
      SceneStaticFunction(
        deviceType: 'AC',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsAcPower,
        operationName: 'Power',
        code: 'switch',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.onOff,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsAcPower,
            description: "ON",
            value: true,
          ),
          SceneOperationalValue(
            icon: Assets.assetsAcPowerOFF,
            description: "OFF",
            value: false,
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'AC',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsFreezing,
        operationName: 'Mode',
        code: 'mode',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.listOfOptions,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsAcCooling,
            description: AcValuesEnums.Cooling.name,
            value: TempModes.cold.name,
          ),
          SceneOperationalValue(
            icon: Assets.assetsAcHeating,
            description: AcValuesEnums.Heating.name,
            value: TempModes.hot.name,
          ),
          SceneOperationalValue(
            icon: Assets.assetsFanSpeed,
            description: AcValuesEnums.Ventilation.name,
            value: TempModes.wind.name,
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'AC',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsTempreture,
        operationName: 'Set Temperature',
        code: 'temp_set',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.temperature,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsCelsiusDegrees,
            value: 0,
            description: 'COOL TO',
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'AC',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsFanSpeed,
        operationName: 'Fan Speed',
        code: 'level',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.listOfOptions,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsAcFanLow,
            description: ValueACRange.LOW.name,
            value: FanSpeeds.low.name,
          ),
          SceneOperationalValue(
            icon: Assets.assetsAcFanMiddle,
            description: ValueACRange.MIDDLE.name,
            value: FanSpeeds.middle.name,
          ),
          SceneOperationalValue(
            icon: Assets.assetsAcFanHigh,
            description: ValueACRange.HIGH.name,
            value: FanSpeeds.high.name,
          ),
          SceneOperationalValue(
            icon: Assets.assetsAcFanAuto,
            description: ValueACRange.AUTO.name,
            value: FanSpeeds.auto.name,
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'AC',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsChildLock,
        operationName: 'Child Lock',
        code: 'child_lock',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.onOff,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsSceneChildLock,
            description: 'Lock',
            value: true,
          ),
          SceneOperationalValue(
            icon: Assets.assetsSceneChildUnlock,
            description: 'Unlock',
            value: false,
          ),
        ],
      ),
    ];
  }

  static List<SceneStaticFunction> automationAcFunctions(
      String deviceId, String deviceName, functionValue) {
    return [
      SceneStaticFunction(
        deviceType: 'AC',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsAcPower,
        operationName: 'Power',
        code: 'switch',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.onOff,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsAcPower,
            description: "ON",
            value: true,
          ),
          SceneOperationalValue(
            icon: Assets.assetsAcPowerOFF,
            description: "OFF",
            value: false,
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'AC',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsFreezing,
        operationName: 'Mode',
        code: 'mode',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.listOfOptions,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsAcCooling,
            description: AcValuesEnums.Cooling.name,
            value: TempModes.cold.name,
          ),
          SceneOperationalValue(
            icon: Assets.assetsAcHeating,
            description: AcValuesEnums.Heating.name,
            value: TempModes.hot.name,
          ),
          SceneOperationalValue(
            icon: Assets.assetsFanSpeed,
            description: AcValuesEnums.Ventilation.name,
            value: TempModes.wind.name,
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'AC',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsTempreture,
        operationName: 'Set Temperature',
        code: 'temp_set',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.integerSteps,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsCelsiusDegrees,
            value: 0.0,
            description: '°C',
            minValue: 20,
            maxValue: 30,
            stepValue: 0.5,
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'AC',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsCurrentTemp,
        operationName: 'Current Temperature',
        code: 'temp_current',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.integerSteps,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsCelsiusDegrees,
            value: 0.0,
            description: '°C',
            minValue: -9.9,
            maxValue: 99.9,
            stepValue: 0.1,
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'AC',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsFanSpeed,
        operationName: 'Fan Speed',
        code: 'level',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.listOfOptions,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsAcFanLow,
            description: ValueACRange.LOW.name,
            value: FanSpeeds.low.name,
          ),
          SceneOperationalValue(
            icon: Assets.assetsAcFanMiddle,
            description: ValueACRange.MIDDLE.name,
            value: FanSpeeds.middle.name,
          ),
          SceneOperationalValue(
            icon: Assets.assetsAcFanHigh,
            description: ValueACRange.HIGH.name,
            value: FanSpeeds.high.name,
          ),
          SceneOperationalValue(
            icon: Assets.assetsAcFanAuto,
            description: ValueACRange.AUTO.name,
            value: FanSpeeds.auto.name,
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'AC',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsChildLock,
        operationName: 'Child Lock',
        code: 'child_lock',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.onOff,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsSceneChildLock,
            description: 'Lock',
            value: true,
          ),
          SceneOperationalValue(
            icon: Assets.assetsSceneChildUnlock,
            description: 'Unlock',
            value: false,
          ),
        ],
      ),
    ];
  }
}
