| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.ComponentModel; |
| | 4 | | using System.Runtime.CompilerServices; |
| | 5 | | using System.Text; |
| | 6 | |
|
| | 7 | | namespace MUNity.Models.Resolution |
| | 8 | | { |
| | 9 | |
|
| | 10 | | /// <summary> |
| | 11 | | /// The abstraction of an amendment. The amendment is able to change Operative Paragraphs or interact with them. |
| | 12 | | /// </summary> |
| | 13 | | public class AbstractAmendment : INotifyPropertyChanged |
| | 14 | | { |
| | 15 | | /// <summary> |
| | 16 | | /// The Id of the Amendment. |
| | 17 | | /// </summary> |
| 0 | 18 | | public string Id { get; set; } |
| | 19 | |
|
| 0 | 20 | | private string _name = ""; |
| | 21 | | /// <summary> |
| | 22 | | /// A Name title for the Amendment. This is mostly not used by now but could be. |
| | 23 | | /// </summary> |
| | 24 | | public string Name { |
| 0 | 25 | | get => _name; |
| | 26 | | set |
| 0 | 27 | | { |
| 0 | 28 | | _name = value; |
| 0 | 29 | | NotifyPropertyChanged(nameof(Name)); |
| 0 | 30 | | } |
| | 31 | | } |
| | 32 | |
|
| | 33 | | private string _targetSectionId; |
| | 34 | | /// <summary> |
| | 35 | | /// The Operative Paragraph Id that this Amendment should interact with. |
| | 36 | | /// Note that this is an error in naming and doesnt target the Operative Section of a resolution. |
| | 37 | | /// </summary> |
| | 38 | | public string TargetSectionId { |
| 0 | 39 | | get => _targetSectionId; |
| | 40 | | set |
| 0 | 41 | | { |
| 0 | 42 | | _targetSectionId = value; |
| 0 | 43 | | NotifyPropertyChanged(nameof(TargetSectionId)); |
| 0 | 44 | | } |
| | 45 | | } |
| | 46 | |
|
| 0 | 47 | | private bool _activated = false; |
| | 48 | | /// <summary> |
| | 49 | | /// Is the Amendment activated at the moment. |
| | 50 | | /// This is used if the amendment should be marked in a different way on the views. |
| | 51 | | /// </summary> |
| | 52 | | public bool Activated { |
| 0 | 53 | | get => _activated; |
| | 54 | | set |
| 0 | 55 | | { |
| 0 | 56 | | _activated = value; |
| 0 | 57 | | NotifyPropertyChanged(nameof(Activated)); |
| 0 | 58 | | } |
| | 59 | | } |
| | 60 | |
|
| 0 | 61 | | private string _submitterName = ""; |
| | 62 | | /// <summary> |
| | 63 | | /// The name of the person, country, delegation that started this amendment. |
| | 64 | | /// </summary> |
| | 65 | | public string SubmitterName { |
| 0 | 66 | | get => _submitterName; |
| | 67 | | set |
| 0 | 68 | | { |
| 0 | 69 | | _submitterName = value; |
| 0 | 70 | | NotifyPropertyChanged(nameof(SubmitterName)); |
| 0 | 71 | | } |
| | 72 | | } |
| | 73 | |
|
| | 74 | | private DateTime _submitTime; |
| | 75 | | /// <summary> |
| | 76 | | /// The time this amendment was created. |
| | 77 | | /// </summary> |
| | 78 | | public DateTime SubmitTime { |
| 0 | 79 | | get => _submitTime; |
| | 80 | | set |
| 0 | 81 | | { |
| 0 | 82 | | _submitTime = value; |
| 0 | 83 | | NotifyPropertyChanged(nameof(SubmitTime)); |
| 0 | 84 | | } |
| | 85 | | } |
| | 86 | |
|
| | 87 | | /// <summary> |
| | 88 | | /// A string Type to identify the type of amendment. |
| | 89 | | /// </summary> |
| 0 | 90 | | public string Type { get; set; } |
| | 91 | |
|
| | 92 | | /// <summary> |
| | 93 | | /// The action that should be called when the amendment is accepted and it should interact with |
| | 94 | | /// the resolution and its target operative Paragraph. |
| | 95 | | /// This method will return a NotImplemntedException if you call the base so keep in mind |
| | 96 | | /// to override it. |
| | 97 | | /// </summary> |
| | 98 | | /// <param name="section"></param> |
| | 99 | | /// <returns></returns> |
| | 100 | | public virtual bool Apply(OperativeSection section) |
| 0 | 101 | | { |
| 0 | 102 | | throw new NotImplementedException(); |
| | 103 | | } |
| | 104 | |
|
| | 105 | | /// <summary> |
| | 106 | | /// What should happen if the Amendment is decliened. Remember to override this Method when |
| | 107 | | /// extending from Abstract Amendment. |
| | 108 | | /// </summary> |
| | 109 | | /// <param name="section"></param> |
| | 110 | | /// <returns></returns> |
| | 111 | | public virtual bool Deny(OperativeSection section) |
| 0 | 112 | | { |
| 0 | 113 | | throw new NotImplementedException(); |
| | 114 | | } |
| | 115 | |
|
| | 116 | | /// <summary> |
| | 117 | | /// Creates a new Instance of an amendment and generates a GUID for it. |
| | 118 | | /// </summary> |
| 0 | 119 | | public AbstractAmendment() |
| 0 | 120 | | { |
| 0 | 121 | | Id = Guid.NewGuid().ToString(); |
| 0 | 122 | | } |
| | 123 | |
|
| | 124 | | /// <summary> |
| | 125 | | /// Event that is fired when a property has changed. |
| | 126 | | /// </summary> |
| | 127 | | public event PropertyChangedEventHandler PropertyChanged; |
| | 128 | |
|
| | 129 | | /// <summary> |
| | 130 | | /// Internal Event to fire the Property Changed event. |
| | 131 | | /// </summary> |
| | 132 | | /// <param name="name"></param> |
| | 133 | | protected void NotifyPropertyChanged([CallerMemberName] string name = null) |
| 0 | 134 | | { |
| 0 | 135 | | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); |
| 0 | 136 | | } |
| | 137 | | } |
| | 138 | | } |