| | 1 | | namespace Syki.Shared; |
| | 2 | |
|
| | 3 | | public class CourseOut |
| | 4 | | { |
| 3086 | 5 | | public Guid Id { get; set; } |
| 2006 | 6 | | public string Name { get; set; } |
| 1988 | 7 | | public CourseType Type { get; set; } |
| 6822 | 8 | | public List<DisciplineOut> Disciplines { get; set; } |
| | 9 | |
|
| | 10 | | public override bool Equals(object? obj) |
| | 11 | | { |
| 18 | 12 | | if (obj is null) return false; |
| 14 | 13 | | return Id == ((CourseOut)obj).Id; |
| | 14 | | } |
| | 15 | |
|
| | 16 | | public override int GetHashCode() |
| | 17 | | { |
| 2 | 18 | | return Id.ToHashCode(); |
| | 19 | | } |
| | 20 | |
|
| | 21 | | public override string ToString() |
| | 22 | | { |
| 2 | 23 | | return Name; |
| | 24 | | } |
| | 25 | |
|
| | 26 | | public static IEnumerable<(string, CourseOut)> GetExamples() => |
| 0 | 27 | | [ |
| 0 | 28 | | ("Direito", |
| 0 | 29 | | new CourseOut |
| 0 | 30 | | { |
| 0 | 31 | | Id = Guid.CreateVersion7(), |
| 0 | 32 | | Name = "Direito", |
| 0 | 33 | | Type = CourseType.Bacharelado, |
| 0 | 34 | | Disciplines = [], |
| 0 | 35 | | }), |
| 0 | 36 | | ("ADS", |
| 0 | 37 | | new CourseOut |
| 0 | 38 | | { |
| 0 | 39 | | Id = Guid.CreateVersion7(), |
| 0 | 40 | | Name = "Análise e Desenvolvimento de Sistemas", |
| 0 | 41 | | Type = CourseType.Tecnologo, |
| 0 | 42 | | Disciplines = [], |
| 0 | 43 | | }), |
| 0 | 44 | | ]; |
| | 45 | |
|
| | 46 | | public static implicit operator CourseOut(OneOf<CourseOut, ErrorOut> value) |
| | 47 | | { |
| 568 | 48 | | return value.Success; |
| | 49 | | } |
| | 50 | | } |