-
Notifications
You must be signed in to change notification settings - Fork 469
Expand file tree
/
Copy pathStarship.cs
More file actions
78 lines (67 loc) · 2.75 KB
/
Starship.cs
File metadata and controls
78 lines (67 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// ------------------------------------------------------------------------
// This file is licensed to you under the MIT License.
// ------------------------------------------------------------------------
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using static FluentUI.Demo.SampleData.Olympics2024;
namespace FluentUI.Demo.SampleData;
/// <summary>
/// A class representing a starship with various properties and validation attributes.
/// </summary>
[RequiresUnreferencedCode("Necessary because of RangeAttribute usage")]
public class Starship
{
/// <summary>
/// The unique identifier for the starship.
/// </summary>
[Required]
[MinLength(3, ErrorMessage = "Identifier is too short")]
[StringLength(16, ErrorMessage = "Identifier too long (16 character limit)")]
public string? Identifier { get; set; }
/// <summary>
/// The unique identifier for the starship.
/// </summary>
[Required]
[MinLength(8, ErrorMessage = "Password is too short")]
[RegularExpression(@"[A-Z][a-z]{\d}+", ErrorMessage = "Password must contain at least one uppercase letter, one lowercase letter and one digit")]
public string? Password { get; set; }
/// <summary>
/// The description of the starship.
/// </summary>
[Required(ErrorMessage = "Description is required")]
[MinLength(10, ErrorMessage = "Description is too short")]
public string? Description { get; set; }
/// <summary>
/// Countries where the starship is registered.
/// </summary>
[Required(ErrorMessage = "Countries are required")]
[MinLength(1, ErrorMessage = "Countries are required")]
public IEnumerable<Country>? Countries { get; set; }
/// <summary>
/// Classification of the starship.
/// </summary>
[Required(ErrorMessage = "A classification is required")]
public string? Classification { get; set; }
/// <summary>
/// Maximum accommodation capacity of the starship.
/// </summary>
[Required(ErrorMessage = "Maximum accommodation is required")]
//[Range(1, 100000, ErrorMessage = "Accommodation invalid (1-100000)")]
public string? MaximumAccommodation { get; set; }
/// <summary>
/// Indicates whether the starship design has been validated.
/// </summary>
[Required]
[Range(typeof(bool), "true", "true",
ErrorMessage = "This form disallows unapproved ships")]
public bool IsValidatedDesign { get; set; }
/// <summary>
/// The production date of the starship.
/// </summary>
[Required]
public DateTime? ProductionDate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the starship is equipped with a teleporter.
/// </summary>
public bool HasTeleporter { get; set; }
}