using LiteDB; using System; namespace Vanadium.Classes.DBs.DBClasses { public class RoomConsumablesDBClasses { /// /// A creator-made consumable for sale in a room's shop. /// The client identifies these purely by GUID, so the GUID is the primary key. /// public class RoomConsumable { [BsonId] public Guid RoomConsumableId { get; set; } = Guid.NewGuid(); public long RoomId { get; set; } public long CreatorPlayerId { get; set; } public string Name { get; set; } = ""; public string? Description { get; set; } public string? ImageName { get; set; } public int Price { get; set; } /// Room currency the item is priced in; null means it is priced in tokens. public Guid? CurrencyId { get; set; } /// Soft delete — players may still hold deleted items in inventory. public bool IsDeleted { get; set; } public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime ModifiedAt { get; set; } = DateTime.UtcNow; } /// One player's stack of one consumable. public class RoomConsumableOwnership { [BsonId] public long Id { get; set; } public long PlayerId { get; set; } public Guid RoomConsumableId { get; set; } public int Count { get; set; } /// /// Client-generated token guarding consume/purchase races. The client adopts the /// NewConcurrencyCode it sent regardless of what the response echoes back, so this /// must be stored verbatim or the next consume fails with ConcurrencyCodeMismatch. /// public Guid ConcurrencyCode { get; set; } = Guid.NewGuid(); public DateTime ModifiedAt { get; set; } = DateTime.UtcNow; } /// /// A player's balance of one room currency. Vanadium has no room-currency registry yet /// (see RoomConsumablesController.PurchaseCurrency), so this exists to make /// currency-priced purchases work once one is added. /// public class RoomCurrencyBalance { [BsonId] public long Id { get; set; } public long PlayerId { get; set; } public Guid CurrencyId { get; set; } public int Balance { get; set; } public DateTime ModifiedAt { get; set; } = DateTime.UtcNow; } } }