<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace CopperEggLib
{
    public class MetricGroup
    {
        internal CopperEgg Client { get; set; }


        [JsonProperty( "id" )]
        public string ID { get; set; }

        [JsonProperty( "name" )]
        public string Name { get; set; }
        [JsonProperty( "label" )]
        public string Label { get; set; }

        [JsonConverter( typeof( TimeSpanSecondsConverter ) )]
        [JsonProperty( "frequency" )]
        public TimeSpan Frequency { get; set; }

        [JsonProperty( "metrics" )]
        public List<Metric> Metrics { get; set; }


        public MetricGroup()
        {
            Metrics = new List<Metric>();
        }


        public Task Delete()
        {
            return Client.DeleteMetricGroup( this.ID );
        }


        public Metric CreateMetric()
        {
            var metric = new Metric();

            Metrics.Add( metric );

            return metric;
        }
    }

    public enum MetricType
    {
        Invalid,

        [EnumMember( Value = "ce_counter" )]
        Counter,
        [EnumMember( Value = "ce_gauge" )]
        Gauge,
        [EnumMember( Value = "ce_gauge_f" )]
        GaugeFloat,
    }

    public class Metric
    {
        [JsonConverter( typeof( StringToEnumConverter ) )]
        [JsonProperty( "type" )]
        public MetricType Type { get; set; }

        [JsonProperty( "name" )]
        public string Name { get; set; }
        [JsonProperty( "label" )]
        public string Label { get; set; }

        [JsonProperty( "position" )]
        public int Position { get; set; }

        [JsonProperty( "units" )]
        public string Units { get; set; }
    }
}<commit_msg>Correct issue with metric units.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace CopperEggLib
{
    public class MetricGroup
    {
        internal CopperEgg Client { get; set; }


        [JsonProperty( "id" )]
        public string ID { get; set; }

        [JsonProperty( "name" )]
        public string Name { get; set; }
        [JsonProperty( "label" )]
        public string Label { get; set; }

        [JsonConverter( typeof( TimeSpanSecondsConverter ) )]
        [JsonProperty( "frequency" )]
        public TimeSpan Frequency { get; set; }

        [JsonProperty( "metrics" )]
        public List<Metric> Metrics { get; set; }


        public MetricGroup()
        {
            Metrics = new List<Metric>();
        }


        public Task Delete()
        {
            return Client.DeleteMetricGroup( this.ID );
        }


        public Metric CreateMetric()
        {
            var metric = new Metric();

            Metrics.Add( metric );

            return metric;
        }
    }

    public enum MetricType
    {
        Invalid,

        [EnumMember( Value = "ce_counter" )]
        Counter,
        [EnumMember( Value = "ce_gauge" )]
        Gauge,
        [EnumMember( Value = "ce_gauge_f" )]
        GaugeFloat,
    }

    public class Metric
    {
        [JsonConverter( typeof( StringToEnumConverter ) )]
        [JsonProperty( "type" )]
        public MetricType Type { get; set; }

        [JsonProperty( "name" )]
        public string Name { get; set; }
        [JsonProperty( "label" )]
        public string Label { get; set; }

        [JsonProperty( "position" )]
        public int Position { get; set; }

        [JsonProperty( "unit" )]
        public string Unit { get; set; }
    }
}
{'fraction_non_alphanumeric': 0.10825688073394496, 'fraction_numerical': 0.0, 'mean_word_length': 1.9489953632148378, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7243648', 'n_tokens_mistral': 1129, 'n_tokens_neox': 1081, 'n_words': 290}