using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using PhilExample.Interfaces;
using PhilExampleCrawler.Common.Models;
using Xamarin.Forms;

namespace PhilExample.Services
{
    internal class UserService : IUserService
    {
        private User _user;
        public User CurrentUser => _user;

        private readonly IRESTAccess _rest = DependencyService.Get<IRESTAccess>();

        public async Task<bool> LoginAsync(int userID)
        {
            var url = App.WebAPI_URL + $"User?userID={userID}";
            _user = await _rest.GetAsync<User>(url);

            return _user != null;
        }

        public Task<User> RegisterUserAsync(string authCode, string phoneNumber, bool optin_telegram)
        {
            throw new NotImplementedException();
        }
    }
}
