﻿using System;
using System.Collections.Generic;

namespace Arch.CFramework.AppInternals.Components.MetricComponents.Attributes
{
    public abstract class MetricBaseAttribute : BaseAttribute
    {
        bool isStream = false;
        bool isDefaultNameSpace = true;
        int duration = 2;
        string nameSpace = string.Empty;

        public string MetricName { get; set; }

        public MetricType MetricType { get; set; }

        /// <summary>
        /// 是否为流式计算
        /// 默认为false
        /// </summary>
        [Obsolete("不用的")]
        internal bool IsStream
        {
            get
            {
                return isStream;
            }
            set
            {
                isStream = value;
            }
        }
        /// <summary>
        /// 缓存时间
        /// 默认值为2分钟
        /// </summary>
        [Obsolete("不用的")]
        public int Duration
        {
            get
            {
                return duration;
            }
            set
            {
                duration = value;
            }
        }

        public string NameSpace
        {
            get { return nameSpace; }
            set
            {
                if (!string.IsNullOrWhiteSpace(value))
                {
                    nameSpace = value;
                    isDefaultNameSpace = false;
                }
            }
        }

        internal bool IsDefaultNameSpace { get { return isDefaultNameSpace; } }
        internal abstract MetricComponent CreateMetricComponent();

        //[Obsolete("此接口不再使用")]
       // internal abstract List<MetricComponent> GetMetricComponents(string nameSpace, DateTime start, DateTime end);

        #region Version 1.4.6
        internal abstract List<MetricComponent> GetMetricComponents(string nameSpace, string metricName, Dictionary<Arch.CFramework.Aggregating.AggregateKey, Arch.CFramework.Aggregating.AggregateResult> arg);
        #endregion

    }
}
