using HKCardOUT.Views;
using HKLib.Dto;
using Logic.RemoteModel;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using XExten.Advance.StaticFramework;

namespace HKCardOUT.Helper
{
    public class DataBus
    {
        private static string _ConnectionString;
        public static string ConnectionString
        {
            get => _ConnectionString;
            set
            {
                var Route = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DATA");
                _ConnectionString = $"DataSource={SyncStatic.CreateFile(Path.Combine(SyncStatic.CreateDir(Route), value))}";
            }
        }
        public static bool NetWordState { get; set; } = false;
        public static string Cron { get; set; }
        public static bool StartDevice { get; set; }
        public static bool Cancel { get; set; }
        public static string StoreId { get; set; }
        public static string COM { get; set; }
        public static string SaasRoute { get; set; }
        public static int Count { get; set; }
        public static TimeSpilte Times { get; set; }
        public static StoreInfoResponse StoreInfo { get; set; }
        public static Dictionary<string, AdWindow> AdStatus { get; set; } = new Dictionary<string, AdWindow>();
    }
    public class ApiRoute
    {
        /// <summary>
        /// 检查卡的状态
        /// </summary>
        public static string CheckCardStatus = DataBus.SaasRoute + "api/member-helper/membercardinfo";
        /// <summary>
        /// 同步消费记录
        /// </summary>
        public static string SyncSaleLog = DataBus.SaasRoute + "api/member-helper/memberconsumptionorrecharge";
        /// <summary>
        /// 获取店铺信息
        /// </summary>
        public static string PullShopInfo = DataBus.SaasRoute + $"api/StoreHelper/GeBasisGateList?StoreId={DataBus.StoreId}";
    }
    public class HKConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (bool)value ? "启用" : "禁用";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value;
        }
    }
}
