This commit is contained in:
qwsdcvghyu89
2025-09-27 13:37:40 +10:00
parent db9bdecea6
commit 13c6fbaf5f
23 changed files with 45 additions and 1295 deletions
+41
View File
@@ -0,0 +1,41 @@
using System.Text.Json;
using Beam.Abstractions;
namespace Beam.Models {
public record class ArticleData : IArticleData {
public string? Name { get; set; }
public string[] Authors { get; set; } = [];
public string? Language { get; set; }
public string[] Categories { get; set; } = [];
public string? Version { get; set; }
public string? Description { get; set; }
public string AsJson(JsonSerializerOptions? options = null) {
return JsonSerializer.Serialize(this, options);
}
public virtual bool Equals(ArticleData? other) {
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return Name == other.Name && Authors.Equals(other.Authors) && Language == other.Language && Categories.Equals(other.Categories) && Version == other.Version && Description == other.Description;
}
public virtual bool Equals(IArticleData? other) {
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return Name == other.Name && Authors.Equals(other.Authors) && Language == other.Language && Categories.Equals(other.Categories) && Version == other.Version && Description == other.Description;
}
public override int GetHashCode() {
unchecked {
var hashCode = (Name != null ? Name.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ Authors.GetHashCode();
hashCode = (hashCode * 397) ^ (Language != null ? Language.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ Categories.GetHashCode();
hashCode = (hashCode * 397) ^ (Version != null ? Version.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
return hashCode;
}
}
}
}