using System.ComponentModel.DataAnnotations; using TIAM.Core.Enums; using TIAM.Entities.Products; using TIAM.Entities.ServiceProviders; using TIAM.Resources; namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels { public class ProductWizardModel { public Guid Id { get; set; } [Required(ErrorMessage = "The type of service should be specified.")] [DataType("ProductType")] [Display(Name = ResourceKeys.ProductType, ResourceType = typeof(TIAMResources))] public ProductType ProductType { get; set; } //public Guid? UserMediaId { get; set; } [Required(ErrorMessage = "The name should be specified.")] [DataType(DataType.Text)] [Display(Name = ResourceKeys.ProductName, ResourceType = typeof(TIAMResources))] public string Name { get; set; } [Required(ErrorMessage = "The description should be specified.")] [DataType(DataType.MultilineText)] [Display(Name = ResourceKeys.ProductDescription, ResourceType = typeof(TIAMResources))] public string Description { get; set; } public float Price { get; set; } public string? JsonDetails { get; set; } public Company Company { get; set; } public ProductWizardModel() { } public ProductWizardModel(Company company, ProductType productType, string name, string description, float price, string? jsonDetails) : this(Guid.NewGuid(), company, productType, name, description, price, jsonDetails) { } public ProductWizardModel(Guid id, Company company, ProductType productType, string name, string description, float price, string? jsonDetails) { Id = id; Company = company; ProductType = productType; Name = name; Description = description; Price = price; JsonDetails = jsonDetails; } public Product SaveToProduct(Company company) { Product newProduct = new(this.Id, company.Id, company, this.ProductType, this.Name, this.Description, this.Price, this.JsonDetails); return newProduct; } } }