using BBWYB.Client.APIServices;
using BBWYB.Client.Models;
using BBWYB.Common.Models;
using CommunityToolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Windows;
using BBWYB.Client.Models.PackPurchaseTask;
using BBWYB.Client.Views.PackPurchaseTask;
using BBWYB.Client.Models.APIModel;
using BBWYB.Client.Models.APIModel.Response.PackPurchaseTask;
using BBWYB.Client.Views.PackPurchaseTaska;
using CommunityToolkit.Mvvm.Messaging;

namespace BBWYB.Client.ViewModels
{
    public class UpdatePurchaseTaskViewModel : BaseVM
    {

        #region 属性

        private ObservableCollection<Models.PackPurchaseTask.PurchaseSku> purchaseSkuList;
        public ObservableCollection<Models.PackPurchaseTask.PurchaseSku> PurchaseSkuList { get => purchaseSkuList; set { SetProperty(ref purchaseSkuList, value); } }

        private string searchSkuId;
        public string SearchSkuId { get => searchSkuId; set { SetProperty(ref searchSkuId, value); } }

        // public long TaskId { get; set; }
        //private bool isSelected;
        //public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } }

        private ObservableCollection<string> worryList = new ObservableCollection<string> {
               "否","是"
             };
        public ObservableCollection<string> WorryList { get => worryList; set { SetProperty(ref worryList, value); } }

        private ObservableCollection<string> positionTypeList = new ObservableCollection<string> {
        "商家仓","齐越仓", "京东仓","聚水潭仓"};
        public ObservableCollection<string> PositionTypeList { get => positionTypeList; set { SetProperty(ref positionTypeList, value); } }

        private ObservableCollection<string> packTypeList = new ObservableCollection<string> {
               "单件","多件"
             };
        public ObservableCollection<string> PackTypeList { get => packTypeList; set { SetProperty(ref packTypeList, value); } }

        private ObservableCollection<string> basicPackList = new ObservableCollection<string> {
               "快递袋","纸箱","麻袋"
             };
        public ObservableCollection<string> BasicPackList { get => basicPackList; set { SetProperty(ref basicPackList, value); } }

        private ObservableCollection<string> isNeedBarCodeList = new ObservableCollection<string> {
        "需要", "不需要" };
        public ObservableCollection<string> IsNeedBarCodeList { get => isNeedBarCodeList; set { SetProperty(ref isNeedBarCodeList, value); } }

        private ObservableCollection<string> isNeedCerList = new ObservableCollection<string> {
        "需要", "不需要" };
        public ObservableCollection<string> IsNeedCerList { get => isNeedCerList; set { SetProperty(ref isNeedCerList, value); } }


        private ObservableCollection<string> certificatePositionList = new ObservableCollection<string> {
                 "无","外部包装","产品包装"
             };
        public ObservableCollection<string> CertificatePositionList { get => certificatePositionList; set { SetProperty(ref certificatePositionList, value); } }

        private ObservableCollection<string> availabilityList = new ObservableCollection<string> {
               "已到货","部分到货","未到货"
             };
        public ObservableCollection<string> AvailabilityList { get => availabilityList; set { SetProperty(ref availabilityList, value); } }

        private int skuCount;
        /// <summary>
        /// Sku任务数
        /// </summary>
        public int SkuCount { get => skuCount; set { SetProperty(ref skuCount, value); } }

        private string skuId;
        /// <summary>
        /// Sku
        /// </summary>
        public string SkuId { get => skuId; set { SetProperty(ref skuId, value); } }



        public string OrderId { get; set; }

        private string logo;
        /// <summary>
        /// 店铺Sku图链接
        /// </summary>
        public string Logo { get => logo; set { SetProperty(ref logo, value); } }

        private string skuName;
        /// <summary>
        /// 采购Sku名称
        /// </summary>
        public string SkuName { get => skuName; set { SetProperty(ref skuName, value); } }

        private string brand;
        /// <summary>
        /// 品牌
        /// </summary>
        public string Brand { get => brand; set { SetProperty(ref brand, value); } }


