import 'dart:async';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';

//const String appApi = "http://oauth.sophietelecare.com/api/";
const String ip = "192.168.0.102";
//const String ip = "192.168.68.179";
/*const String appApi = "http://${ip}:4009/";
const String dataUrl = "http://${ip}/naim/data/";
const String socket_conn = "ws://${ip}:4510";*/

const String appApi = "https://naim.acesys.com.ng/";
const String dataUrl = "https://naimdata.acesys.com.ng/data/";
const String socket_conn = "wss://naimsock.acesys.com.ng"; 

//final post_url = "http://localhost:3002/";

abstract class BaseAuth {
  //Future<String> signInWithEmailAndPassword(String email, String password);
  //Future<String> createUserWithEmailAndPassword(String email, String password);
  Future<String> currentUser();
  Future<void> signOut();
  //  Future<String> userEmail();
}

class Auth implements BaseAuth {
  /*Future<String> signInWithEmailAndPassword(String email, String password) async {
    AuthResult auth = await FirebaseAuth.instance.signInWithEmailAndPassword(email: email, password: password);
    return auth.user.uid;
  }

  Future<String> createUserWithEmailAndPassword(String email, String password) async {
    AuthResult auth = await FirebaseAuth.instance.createUserWithEmailAndPassword(email: email, password: password);
    return auth.user.uid;
  }*/

  Future<String> currentUser() async {
    User? auth = FirebaseAuth.instance.currentUser;
    return auth!.uid;
  }

  // Future<List> details() async {
  //   FirebaseUser auth = await FirebaseAuth.instance.currentUser();
  //   return auth;
  // }

  Future<void> signOut() async {
    return FirebaseAuth.instance.signOut();
  }
}

regularizePhoneNumber(String phone) {
  String str = phone;
  if (phone.substring(0, 1) == "0") {
    str = "+234" + phone.substring(1, phone.length);
  }
  return str;
}
