using System; namespace JustTrack { /// /// Defines units of measurement for events. /// public enum Unit { /// /// We want to count how many times something happened in total. /// Count, /// /// We want to measure how long something takes with millisecond precision. /// Milliseconds, /// /// We want to measure how long something takes with second precision. /// Seconds, } /// /// A time-based unit grouping the milliseconds,seconds units. /// public enum TimeUnitGroup { /// /// See Unit.Milliseconds /// Milliseconds, /// /// See Unit.Seconds /// Seconds, } /// /// Provides conversion utilities for time unit groups in the justtrack SDK. /// internal static class TimeUnitGroupConversions { /// /// Converts a TimeUnitGroup to its corresponding Unit. /// /// The time unit group to convert. /// The corresponding Unit value. internal static Unit ToUnit(TimeUnitGroup unit) { switch (unit) { case TimeUnitGroup.Milliseconds: return Unit.Milliseconds; case TimeUnitGroup.Seconds: return Unit.Seconds; default: throw new Exception($"Unexpected enum variant: {unit}"); } } } }