        private string productNo;
        /// <summary>
        /// 货号
        /// </summary>
        public string ProductNo { get => productNo; set { SetProperty(ref productNo, value); } }

        private string brandName;
        /// <summary>
        /// 品名(手写上传)
        /// </summary>
        public string BrandName { get => brandName; set { SetProperty(ref brandName, value); } }


        private int goodsNumber;
        /// <summary>
        /// 配件数
        /// </summary>
        public int GoodsNumber { get => goodsNumber; set { SetProperty(ref goodsNumber, value); } }
        private Worry isWorry;
        /// <summary>
        /// 是否加急
        /// </summary>
        public Worry IsWorry { get => isWorry; set { SetProperty(ref isWorry, value); } }

        private TaskState availability;
        /// <summary>
        /// 到货情况(待收货=0,部分收货=1,已到货=2)
        /// </summary>
        public TaskState Availability { get => availability; set { SetProperty(ref availability, value); } }

        private PackType packType;
        /// <summary>
        /// 打包类型(单件=0,多件=1)
        /// </summary>
        public PackType PackType { get => packType; set { SetProperty(ref packType, value); } }

        private BasicPack basicPack;
        /// <summary>
        /// 基础包装(快递袋=0,纸箱=1,麻袋=2)
        /// </summary>
        public BasicPack BasicPack { get => basicPack; set { SetProperty(ref basicPack, value); } }

        private PositionType positionType;
        /// <summary>
        /// 落仓(商家仓=0,齐越仓=1,京东仓=2,聚水潭仓=3)
        /// </summary>
        public PositionType PositionType { get => positionType; set { SetProperty(ref positionType, value); } }

        private string skuTitle;
        /// <summary>
        /// sku配件商品名称
        /// </summary>
        public string SkuTitle { get => skuTitle; set { SetProperty(ref skuTitle, value); } }

        private Need isNeedBarCode;
        /// <summary>
        /// 是否需要合格证
        /// </summary>
        public Need IsNeedBarCode { get => isNeedBarCode; set { SetProperty(ref isNeedBarCode, value); } }


        private Need isNeedCertificateModel;
        /// <summary>
        /// 是否需要条形码
        /// </summary>
        public Need IsNeedCertificateModel { get => isNeedCertificateModel; set { SetProperty(ref isNeedCertificateModel, value); } }


        private BarCodeModel barCodeModel;
        /// <summary>
        /// 条形码
        /// </summary>
        public BarCodeModel BarCodeModel { get => barCodeModel; set { SetProperty(ref barCodeModel, value); } }


        private bool isSetBarCode;
        /// <summary>
        /// 设置显示(条形码)
        /// </summary>
        public bool IsSetBarCode
        {
            get => isSetBarCode;
            set
            {

                SetProperty(ref isSetBarCode, value);
                // IsNeedBarCode = IsSetBarCode ? Need.不需要 : Need.需要;
            }
        }

        private bool isSetCertificate;
        /// <summary>
        /// 设置显示(合格证)
        /// </summary>
        public bool IsSetCertificate
        {
            get => isSetCertificate; set
            {

                SetProperty(ref isSetCertificate, value);
                //IsNeedCertificateModel = IsSetCertificate ? Need.不需要 : Need.需要;
            }
        }
        private string setSpuCerStatus;

        public string SetSpuCerStatus { get => setSpuCerStatus; set { SetProperty(ref setSpuCerStatus, value); } }
        private bool isSetSpuCertificate = true;


        /// <summary>
        /// 设置spu显示(合格证)
        /// </summary>
        public bool IsSetSpuCertificate
        {
            get => isSetSpuCertificate; set
            {

                SetProperty(ref isSetSpuCertificate, value);
                SetSpuCerStatus = IsSetSpuCertificate ? "设置spu模板" : "修改spu模板";
            }
        }


        private string saveTask;

        /// <summary>
        /// 设置显示(合格证)
        /// </summary>
        public string SaveTask { get => saveTask; set { SetProperty(ref saveTask, value); } }


        private string spuId;
        /// <summary>
        /// 合格证
        /// </summary>
        public string SpuId { get => spuId; set { SetProperty(ref spuId, value); } }

