using System;
using System.Collections.Generic;
using System.Text;
using iElection.Models.Config;
using Xamarin.Essentials;

namespace iElection.Utilities
{
    public class UserUtilities
    {
        private string _userToken;
        public string UserToken
        {
            get
            {
                if (_userToken == null)
                    _userToken = Preferences.Get(Settings.UserToken, string.Empty);
                return _userToken;
            }
            set
            {
                Preferences.Set(Settings.UserToken, value);
                _userToken = value;
            }
        }

        public bool IsAuthorized
        {
            get
            {
                if (string.IsNullOrEmpty(UserToken))
                    return false;
                return true;
            }
        }
    }
}
