using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; using eprintServer.Enums; namespace eprintServer.Entities; [Table("product_categories")] public class ProductCategory { [Column("id")] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long Id { get; set; } public List Name { get; set; } = new List(); [Column("image_id")] public long? ImageId { get; set; } public FileModel? Image { get; set; } [Column("product_type")] public ProductTypeEnum ProductType { get; set; } [Column("archive")] public bool Archive { get; set; } [Column("timestmp")] public DateTime Timestamp { get; set; } [JsonIgnore] public ICollection Products { get; set; } = new List(); [JsonIgnore] public ICollection CustomizableProducts { get; set; } = new List(); public ProductCategory() { Timestamp = DateTime.UtcNow; Archive = false; ProductType = ProductTypeEnum.Sellable; } public void SetImage(FileModel file) { Image = file; ImageId = file.Id; } }