        private CertificateModel spuCertificateModel;
        /// <summary>
        /// spu合格证
        /// </summary>
        public CertificateModel SpuCertificateModel { get => spuCertificateModel; set { SetProperty(ref spuCertificateModel, value); } }



        private CertificateModel certificateModel;
        /// <summary>
        /// 合格证
        /// </summary>
        public CertificateModel CertificateModel { get => certificateModel; set { SetProperty(ref certificateModel, value); } }

        /// <summary>
        /// 合格证位置(外部包装=0,产品包装=1)
        /// </summary>
        private CertificatePosition certificatePosition;
        /// <summary>
        /// 合格证位置(外部包装=0,产品包装=1)
        /// </summary>
        public CertificatePosition CertificatePosition { get => certificatePosition; set { SetProperty(ref certificatePosition, value); } }

        /// <summary>
        /// 注意事项(对接备注)
        /// </summary>
        private string markMessage;
        /// <summary>
        /// 注意事项(对接备注)
        /// </summary>
        public string MarkMessage { get => markMessage; set { SetProperty(ref markMessage, value); } }


        private ObservableCollection<IncreateModel> increateList;
        /// <summary>
        /// 增量耗材查询关键字
        /// </summary>
        public ObservableCollection<IncreateModel> IncreateList { get => increateList; set { SetProperty(ref increateList, value); } }
        string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" };

        PackPurchaseTaskService packPurchaseTaskService;

        ProductService productService;
        GlobalContext globalContext;
        private bool isLoading = false;
        public bool IsLoading { get => isLoading; set { SetProperty(ref isLoading, value); } }
        #endregion

        public UpdatePurchaseTaskViewModel(ProductService productService, GlobalContext globalContext, PackPurchaseTaskService packPurchaseTaskService, PurchaseService purchaseService)
        {
            this.packPurchaseTaskService = packPurchaseTaskService;
            this.productService = productService;
            this.globalContext = globalContext;
            CreateTaskCommand = new RelayCommand<object>(CreateTask);
            OpenSkuDetailCommand = new RelayCommand<object>(OpenSkuDetail);
            SetBarCodeCommand = new RelayCommand(SetBarCode);
            SetCertificateCommand = new RelayCommand<Models.PackPurchaseTask.PurchaseSku>(SetCertificate);
            LookBarCommand = new RelayCommand(LookBar);
            LookCerCommand = new RelayCommand<string>(LookCer);
           
            IncreateList = new ObservableCollection<IncreateModel>();
            foreach (var item in increates)
            {
                IncreateList.Add(new IncreateModel
                {
                    IncreateName = item,
                    IsSelected = false
                });
            }

            this.purchaseService = purchaseService;

        }
        PurchaseService purchaseService;
        public string OriginShopName { get; set; }
        public string SkuPurchaseSchemeId { get; set; }
        public Platform Platform { get; set; }
        //public string ShopId { get; set; }

        //public string UserName { get; set; }

        #region 方法 
        public ICommand SetBarCodeCommand { get; set; }
        public ICommand SetCertificateCommand { get; set; }
        public ICommand LookBarCommand { get; set; }
        public ICommand LookCerCommand { get; set; }

        public ICommand OpenSkuDetailCommand { get; set; }
        public ICommand CreateTaskCommand { get; set; }

        public ICommand SearchSkuCommand { get; set; }

        private void SetBarCode()
        {
            if (string.IsNullOrEmpty(SkuId))
            {
                return;
            }
            //if (TaskId > 0 && string.IsNullOrEmpty(SpuId))//修改界面刷新配置数据
            //{
            //    SearchSku(SkuId);
            //}

            if (BarCodeModel == null)
            {
                BarCodeModel = new BarCodeModel();
                BarCodeModel.ProductNo = ProductNo;
                BarCodeModel.Brand = Brand;
                BarCodeModel.SkuId = SkuId;
                BarCodeModel.SkuName = SkuName;
            }
            if (!string.IsNullOrEmpty(BrandName))
                BarCodeModel.BrandName = BrandName;

            SetBarCodeWindow setBarCodeWindow = new SetBarCodeWindow();
            setBarCodeWindow.LoadData(BarCodeModel, packPurchaseTaskService);
            setBarCodeWindow.SaveResult = b =>
            {
                BarCodeModel = b;
                IsSetBarCode = false;
                IsNeedBarCode = Need.需要;
            };
            setBarCodeWindow.Show();
        }

