namespace zero.Numbers; /// /// Configuration of number generation /// Template can use the following placeholders: /// {number} for the current number /// {random} for a random number (default length is 5) /// {random:7} for a random number with the specified length /// {year} for the date in yyyy /// {date} for the date in dd-mm-yyyy /// {date:dmy} for the date in a custom format, where dmy is a nested placeholder for the format /// public class Number : ZeroEntity { /// /// The template to build the number. /// The number will reset to StartNumber once a new year is reached. /// This is only applicable if the template contains the placeholder {year}. /// Example: {year}-{number} will result in 2020-01, 2020-02, ... 2021-01, 2021-02, ... /// public string Template { get; set; } = "{number}"; /// /// Where to start, lol /// public long StartNumber { get; set; } = 1; /// /// Minimum length of the number (append 0's when it is too short) /// public int MinLength { get; set; } = 1; /// /// How far to increase /// public int Step { get; set; } = 1; /// /// Whether to start a new number when a new year is reached and the template contains the yeae /// public bool ResetPerYear { get; set; } = false; /// /// Store current counters /// public List Counters { get; set; } = new(); /// /// Post process the compiled number /// public virtual string PostProcess(string compiled) => compiled; } public class NumberCounter { public string Key { get; set; } public long Count { get; set; } }