using APT.BaseData.Domain.Entities.FM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace APT.BaseData.Domain.ApiModel
{
	/// <summary>
	/// 外部连接配置参数
	/// </summary>
	public class ExtConnParamModel
	{
        private Guid? _orgId;

		private Dictionary<string, string> _params = new Dictionary<string, string>();


		public Dictionary<string, string> Params { get { return _params; } }

		/// <summary>
		/// 参数
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		public string this[string key]
		{
			get { return GetParam(key); }
		}

        public Guid? OrgId
        {
            get { return _orgId; }
            set { _orgId = value; }
        }

        public T_FM_BASE_CONFIG BaseConfig { get; set; }

        /// <summary>
        /// 设置参数 
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public void AddParam(string key,string value)
		{
			_params[key] = value;
		}
		/// <summary>
		/// 获取参数
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		public string GetParam(string key)
		{
			string v = string.Empty;

			foreach (var p in _params)
			{
				if (string.Compare(p.Key, key, true) == 0)
				{
					v = p.Value;
					break;
				}
			}
			return v;
		}

	}
}