        /// <summary>
        /// 设置合格证
        /// </summary>
        private void SetCertificate(Models.PackPurchaseTask.PurchaseSku model)
        {

            if (model.CerDTO == null)
            {
                model.CerDTO = new CertificateModel
                {
                    ProductNo = ProductNo,
                    Brand = Brand,
                    SkuId = SkuId,
                    PurchaseSkuId = model.PurchaseSkuId

                };
            }
            if (!string.IsNullOrEmpty(BrandName))
                model.CerDTO.BrandName = BrandName;

            SetCerWindow setCerWindow = new SetCerWindow();
            setCerWindow.LoadData(model.IsNeedCer, model.CerDTO, packPurchaseTaskService, spuCertificateModel, IsSetSpuCertificate);
            setCerWindow.SaveResult = (s, PackCerState) =>
            {
                var skus = PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == s.PurchaseSkuId);
                skus.CerDTO = s;
                skus.IsSetCertificate = false;
                skus.IsNeedCer = PackCerState == PackCerState.合格证信息;
                IsNeedCertificateModel = Need.需要;
            };
            setCerWindow.Show();
        }


        /// <summary>
        /// 查看合格证
        /// </summary>
        private void LookCer(string id)
        {
            LookCerWindow lookCerWindow = new LookCerWindow(PurchaseSkuList.SingleOrDefault(p => p.PurchaseSkuId == id).CerDTO);
            lookCerWindow.Show();
        }
        /// <summary>
        /// 查看条形码
        /// </summary>
        private void LookBar()
        {
            LookBarCodeWindow look = new LookBarCodeWindow();
            look.SetData(BarCodeModel);
            look.Show();
        }

