using Core.Abstractions.DomainObjects;

namespace Core.DomainObjects.Documents {
  public class ShopCartItem : DomainObjectDocumentBase<ShopCartItem> {
    public Guid SiteId { get; set; }
    public Guid UserId { get; set; }
    public string Sku { get; set; }
    public uint Quantity { get; set; }
    public DateTime Created { get; set; }
    
    public override int GetHashCode() {
      // https://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-overriding-gethashcode
      // Overflow is fine, just wrap
      unchecked {
        int hash = 17;
        // Suitable nullity checks etc, of course :)
          hash = hash * 23 + Id.GetHashCode();
          hash = hash * 23 + UserId.GetHashCode();
          hash = hash * 23 + Sku.GetHashCode();
          hash = hash * 23 + Quantity.GetHashCode();
          hash = hash * 23 + Created.GetHashCode();
        return hash;
      }
    }
  }
}
