using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace GMCabsDriverAssistant.Utils
{
    public class SecureStorageData
    {
        public const string Token = "Token";
        public const string CanAcceptBookings = "CanAcceptBookings";
        public const string CanUpdateLicence = "CanUpdateLicence";
        public const string CanScanVouchers = "CanScanVouchers";
        public const string InitLaunched = "InitLaunched";
        public const string UnSeenBooking = "UnSeenBooking";
        public const string DriverName = "DriverName";
        public const string CanViewCoupons = "CanViewCoupons";
        public const string CanViewSettings = "CanViewSettings";
        public const string CanViewHome = "CanViewHome";
        public const string CanViewJobHistory = "CanViewJobHistory";
        public const string FirstSeenFutureBooking = "FirstSeenFutureBooking";
        public const string IsLocationPermitted = "IsLocationPermitted";
        public const string IsBatteryOptimizationDisabled = "IsBatteryOptimizationDisabled";
        public static async Task<string> GetSecureStorage(string keyName)
        {
            string value = null;
            try
            {
                value = await SecureStorage.GetAsync(keyName);
            }
            catch (Exception)
            {
            }
            finally
            {
                if (String.IsNullOrEmpty(value))
                {
                    value  =  DefaultValue(keyName);
                }
            }
            return value;
        }
        private static string DefaultValue(string keyName)
        {
            switch (keyName)
            {
                case Token:
                    return "";
                case CanAcceptBookings:
                    return "False";
                case CanUpdateLicence:
                    return "False";
                case CanScanVouchers:
                    return "False";
                default:
                    return "";
            }
        }
    }
}