        /// <summary>
        /// 搜索 skuId(todo:)
        /// </summary>
        public bool SearchSku(PackTaskResponse obj, string shopname, OrderSku order)
        {
            //InitData();

            MarkMessage = obj.MarkMessage;
            //SkuPurchaseSchemeId = "416647656341573";
            OriginShopName = shopname;


            SkuId = order.BelongSkuId;
            OrderId = order.OrderId;

            var shopList = globalContext.User.ShopList;
            var shop = shopList.SingleOrDefault(s => s.ShopName == OriginShopName);
            Logo = order.Logo;
            SkuName = order.Title;
            if (string.IsNullOrEmpty(SkuId))
                return false;

            ApiResponse<ProductListResponse> productApiResponse = null;
            var skuResponse = productService.GetProductSkuList(string.Empty, SkuId, shop.Platform, shop.AppKey, shop.AppSecret, shop.AppToken);
            if (skuResponse.Success)
            {
                if (skuResponse.Data.Count() == 0)
                {
                    return false;
                }
                Logo = skuResponse.Data[0].Logo.Replace("80x80", "200x200");
                SkuName = skuResponse.Data[0].Title;

                SpuId = skuResponse.Data[0].ProductId;

                productApiResponse = productService.GetProductList(skuResponse.Data[0].ProductId, string.Empty, string.Empty, 1,
                    shop.Platform, shop.AppKey, shop.AppSecret, shop.AppToken);

                if (productApiResponse.Success)
                {
                    if (productApiResponse.Data.Count == 0)
                    {

                        return false;
                    }

                    ProductNo = productApiResponse.Data.Items[0].ProductItemNum;
                    Brand = productApiResponse.Data.Items[0].BrandName;

                }
                var productSku = packPurchaseTaskService.GetConfigPack(SkuId, "", OrderId);

                if (productSku == null || !productSku.Success || productSku.Data == null)
                {
                    MessageBox.Show(productSku.Msg);
                    return false;
                }


                SkuPurchaseSchemeId = productSku.Data.SkuPurchaseSchemeId;
                BarCodeModel = productSku.Data.BarCode;
                if (BarCodeModel == null)
                {
                    BarCodeModel = new BarCodeModel();

                }
                if (!string.IsNullOrEmpty(Brand))
                    BarCodeModel.Brand = Brand;
                if (!string.IsNullOrEmpty(BrandName))
                    BarCodeModel.BrandName = BrandName;
                BarCodeModel.ProductNo = ProductNo;
                BarCodeModel.SkuId = SkuId;
                BarCodeModel.SkuName = SkuName;
                PurchaseSkuList = new ObservableCollection<Models.PackPurchaseTask.PurchaseSku>();
                foreach (var item in productSku.Data.PurchaseSkus)
                {
                    var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId);
                    if (list == null) continue;
                    var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId);
                    App.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        PurchaseSkuList.Add(new Models.PackPurchaseTask.PurchaseSku
                        {
                            Logo = skuItem.Logo,
                            Title = skuItem.Title,
                            IsNeedCer = item.IsNeedCer,
                            PurchaseSkuId = item.PurchaseSkuId,
                            CerDTO = item.CerDTO,
                            IsSetCertificate = item.CerDTO == null ? true : false,
                        });
                    }));
                }

                IsNeedBarCode = Need.需要;
                IsSetBarCode = true;
                IsSetCertificate = true;
                if (productSku.Data.PackConfig != null)
                {
                    var config = productSku.Data.PackConfig;
                    SkuTitle = config.SkuGoodsTitle;
                    BrandName = config.BrandName;
                    GoodsNumber = config.GoodsNumber;
                    PackType = (PackType)config.PackType;
                    BasicPack = (BasicPack)config.BasicPack;
                    Availability = (TaskState)config.Availability;
                    //MarkMessage = config.MarkMessage;
                    CertificatePosition = config.CertificatePosition == null ? CertificatePosition.无 : (CertificatePosition)config.CertificatePosition.Value;
                    // Increment1 = config.Increment1;
                   
                    IsNeedBarCode = config.NeedBar ? Need.需要 : Need.不需要;
                    IsNeedCertificateModel = config.NeedCer ? Need.需要 : Need.不需要;

                    IsSetBarCode = !config.NeedBar;
                    IsSetCertificate = !config.NeedCer;
                   
                    string[] increateDatas = config.Increment1?.Split(',');
                    bool isSelected = false;

                    IncreateList = new ObservableCollection<IncreateModel>();
                    foreach (var item in increates)
                    {
                        isSelected = false;
                        if (increateDatas != null && increateDatas.Count() > 0 && increateDatas.Contains(item))
                        {
                            isSelected = true;
                        }
                        App.Current.Dispatcher.Invoke(() =>
                        {
                            IncreateList.Add(new IncreateModel
                            {
                                IncreateName = item,
                                IsSelected = isSelected
                            });
                        });
                    }

                }


                return true;
            }
            else
            {

                App.Current.Dispatcher.Invoke(() => MessageBox.Show(skuResponse.Msg, "加载sku"));
                return false;
            }
            return true;
            //加载配置文件
        }

        //public void SearSpuCer()
        //{
        //    if (string.IsNullOrEmpty(SpuId))
        //    {
        //        SearchSku(SkuId);
        //        return;
        //    }
        //    SpuId = SpuId.Trim();//去掉空格 避免数据异常


        //    var productSku = packPurchaseTaskService.GetSpuCer(SpuId);
        //    if (productSku == null || !productSku.Success)
        //    {
        //        IsSetSpuCertificate = true;

        //        return;
        //    }
        //    SpuCertificateModel = productSku.Data;
        //    IsSetSpuCertificate = false;
        //    if (SpuCertificateModel == null)
        //    {
        //        SpuCertificateModel = new CertificateModel();
        //        IsSetSpuCertificate = true;
        //        SpuCertificateModel.Brand = Brand;
        //        SpuCertificateModel.BrandName = BrandName;
        //        SpuCertificateModel.ProductNo = ProductNo;
        //        SpuCertificateModel.SpuId = SpuId;

        //    }


        //}

        public Action ReflashWindow { get; set; }
        public void InitData()
        {
            PurchaseSkuList = new ObservableCollection<Models.PackPurchaseTask.PurchaseSku>();
            IsSetBarCode = true;
            SkuTitle = "";
            BrandName = "";
            GoodsNumber = 0;
            PackType = PackType.单件;
            BasicPack = BasicPack.快递袋;
            SkuPurchaseSchemeId = "";
            SkuTitle = "";
            BarCodeModel= null;
            OriginShopName = "";

            // Availability = (TaskState.)config.Availability;
            MarkMessage = "";
            CertificatePosition = CertificatePosition.无;
            // Increment1 = config.Increment1;

            IsNeedBarCode = Need.需要;
            IsNeedCertificateModel = Need.不需要;


            bool isSelected;
            IncreateList = new ObservableCollection<IncreateModel>();
            foreach (var item in increates)
            {
                isSelected = false;
                App.Current.Dispatcher.Invoke(() =>
                {
                    IncreateList.Add(new IncreateModel
                    {
                        IncreateName = item,
                        IsSelected = isSelected
                    });
                });
            }
        }
        private void OpenSkuDetail(object param)
        {
            var paramList = (object[])param;
            // var orderId = paramList[0].ToString();
            var skuId = paramList[0].ToString();


            var url = $"https://item.jd.com/{skuId}.html";
            try
            {
                System.Diagnostics.Process.Start("explorer.exe", url);
            }
            catch (Exception ex)
            {
                Clipboard.SetText(url);
                MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示");
            }

        }
        private void CreateTask(object obj)
        {

            string increateStr = "";
            var increates = IncreateList.Where(i => i.IsSelected).Select(i => i.IncreateName);
            if (increates != null && increates.Count() > 0)
            {
                increateStr = string.Join(",", increates);
            }
            var createTaskModel = new UpdatePurchaseTaskRequest
            {
                ProductNo = ProductNo,
                Logo = Logo.Replace("200x200", "80x80"),
                SkuName = SkuName,
                OrderId = OrderId,
                BrandName = BrandName,
                Availability = (int)Availability,
                BasicPack = (int)BasicPack,
                SkuId = SkuId,
                Increment1 = increateStr,

                CertificatePosition = (int)CertificatePosition,
                PackType = (int)PackType,
                MarkMessage = MarkMessage,
                PositionType = (int)PositionType,
                GoodsNumber = GoodsNumber,
                SkuGoodsTitle = SkuTitle,
                SkuCount = SkuCount,
                NeedBar = IsNeedBarCode == Need.需要,
                NeedCer = IsNeedCertificateModel == Need.需要,
                SkuPurchaseSchemeId = SkuPurchaseSchemeId,
                Brand = Brand,
                PurchaseSkuSpecs = PurchaseSkuList.Select(p => new PurchaseSkuSpec
                {
                    IsNeedCer = p.IsNeedCer,
                    PurchaseSkuId = p.PurchaseSkuId,
                }).ToArray()

                //IsWorry = IsWorry
            };
            if (IsNeedBarCode == Need.需要)
            {
                if (BarCodeModel == null || IsSetBarCode || BarCodeModel.Id <= 0)
                {
                    MessageBox.Show("请设置条形码模板");
                    //new TipsWindow("请设置条形码模板").Show();
                    return;
                }
                createTaskModel.BarCodeId = BarCodeModel.Id;
            }
            if (IsNeedCertificateModel == Need.需要)
            {
                var cerList = purchaseSkuList.Where(p => p.IsNeedCer&&p.CerDTO!=null).Select(p => p.CerDTO).Select(c => c.Id).Where(c => c > 0).ToList();
                if (purchaseSkuList.Count() <= 0 || cerList.Count <= 0)
                {
                    MessageBox.Show("请设置合格证模板");
                    return;
                }
                createTaskModel.CerId = string.Join(",", cerList);//
            }
            ApiResponse<long> res = null;

            res = packPurchaseTaskService.UpdatePurchaseTask(createTaskModel);

            if (res.Success)
            {
                if (ReflashWindow != null) ReflashWindow();//刷新主界面

                var win = obj as System.Windows.Window;
                win.Close();
                return;
            }

            MessageBox.Show(res.Msg);
        }
        #endregion
    }
}