internal static PeriodFeedbackValue DeserializePeriodFeedbackValue(JsonElement element)
        {
            MetricPeriodType periodType = default;
            int periodValue             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("periodType"))
                {
                    periodType = new MetricPeriodType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("periodValue"))
                {
                    periodValue = property.Value.GetInt32();
                    continue;
                }
            }
            return(new PeriodFeedbackValue(periodType, periodValue));
        }
        /// <summary>
        /// Initializes a new instance of <see cref="MetricsAdvisor.MetricPeriodFeedback"/> for mocking purposes.
        /// </summary>
        /// <param name="id">Sets the <see cref="MetricFeedback.Id"/> property.</param>
        /// <param name="createdOn">Sets the <see cref="MetricFeedback.CreatedOn"/> property.</param>
        /// <param name="userPrincipal">Sets the <see cref="MetricFeedback.UserPrincipal"/> property.</param>
        /// <param name="metricId">Sets the <see cref="MetricFeedback.MetricId"/> property.</param>
        /// <param name="dimensionKey">Sets the <see cref="MetricFeedback.DimensionKey"/> property.</param>
        /// <param name="periodType">Sets the <see cref="MetricPeriodFeedback.PeriodType"/> property.</param>
        /// <param name="periodValue">Sets the <see cref="MetricPeriodFeedback.PeriodValue"/> property.</param>
        /// <returns>A new instance of <see cref="MetricsAdvisor.MetricPeriodFeedback"/> for mocking purposes.</returns>
        public static MetricPeriodFeedback MetricPeriodFeedback(string id = null, DateTimeOffset?createdOn = null, string userPrincipal = null, string metricId = null, DimensionKey dimensionKey = null, MetricPeriodType periodType = default, int periodValue = default)
        {
            Dictionary <string, string> dimensions = dimensionKey?.ToDictionary(key => key.Key, key => key.Value);
            FeedbackFilter      filter             = new FeedbackFilter(dimensions);
            PeriodFeedbackValue feedbackValue      = new PeriodFeedbackValue(periodType, periodValue);

            return(new MetricPeriodFeedback(MetricFeedbackKind.Period, id, createdOn, userPrincipal, metricId, filter, feedbackValue));
        }