304 lines
6.9 KiB
C#
304 lines
6.9 KiB
C#
using AyCode.Core.Extensions;
|
|
using AyCode.Core.Interfaces;
|
|
using AyCode.Core.Serializers.Attributes;
|
|
using AyCode.Core.Serializers.Binaries;
|
|
using AyCode.Core.Serializers.Jsons;
|
|
using MemoryPack;
|
|
using MessagePack;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace AyCode.Core.Tests.TestModels;
|
|
|
|
#region Shared Reference Base Types
|
|
|
|
public abstract class SharedTagBase : IId<int>
|
|
{
|
|
[Key(0)]
|
|
public int Id { get; set; }
|
|
[Key(1)]
|
|
public string Name { get; set; } = "";
|
|
[AcStringIntern(true)]
|
|
[Key(2)]
|
|
public string Color { get; set; } = "#000000";
|
|
[Key(3)]
|
|
public int Priority { get; set; }
|
|
[Key(4)]
|
|
public bool IsActive { get; set; } = true;
|
|
[Key(5)]
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
[Key(6)]
|
|
public string? Description { get; set; }
|
|
}
|
|
|
|
public abstract class SharedCategoryBase : IId<int>
|
|
{
|
|
[Key(0)]
|
|
public int Id { get; set; }
|
|
[Key(1)]
|
|
public string Name { get; set; } = "";
|
|
[Key(2)]
|
|
public string? Description { get; set; }
|
|
[Key(3)]
|
|
public int SortOrder { get; set; }
|
|
[Key(4)]
|
|
public bool IsDefault { get; set; }
|
|
[Key(5)]
|
|
public int? ParentCategoryId { get; set; }
|
|
[Key(6)]
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
[Key(7)]
|
|
public DateTime? UpdatedAt { get; set; }
|
|
}
|
|
|
|
public abstract class SharedUserBase : IId<int>
|
|
{
|
|
[Key(0)]
|
|
public int Id { get; set; }
|
|
[Key(1)]
|
|
public string Username { get; set; } = "";
|
|
[Key(2)]
|
|
public string Email { get; set; } = "";
|
|
[Key(3)]
|
|
public string FirstName { get; set; } = "";
|
|
[Key(4)]
|
|
public string LastName { get; set; } = "";
|
|
[Key(5)]
|
|
public bool IsActive { get; set; } = true;
|
|
[Key(6)]
|
|
public TestUserRole Role { get; set; } = TestUserRole.User;
|
|
[Key(7)]
|
|
public DateTime? LastLoginAt { get; set; }
|
|
[Key(8)]
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
[Key(9)]
|
|
public UserPreferences_All_True? Preferences { get; set; }
|
|
}
|
|
|
|
public abstract class UserPreferencesBase
|
|
{
|
|
[AcStringIntern(true)]
|
|
[Key(0)]
|
|
public string Theme { get; set; } = "light";
|
|
[AcStringIntern(true)]
|
|
[Key(1)]
|
|
public string Language { get; set; } = "en-US";
|
|
[Key(2)]
|
|
public bool NotificationsEnabled { get; set; } = true;
|
|
[AcStringIntern(true)]
|
|
[Key(3)]
|
|
public string? EmailDigestFrequency { get; set; }
|
|
}
|
|
|
|
public abstract class MetadataInfoBase
|
|
{
|
|
[AcStringIntern(true)]
|
|
[Key(0)]
|
|
public string Key { get; set; } = "";
|
|
[AcStringIntern(true)]
|
|
[Key(1)]
|
|
public string Value { get; set; } = "";
|
|
[Key(2)]
|
|
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
|
|
|
|
[Key(3)]
|
|
public MetadataInfo_All_True? ChildMetadata { get; set; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Order Hierarchy Base Types
|
|
|
|
public abstract class TestOrderBase : IId<int>
|
|
{
|
|
[Key(0)]
|
|
public int Id { get; set; }
|
|
|
|
[Key(1)]
|
|
public string OrderNumber { get; set; } = "";
|
|
|
|
[Key(2)]
|
|
public TestStatus Status { get; set; } = TestStatus.Pending;
|
|
|
|
[Key(3)]
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
[Key(4)]
|
|
public DateTime? PaidDateUtc { get; set; }
|
|
|
|
[Key(5)]
|
|
public decimal TotalAmount { get; set; }
|
|
|
|
[Key(6)]
|
|
public List<TestOrderItem_All_True> Items { get; set; } = [];
|
|
|
|
[Key(7)]
|
|
public SharedTag_All_True? PrimaryTag { get; set; }
|
|
|
|
[Key(8)]
|
|
public SharedTag_All_True? SecondaryTag { get; set; }
|
|
|
|
[Key(9)]
|
|
public SharedUser_All_True? Owner { get; set; }
|
|
|
|
[Key(10)]
|
|
public SharedCategory_All_True? Category { get; set; }
|
|
|
|
[Key(11)]
|
|
public List<SharedTag_All_True> Tags { get; set; } = [];
|
|
|
|
[Key(12)]
|
|
public MetadataInfo_All_True? OrderMetadata { get; set; }
|
|
|
|
[Key(13)]
|
|
public MetadataInfo_All_True? AuditMetadata { get; set; }
|
|
|
|
[Key(14)]
|
|
public List<MetadataInfo_All_True> MetadataList { get; set; } = [];
|
|
|
|
[JsonNoMergeCollection]
|
|
[Key(15)]
|
|
public List<TestOrderItem_All_True> NoMergeItems { get; set; } = [];
|
|
|
|
[MemoryPackIgnore]
|
|
[JsonIgnore]
|
|
[IgnoreMember]
|
|
[BsonIgnore]
|
|
public object? Parent { get; set; }
|
|
}
|
|
|
|
public abstract class TestOrderItemBase : IId<int>
|
|
{
|
|
[Key(0)]
|
|
public int Id { get; set; }
|
|
|
|
[AcStringIntern(true)]
|
|
[Key(1)]
|
|
public string ProductName { get; set; } = "";
|
|
|
|
[Key(2)]
|
|
public int Quantity { get; set; }
|
|
|
|
[Key(3)]
|
|
public decimal UnitPrice { get; set; }
|
|
|
|
[Key(4)]
|
|
public TestStatus Status { get; set; } = TestStatus.Pending;
|
|
|
|
[Key(5)]
|
|
public List<TestPallet_All_True> Pallets { get; set; } = [];
|
|
|
|
[Key(6)]
|
|
public SharedTag_All_True? Tag { get; set; }
|
|
|
|
[Key(7)]
|
|
public SharedUser_All_True? Assignee { get; set; }
|
|
|
|
[Key(8)]
|
|
public MetadataInfo_All_True? ItemMetadata { get; set; }
|
|
|
|
[MemoryPackIgnore]
|
|
[JsonIgnore]
|
|
[IgnoreMember]
|
|
[BsonIgnore]
|
|
public TestOrder_All_True? ParentOrder { get; set; }
|
|
}
|
|
|
|
public abstract class TestPalletBase : IId<int>
|
|
{
|
|
[Key(0)]
|
|
public int Id { get; set; }
|
|
|
|
[Key(1)]
|
|
public string PalletCode { get; set; } = "";
|
|
|
|
[Key(2)]
|
|
public int TrayCount { get; set; }
|
|
|
|
[Key(3)]
|
|
public TestStatus Status { get; set; } = TestStatus.Pending;
|
|
|
|
[Key(4)]
|
|
public double Weight { get; set; }
|
|
|
|
[Key(5)]
|
|
public List<TestMeasurement_All_True> Measurements { get; set; } = [];
|
|
|
|
[Key(6)]
|
|
public SharedTag_All_True? Tag { get; set; }
|
|
|
|
[Key(7)]
|
|
public SharedUser_All_True? Inspector { get; set; }
|
|
|
|
[Key(8)]
|
|
public SharedCategory_All_True? Category { get; set; }
|
|
|
|
[Key(9)]
|
|
public MetadataInfo_All_True? PalletMetadata { get; set; }
|
|
|
|
[MemoryPackIgnore]
|
|
[JsonIgnore]
|
|
[IgnoreMember]
|
|
[BsonIgnore]
|
|
public TestOrderItem_All_True? ParentItem { get; set; }
|
|
}
|
|
|
|
public abstract class TestMeasurementBase : IId<int>
|
|
{
|
|
[Key(0)]
|
|
public int Id { get; set; }
|
|
|
|
[Key(1)]
|
|
public string Name { get; set; } = "";
|
|
|
|
[Key(2)]
|
|
public double TotalWeight { get; set; }
|
|
|
|
[Key(3)]
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
[Key(4)]
|
|
public List<TestMeasurementPoint_All_True> Points { get; set; } = [];
|
|
|
|
[Key(5)]
|
|
public SharedTag_All_True? Tag { get; set; }
|
|
|
|
[Key(6)]
|
|
public SharedUser_All_True? Operator { get; set; }
|
|
|
|
[MemoryPackIgnore]
|
|
[JsonIgnore]
|
|
[IgnoreMember]
|
|
[BsonIgnore]
|
|
public TestPallet_All_True? ParentPallet { get; set; }
|
|
}
|
|
|
|
public abstract class TestMeasurementPointBase : IId<int>
|
|
{
|
|
[Key(0)]
|
|
public int Id { get; set; }
|
|
|
|
[Key(1)]
|
|
public string Label { get; set; } = "";
|
|
|
|
[Key(2)]
|
|
public double Value { get; set; }
|
|
|
|
[Key(3)]
|
|
public DateTime MeasuredAt { get; set; } = DateTime.UtcNow;
|
|
|
|
[Key(4)]
|
|
public SharedTag_All_True? Tag { get; set; }
|
|
|
|
[Key(5)]
|
|
public SharedUser_All_True? Verifier { get; set; }
|
|
|
|
[MemoryPackIgnore]
|
|
[JsonIgnore]
|
|
[IgnoreMember]
|
|
[BsonIgnore]
|
|
public TestMeasurement_All_True? ParentMeasurement { get; set; }
|
|
}
|
|
|
|
#endregion
|