using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; namespace eprintServer.Entities; [Table("customizable_products")] public class CustomizableProduct { [Column("id")] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long Id { get; set; } [Column("base_price")] public decimal BasePrice { get; set; } [Column("is_canvas_enabled")] public bool IsCanvasEnabled { get; set; } [Column("minimum_order_quantity")] public int MinimumOrderQuantity { get; set; } [Column("base_delivery_days")] public int BaseDeliveryDays { get; set; } [Column("allowed_quantities", TypeName = "jsonb")] public List? AllowedQuantities { get; set; } = new List(); [Column("category_id")] public long CategoryId { get; set; } [JsonIgnore] public ProductCategory Category { get; set; } public List Names { get; set; } = new List(); public List Descriptions { get; set; } = new List(); [Column("quantity_pricing_config", TypeName = "jsonb")] public QuantityPricingConfig? QuantityPricingConfig { get; set; } [Column("archive")] public bool Archive { get; set; } [Column("unit_weight")] public decimal? UnitWeight { get; set; } [Column("image_id")] public long? ImageId { get; set; } public FileModel? Image { get; set; } [Column("timestmp")] public DateTime Timestamp { get; set; } [JsonIgnore] public ICollection Steps { get; set; } = new List(); [Column("is_branching_enabled")] public bool? IsBranchingEnabled { get; set; } = false; public List Mockups { get; set; } = new List(); [Column("has_3d_preview")] public bool? Has3DPreview { get; set; } [Column("three_d_config", TypeName = "jsonb")] public ThreeDConfig? ThreeDConfig { get; set; } public List TextureSlots { get; set; } = new List(); [Column("uv_map_image_id")] public long? UvMapImageId { get; set; } public FileModel? UvMapImage { get; set; } [Column("three_d_model_file_id")] public long? ThreeDModelFileId { get; set; } public FileModel? ThreeDModelFile { get; set; } public CustomizableProduct() { Timestamp = DateTime.UtcNow; Archive = false; MinimumOrderQuantity = 1; BaseDeliveryDays = 7; } public void SetImage(FileModel file) { Image = file; ImageId = file.Id; } }