| | 1 | | using System; |
| | 2 | | using MUNity.Base; |
| | 3 | | using MUNity.Database.Models.Conference; |
| | 4 | |
|
| | 5 | | namespace MUNity.Database.FluentAPI; |
| | 6 | |
|
| | 7 | | public class CommitteeOptionsBuilder |
| | 8 | | { |
| 107 | 9 | | public Committee Committee { get; } |
| | 10 | |
|
| | 11 | | public CommitteeOptionsBuilder WithName(string name) |
| 9 | 12 | | { |
| 9 | 13 | | Committee.Name = name; |
| 9 | 14 | | return this; |
| 9 | 15 | | } |
| | 16 | |
|
| | 17 | | public CommitteeOptionsBuilder WithFullName(string fullName) |
| 9 | 18 | | { |
| 9 | 19 | | Committee.FullName = fullName; |
| 9 | 20 | | return this; |
| 9 | 21 | | } |
| | 22 | |
|
| | 23 | | public CommitteeOptionsBuilder WithShort(string shortName) |
| 8 | 24 | | { |
| 8 | 25 | | Committee.CommitteeShort = shortName; |
| 8 | 26 | | return this; |
| 8 | 27 | | } |
| | 28 | |
|
| | 29 | | public CommitteeOptionsBuilder WithType(CommitteeTypes type) |
| 8 | 30 | | { |
| 8 | 31 | | Committee.CommitteeType = type; |
| 8 | 32 | | return this; |
| 8 | 33 | | } |
| | 34 | |
|
| | 35 | | public CommitteeOptionsBuilder WithTopic(Action<CommitteeTopicOptionsBuilder> options) |
| 22 | 36 | | { |
| 22 | 37 | | var builder = new CommitteeTopicOptionsBuilder(); |
| 22 | 38 | | options(builder); |
| 22 | 39 | | Committee.Topics.Add(builder.Topic); |
| 22 | 40 | | return this; |
| 22 | 41 | | } |
| | 42 | |
|
| | 43 | | public CommitteeOptionsBuilder WithTopic(string name) |
| 22 | 44 | | { |
| 44 | 45 | | return WithTopic(options => options.WithName(name)); |
| 22 | 46 | | } |
| | 47 | |
|
| | 48 | | public CommitteeOptionsBuilder WithSubCommittee(Action<CommitteeOptionsBuilder> options) |
| 2 | 49 | | { |
| 2 | 50 | | var builder = new CommitteeOptionsBuilder(); |
| 2 | 51 | | options(builder); |
| 2 | 52 | | Committee.ChildCommittees.Add(builder.Committee); |
| 2 | 53 | | builder.Committee.ResolutlyCommittee = Committee; |
| 2 | 54 | | builder.Committee.Conference = this.Committee.Conference; |
| 2 | 55 | | return this; |
| 2 | 56 | | } |
| | 57 | |
|
| 9 | 58 | | public CommitteeOptionsBuilder() |
| 9 | 59 | | { |
| 9 | 60 | | this.Committee = new Committee(); |
| 9 | 61 | | } |
| | 62 | | } |