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

namespace Hotline.Configurations
{
    public class AppConfiguration
    {
        public string OldFilesUrls { get; set; }
        public string AppScope { get; set; }
        public YiBinConfiguration YiBin { get; set; }
        public ZiGongConfiguration ZiGong { get; set; }
        public LuZhouConfiguration LuZhou { get; set; }
        public FileUploadConfiguration FileUpload { get; set; }

        public bool IsYiBin => CheckScopeIs(AppDefaults.AppScope.YiBin);
        public bool IsZiGong => CheckScopeIs(AppDefaults.AppScope.ZiGong);
        public bool IsLuZhou => CheckScopeIs(AppDefaults.AppScope.LuZhou);
        public string AreaCode => GetDefaultAppScopeConfiguration().AreaCode;

        private bool CheckScopeIs(string appscope) => string.CompareOrdinal(AppScope, appscope) == 0;

        public DefaultAppScopeConfiguration GetDefaultAppScopeConfiguration()
        {
            return AppScope switch
            {
                AppDefaults.AppScope.YiBin => YiBin,
                AppDefaults.AppScope.ZiGong => ZiGong,
                AppDefaults.AppScope.LuZhou => LuZhou,
                _ => throw new ArgumentOutOfRangeException()
            };
        }
    }

    public class YiBinConfiguration : DefaultAppScopeConfiguration
    {
        public AiQualityConfiguration AiQuality { get; set; }
        public AiVisitConfiguration AiVisit { get; set; }
        public EnterpriseConfiguration Enterprise { get; set; }
    }

    public class ZiGongConfiguration : DefaultAppScopeConfiguration
    {
        public AiQualityConfiguration AiQuality { get; set; }
    }

    public class LuZhouConfiguration : DefaultAppScopeConfiguration
    {
    }

    public class FileUploadConfiguration
    {
        public string Url { get; set; }
    }

    public abstract class DefaultAppScopeConfiguration
    {
        /// <summary>
        /// 行政区划编码
        /// </summary>
        public string AreaCode { get; set; }
        public string CallCenterType { get; set; }
    }
}
