| | | 1 | | namespace Kestrun.Forms; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Defines a rule for a named multipart part. |
| | | 5 | | /// </summary> |
| | | 6 | | public sealed class KrFormPartRule |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Gets or sets the part name to match. |
| | | 10 | | /// </summary> |
| | 285 | 11 | | public required string Name { get; set; } |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Gets or sets the scope name for nested multipart rules. When not set, the rule applies only at the root. |
| | | 15 | | /// </summary> |
| | 110 | 16 | | public string? Scope { get; set; } |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// Gets the nested part rules for multipart/mixed parts. |
| | | 20 | | /// </summary> |
| | 125 | 21 | | public List<KrFormPartRule> NestedRules { get; } = []; |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Gets or sets the description of the part. |
| | | 25 | | /// </summary> |
| | 37 | 26 | | public string? Description { get; set; } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Gets or sets a value indicating whether the part is required. |
| | | 30 | | /// </summary> |
| | 43 | 31 | | public bool Required { get; set; } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Gets or sets a value indicating whether multiple parts with the same name are allowed. |
| | | 35 | | /// </summary> |
| | 87 | 36 | | public bool AllowMultiple { get; set; } = true; |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Gets or sets the allowed content types for the part. |
| | | 40 | | /// </summary> |
| | 88 | 41 | | public List<string> AllowedContentTypes { get; } = []; |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// Gets or sets the allowed file extensions for file parts. |
| | | 45 | | /// </summary> |
| | 86 | 46 | | public List<string> AllowedExtensions { get; } = []; |
| | | 47 | | |
| | | 48 | | /// <summary> |
| | | 49 | | /// Gets or sets the maximum number of bytes allowed for the part. |
| | | 50 | | /// </summary> |
| | 40 | 51 | | public long? MaxBytes { get; set; } |
| | | 52 | | |
| | | 53 | | /// <summary> |
| | | 54 | | /// Gets or sets the decode mode for the part. |
| | | 55 | | /// </summary> |
| | 37 | 56 | | public KrPartDecodeMode DecodeMode { get; set; } = KrPartDecodeMode.None; |
| | | 57 | | |
| | | 58 | | /// <summary> |
| | | 59 | | /// Gets or sets the destination path override for the part. |
| | | 60 | | /// </summary> |
| | 37 | 61 | | public string? DestinationPath { get; set; } |
| | | 62 | | |
| | | 63 | | /// <summary> |
| | | 64 | | /// Gets or sets a value indicating whether the part should be stored to disk. |
| | | 65 | | /// </summary> |
| | 97 | 66 | | public bool StoreToDisk { get; set; } = true; |
| | | 67 | | } |