namespace API.Models.DataClasses;

public readonly record struct SixDigitInt
{
    public SixDigitInt(int value)
    {
        if (value < 0 || value > 999999)
            throw new ArgumentOutOfRangeException(nameof(value),
                "Wert muss zwischen 0 und 999999 liegen.");

        Value = value;
    }

    public int Value { get; }

    public override string ToString()
    {
        return Value.ToString("D6");
    }

    public static implicit operator int(SixDigitInt v)
    {
        return v.Value;
    }
}