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';

class HumanPresenceHelperFunctions {
  static List<SceneStaticFunction> tabToRunHumanPresenceFunctions(
      String deviceId, String deviceName, functionValue) {
    return [
      SceneStaticFunction(
        deviceType: 'WPS',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsFarDetection,
        operationName: 'Far Detection',
        code: 'far_detection',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.listOfOptions,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 75,
            description: '75cm',
            iconValue: '75',
          ),
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 150,
            description: '150cm',
            iconValue: '150',
          ),
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 225,
            description: '225cm',
            iconValue: '225',
          ),
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 300,
            description: '300cm',
            iconValue: '300',
          ),
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 375,
            description: '375cm',
            iconValue: '375',
          ),
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 450,
            description: '450cm',
            iconValue: '450',
          ),
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 525,
            description: '525cm',
            iconValue: '525',
          ),
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 600,
            description: '600cm',
            iconValue: '600',
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'WPS',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsMotionDetection,
        operationName: 'Motion Detection Sensitivity',
        code: 'motion_sensitivity_value',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.listOfOptions,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsSensitivityOperationIcon,
            value: 1,
            description: 1.toString(),
          ),
          SceneOperationalValue(
            icon: Assets.assetsSensitivityOperationIcon,
            value: 2,
            description: 2.toString(),
          ),
          SceneOperationalValue(
            icon: Assets.assetsSensitivityOperationIcon,
            value: 3,
            description: 3.toString(),
          ),
          SceneOperationalValue(
            icon: Assets.assetsSensitivityOperationIcon,
            value: 4,
            description: 4.toString(),
          ),
          SceneOperationalValue(
            icon: Assets.assetsSensitivityOperationIcon,
            value: 5,
            description: 5.toString(),
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'WPS',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsMotionlessDetection,
        operationName: 'Motionless Detection Sensitivity',
        code: 'motionless_sensitivity',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.listOfOptions,
        operationalValues: [
          SceneOperationalValue(
            iconValue: '1',
            icon: Assets.assetsFarDetectionFunction,
            value: 1,
            description: '1',
          ),
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 2,
            description: '2',
            iconValue: '2',
          ),
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 3,
            description: '3',
            iconValue: '3',
          ),
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 4,
            description: '4',
            iconValue: '4',
          ),
          SceneOperationalValue(
            icon: Assets.assetsFarDetectionFunction,
            value: 5,
            description: '5',
            iconValue: '5',
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'WPS',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsIndicator,
        operationName: 'Indicator',
        code: 'indicator',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.onOff,
        operationalValues: [
          SceneOperationalValue(
              icon: Assets.assetsAcPower, description: "ON", value: true),
          SceneOperationalValue(
              icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
        ],
      ),
    ];
  }

  static List<SceneStaticFunction> automationHumanPresenceFunctions(
      String deviceId, String deviceName, functionValue) {
    return [
      SceneStaticFunction(
        deviceType: 'WPS',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsPresenceState,
        operationName: 'Presence State',
        code: 'presence_state',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.listOfOptions,
        operationalValues: [
          SceneOperationalValue(
            icon: Assets.assetsIconsPresenceSensorAssetsEmpty,
            value: 'none',
            description: 'None',
          ),
          SceneOperationalValue(
            icon: Assets.assetsPresence,
            value: 'presence',
            description: 'Presence',
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'WPS',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsIconsPresenceSensorAssetsDistance,
        operationName: 'Current Distance',
        code: 'dis_current',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.integerSteps,
        operationalValues: [
          SceneOperationalValue(
            icon: '',
            value: 0.0,
            description: "CM",
            minValue: 1,
            maxValue: 600,
            stepValue: 1,
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'WPS',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsIconsPresenceSensorAssetsIlluminanceValue,
        operationName: 'Illuminance Value',
        code: 'illuminance_value',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.integerSteps,
        operationalValues: [
          SceneOperationalValue(
            icon: '',
            value: 0.0,
            description: "Lux",
            minValue: 0,
            maxValue: 10000,
            stepValue: 1,
          ),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'WPS',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsIndicator,
        operationName: 'Indicator',
        code: 'indicator',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.onOff,
        operationalValues: [
          SceneOperationalValue(
              icon: Assets.assetsAcPower, description: "ON", value: true),
          SceneOperationalValue(
              icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
        ],
      ),
      SceneStaticFunction(
        deviceType: 'WPS',
        deviceId: deviceId,
        deviceName: deviceName,
        icon: Assets.assetsIconsPresenceSensorAssetsTime,
        operationName: 'Presence Time',
        code: 'presence_time',
        functionValue: functionValue,
        operationDialogType: OperationDialogType.integerSteps,
        operationalValues: [
          SceneOperationalValue(
              icon: '',
              value: 0.0,
              minValue: 0.0,
              maxValue: 65535,
              stepValue: 1,
              description: 'min'),
        ],
      ),
    ];
  }
}
