| | | 1 | | namespace NexusLabs.Needlr.Generators.Models; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Information about a DataAnnotation attribute on an options property. |
| | | 5 | | /// </summary> |
| | | 6 | | internal readonly struct DataAnnotationInfo |
| | | 7 | | { |
| | | 8 | | public DataAnnotationInfo( |
| | | 9 | | DataAnnotationKind kind, |
| | | 10 | | string? errorMessage = null, |
| | | 11 | | object? minimum = null, |
| | | 12 | | object? maximum = null, |
| | | 13 | | string? pattern = null, |
| | | 14 | | int? minimumLength = null) |
| | | 15 | | { |
| | 23 | 16 | | Kind = kind; |
| | 23 | 17 | | ErrorMessage = errorMessage; |
| | 23 | 18 | | Minimum = minimum; |
| | 23 | 19 | | Maximum = maximum; |
| | 23 | 20 | | Pattern = pattern; |
| | 23 | 21 | | MinimumLength = minimumLength; |
| | 23 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <summary>The kind of DataAnnotation attribute.</summary> |
| | 23 | 25 | | public DataAnnotationKind Kind { get; } |
| | | 26 | | |
| | | 27 | | /// <summary>Custom error message if specified.</summary> |
| | 23 | 28 | | public string? ErrorMessage { get; } |
| | | 29 | | |
| | | 30 | | /// <summary>Minimum value for Range attribute.</summary> |
| | 6 | 31 | | public object? Minimum { get; } |
| | | 32 | | |
| | | 33 | | /// <summary>Maximum value for Range/StringLength/MaxLength attributes.</summary> |
| | 9 | 34 | | public object? Maximum { get; } |
| | | 35 | | |
| | | 36 | | /// <summary>Pattern for RegularExpression attribute.</summary> |
| | 1 | 37 | | public string? Pattern { get; } |
| | | 38 | | |
| | | 39 | | /// <summary>Minimum length for StringLength/MinLength attributes.</summary> |
| | 3 | 40 | | public int? MinimumLength { get; } |
| | | 41 | | } |