|
4 | 4 | using System.Collections.Generic; |
5 | 5 | using System.Runtime.Serialization; |
6 | 6 | using Newtonsoft.Json; |
| 7 | +using System.ComponentModel.DataAnnotations; |
7 | 8 |
|
8 | | -namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ShippingV2 { |
| 9 | +namespace FikaAmazonAPI.AmazonSpApiSDK.Models.ShippingV2 |
| 10 | +{ |
9 | 11 |
|
10 | 12 | /// <summary> |
11 | 13 | /// A tracking event. |
12 | 14 | /// </summary> |
13 | 15 | [DataContract] |
14 | | - public class Event { |
| 16 | + public partial class Event : IEquatable<Event>, IValidatableObject |
| 17 | + { |
15 | 18 | /// <summary> |
16 | 19 | /// Gets or Sets EventCode |
17 | 20 | /// </summary> |
18 | | - [DataMember(Name="eventCode", EmitDefaultValue=false)] |
| 21 | + [DataMember(Name = "eventCode", EmitDefaultValue = false)] |
19 | 22 | [JsonProperty(PropertyName = "eventCode")] |
20 | 23 | public EventCode EventCode { get; set; } |
21 | 24 |
|
22 | 25 | /// <summary> |
23 | 26 | /// Gets or Sets Location |
24 | 27 | /// </summary> |
25 | | - [DataMember(Name="location", EmitDefaultValue=false)] |
| 28 | + [DataMember(Name = "location", EmitDefaultValue = false)] |
26 | 29 | [JsonProperty(PropertyName = "location")] |
27 | 30 | public Location Location { get; set; } |
28 | 31 |
|
29 | 32 | /// <summary> |
30 | 33 | /// The ISO 8601 formatted timestamp of the event. |
31 | 34 | /// </summary> |
32 | 35 | /// <value>The ISO 8601 formatted timestamp of the event.</value> |
33 | | - [DataMember(Name="eventTime", EmitDefaultValue=false)] |
| 36 | + [DataMember(Name = "eventTime", EmitDefaultValue = false)] |
34 | 37 | [JsonProperty(PropertyName = "eventTime")] |
35 | 38 | public DateTime? EventTime { get; set; } |
36 | 39 |
|
| 40 | + /// <summary> |
| 41 | + /// Gets or Sets ShipmentType |
| 42 | + /// </summary> |
| 43 | + [DataMember(Name = "shipmentType", EmitDefaultValue = false)] |
| 44 | + [JsonProperty(PropertyName = "shipmentType", NullValueHandling = NullValueHandling.Ignore)] |
| 45 | + public ShipmentType? ShipmentType { get; set; } |
| 46 | + |
37 | 47 |
|
38 | 48 | /// <summary> |
39 | | - /// Get the string presentation of the object |
| 49 | + /// Returns the string presentation of the object |
40 | 50 | /// </summary> |
41 | 51 | /// <returns>String presentation of the object</returns> |
42 | | - public override string ToString() { |
| 52 | + public override string ToString() |
| 53 | + { |
43 | 54 | var sb = new StringBuilder(); |
44 | 55 | sb.Append("class Event {\n"); |
45 | 56 | sb.Append(" EventCode: ").Append(EventCode).Append("\n"); |
46 | 57 | sb.Append(" Location: ").Append(Location).Append("\n"); |
47 | 58 | sb.Append(" EventTime: ").Append(EventTime).Append("\n"); |
| 59 | + sb.Append(" ShipmentType: ").Append(ShipmentType).Append("\n"); |
48 | 60 | sb.Append("}\n"); |
49 | 61 | return sb.ToString(); |
50 | 62 | } |
51 | 63 |
|
| 64 | + /// <summary> |
| 65 | + /// Returns true if objects are equal |
| 66 | + /// </summary> |
| 67 | + /// <param name="input">Object to be compared</param> |
| 68 | + /// <returns>Boolean</returns> |
| 69 | + public override bool Equals(object input) |
| 70 | + { |
| 71 | + return this.Equals(input as Event); |
| 72 | + } |
| 73 | + |
| 74 | + /// <summary> |
| 75 | + /// Returns true if ModelEvent instances are equal |
| 76 | + /// </summary> |
| 77 | + /// <param name="input">Instance of ModelEvent to be compared</param> |
| 78 | + /// <returns>Boolean</returns> |
| 79 | + public bool Equals(Event input) |
| 80 | + { |
| 81 | + if (input == null) |
| 82 | + return false; |
| 83 | + |
| 84 | + return |
| 85 | + ( |
| 86 | + this.EventCode == input.EventCode || |
| 87 | + (this.EventCode != null && |
| 88 | + this.EventCode.Equals(input.EventCode)) |
| 89 | + ) && |
| 90 | + ( |
| 91 | + this.Location == input.Location || |
| 92 | + (this.Location != null && |
| 93 | + this.Location.Equals(input.Location)) |
| 94 | + ) && |
| 95 | + ( |
| 96 | + this.EventTime == input.EventTime || |
| 97 | + (this.EventTime != null && |
| 98 | + this.EventTime.Equals(input.EventTime)) |
| 99 | + ) && |
| 100 | + ( |
| 101 | + this.ShipmentType == input.ShipmentType || |
| 102 | + (this.ShipmentType != null && |
| 103 | + this.ShipmentType.Equals(input.ShipmentType)) |
| 104 | + ); |
| 105 | + } |
| 106 | + |
| 107 | + /// <summary> |
| 108 | + /// Gets the hash code |
| 109 | + /// </summary> |
| 110 | + /// <returns>Hash code</returns> |
| 111 | + public override int GetHashCode() |
| 112 | + { |
| 113 | + unchecked // Overflow is fine, just wrap |
| 114 | + { |
| 115 | + int hashCode = 41; |
| 116 | + if (this.EventCode != null) |
| 117 | + hashCode = hashCode * 59 + this.EventCode.GetHashCode(); |
| 118 | + if (this.Location != null) |
| 119 | + hashCode = hashCode * 59 + this.Location.GetHashCode(); |
| 120 | + if (this.EventTime != null) |
| 121 | + hashCode = hashCode * 59 + this.EventTime.GetHashCode(); |
| 122 | + if (this.ShipmentType != null) |
| 123 | + hashCode = hashCode * 59 + this.ShipmentType.GetHashCode(); |
| 124 | + return hashCode; |
| 125 | + } |
| 126 | + } |
| 127 | + |
| 128 | + /// <summary> |
| 129 | + /// To validate all properties of the instance |
| 130 | + /// </summary> |
| 131 | + /// <param name="validationContext">Validation context</param> |
| 132 | + /// <returns>Validation Result</returns> |
| 133 | + IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) |
| 134 | + { |
| 135 | + yield break; |
| 136 | + } |
| 137 | + |
52 | 138 | /// <summary> |
53 | 139 | /// Get the JSON string presentation of the object |
54 | 140 | /// </summary> |
55 | 141 | /// <returns>JSON string presentation of the object</returns> |
56 | | - public string ToJson() { |
| 142 | + public string ToJson() |
| 143 | + { |
57 | 144 | return JsonConvert.SerializeObject(this, Formatting.Indented); |
58 | 145 | } |
59 | 146 |
|
60 | | -} |
| 147 | + } |
61 | 148 | } |
0 commit comments