using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; using eprintServer.Enums; namespace eprintServer.Entities; [Table("form_elements")] public class FormElement { [Column("id")] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long Id { get; set; } [Column("step_id")] public long StepId { get; set; } [JsonIgnore] public Step Step { get; set; } public List Label { get; set; } = new List(); [Column("input_type")] public InputTypeEnum InputType { get; set; } [Column("field_name")] public string FieldName { get; set; } = string.Empty; [Column("is_required")] public bool IsRequired { get; set; } [Column("element_order")] public int ElementOrder { get; set; } [Column("default_value")] public string? DefaultValue { get; set; } [Column("validation_rules")] public string? ValidationRules { get; set; } [Column("placeholder")] public string? Placeholder { get; set; } [Column("price_config_type")] public PriceConfigTypeEnum? PriceConfigType { get; set; } [Column("color_pricing_config", TypeName = "jsonb")] // Using JSONB for PostgreSQL or string/json for others public ColorPricingConfig? ColorPricingConfig { get; set; } [Column("quantity_pricing_config", TypeName = "jsonb")] public QuantityPricingConfig? QuantityPricingConfig { get; set; } [Column("timestmp")] public DateTime Timestamp { get; set; } [JsonIgnore] public ICollection Options { get; set; } = new List(); public FormElement() { Timestamp = DateTime.UtcNow; IsRequired = false; } }