/*
* Amazon Shipping API
*
* The Amazon Shipping API is designed to support outbound shipping use cases both for orders originating on Amazon-owned marketplaces as well as external channels/marketplaces. With these APIs, you can request shipping rates, create shipments, cancel shipments, and track shipments.
*
* OpenAPI spec version: v2
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using Newtonsoft.Json;
namespace Amazon.SellingPartnerApiSDK.AmazonSpApiSDK.Models.ShippingV2
{
///
/// The payload for the getTracking operation.
///
[DataContract]
public partial class GetTrackingResult : IEquatable, IValidatableObject
{
///
/// Initializes a new instance of the class.
///
[JsonConstructor]
protected GetTrackingResult() { }
///
/// Initializes a new instance of the class.
///
/// trackingId (required).
/// alternateLegTrackingId (required).
/// A list of tracking events. (required).
/// The date and time by which the shipment is promised to be delivered. (required).
/// summary (required).
public GetTrackingResult(TrackingId trackingId = default(TrackingId), AlternateLegTrackingId alternateLegTrackingId = default(AlternateLegTrackingId), List eventHistory = default(List), DateTime? promisedDeliveryDate = default(DateTime?), TrackingSummary summary = default(TrackingSummary))
{
// to ensure "trackingId" is required (not null)
if (trackingId == null)
{
throw new InvalidDataException("trackingId is a required property for GetTrackingResult and cannot be null");
}
else
{
this.TrackingId = trackingId;
}
// to ensure "alternateLegTrackingId" is required (not null)
if (alternateLegTrackingId == null)
{
throw new InvalidDataException("alternateLegTrackingId is a required property for GetTrackingResult and cannot be null");
}
else
{
this.AlternateLegTrackingId = alternateLegTrackingId;
}
// to ensure "eventHistory" is required (not null)
if (eventHistory == null)
{
throw new InvalidDataException("eventHistory is a required property for GetTrackingResult and cannot be null");
}
else
{
this.EventHistory = eventHistory;
}
// to ensure "promisedDeliveryDate" is required (not null)
if (promisedDeliveryDate == null)
{
throw new InvalidDataException("promisedDeliveryDate is a required property for GetTrackingResult and cannot be null");
}
else
{
this.PromisedDeliveryDate = promisedDeliveryDate;
}
// to ensure "summary" is required (not null)
if (summary == null)
{
throw new InvalidDataException("summary is a required property for GetTrackingResult and cannot be null");
}
else
{
this.Summary = summary;
}
}
///
/// Gets or Sets TrackingId
///
[DataMember(Name="trackingId", EmitDefaultValue=false)]
public TrackingId TrackingId { get; set; }
///
/// Gets or Sets AlternateLegTrackingId
///
[DataMember(Name="alternateLegTrackingId", EmitDefaultValue=false)]
public AlternateLegTrackingId AlternateLegTrackingId { get; set; }
///
/// A list of tracking events.
///
/// A list of tracking events.
[DataMember(Name="eventHistory", EmitDefaultValue=false)]
public List EventHistory { get; set; }
///
/// The date and time by which the shipment is promised to be delivered.
///
/// The date and time by which the shipment is promised to be delivered.
[DataMember(Name="promisedDeliveryDate", EmitDefaultValue=false)]
public DateTime? PromisedDeliveryDate { get; set; }
///
/// Gets or Sets Summary
///
[DataMember(Name="summary", EmitDefaultValue=false)]
public TrackingSummary Summary { get; set; }
///
/// Returns the string presentation of the object
///
/// String presentation of the object
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class GetTrackingResult {\n");
sb.Append(" TrackingId: ").Append(TrackingId).Append("\n");
sb.Append(" AlternateLegTrackingId: ").Append(AlternateLegTrackingId).Append("\n");
sb.Append(" EventHistory: ").Append(EventHistory).Append("\n");
sb.Append(" PromisedDeliveryDate: ").Append(PromisedDeliveryDate).Append("\n");
sb.Append(" Summary: ").Append(Summary).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
///
/// Returns the JSON string presentation of the object
///
/// JSON string presentation of the object
public virtual string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
///
/// Returns true if objects are equal
///
/// Object to be compared
/// Boolean
public override bool Equals(object input)
{
return this.Equals(input as GetTrackingResult);
}
///
/// Returns true if GetTrackingResult instances are equal
///
/// Instance of GetTrackingResult to be compared
/// Boolean
public bool Equals(GetTrackingResult input)
{
if (input == null)
return false;
return
(
this.TrackingId == input.TrackingId ||
(this.TrackingId != null &&
this.TrackingId.Equals(input.TrackingId))
) &&
(
this.AlternateLegTrackingId == input.AlternateLegTrackingId ||
(this.AlternateLegTrackingId != null &&
this.AlternateLegTrackingId.Equals(input.AlternateLegTrackingId))
) &&
(
this.EventHistory == input.EventHistory ||
this.EventHistory != null &&
this.EventHistory.SequenceEqual(input.EventHistory)
) &&
(
this.PromisedDeliveryDate == input.PromisedDeliveryDate ||
(this.PromisedDeliveryDate != null &&
this.PromisedDeliveryDate.Equals(input.PromisedDeliveryDate))
) &&
(
this.Summary == input.Summary ||
(this.Summary != null &&
this.Summary.Equals(input.Summary))
);
}
///
/// Gets the hash code
///
/// Hash code
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.TrackingId != null)
hashCode = hashCode * 59 + this.TrackingId.GetHashCode();
if (this.AlternateLegTrackingId != null)
hashCode = hashCode * 59 + this.AlternateLegTrackingId.GetHashCode();
if (this.EventHistory != null)
hashCode = hashCode * 59 + this.EventHistory.GetHashCode();
if (this.PromisedDeliveryDate != null)
hashCode = hashCode * 59 + this.PromisedDeliveryDate.GetHashCode();
if (this.Summary != null)
hashCode = hashCode * 59 + this.Summary.GetHashCode();
return hashCode;
}
}
///
/// To validate all properties of the instance
///
/// Validation context
/// Validation Result
IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}