import 'dart:async';

import 'package:async/src/result/result.dart';
import 'package:hmg_patient_app_new/features/smartwatch_health_data/platform_channel/samsung_platform_channel.dart';
import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/watch_helper.dart' show WatchHelper;

class SamsungHealth extends WatchHelper {

  final SamsungPlatformChannel platformChannel = SamsungPlatformChannel();

  @override
  FutureOr<void> getHeartRate() async {
    try {
      await platformChannel.getHeartRate();

    }catch(e){
      print('Error getting heart rate: $e');
    }


  }

  @override
  Future<Result<bool>> initDevice() async {
      var result = await  platformChannel.initDevice();
      if(result.isError){
        return result;
      }
      return await platformChannel.getRequestedPermission();
  }

  @override
  FutureOr<void> getSleep() async {
    try {
      await platformChannel.getSleep();

    }catch(e){
      print('Error getting heart rate: $e');
    }
  }

  @override
  FutureOr<void> getSteps() async{
    try {
      await platformChannel.getSteps();

    }catch(e){
      print('Error getting heart rate: $e');
    }
  }
  @override
  Future<void> getActivity() async{
    try {
      await platformChannel.getActivity();
    }catch(e){
      print('Error getting heart rate: $e');
    }
  }

   @override
  Future<dynamic> retrieveData() async{
    try {
      return await platformChannel.retrieveData();
    }catch(e){
      print('Error getting heart rate: $e');
    }
  }

  @override
  Future<dynamic> getBloodOxygen()  async{
    try {
      return await platformChannel.getBloodOxygen();
    }catch(e){
      print('Error getting heart rate: $e');
    }
  }

  @override
  Future<dynamic> getBodyTemperature() async  {
    try {
      return await platformChannel.getBodyTemperature();
    }catch(e){
      print('Error getting heart rate: $e');
    }
  }

  @override
  FutureOr<void> getDistance() async{
    try {
      return await platformChannel.getDistance();
    }catch(e){
      print('Error getting heart rate: $e');
    }
  }



}