using LiteCharms.Features.TechShop.CartPackages.Models; using LiteCharms.Features.TechShop.Customers.Models; using LiteCharms.Features.TechShop.Leads.Models; using LiteCharms.Features.TechShop.Notifications.Models; using LiteCharms.Features.TechShop.Orders.Models; using LiteCharms.Features.TechShop.Products.Entities; using LiteCharms.Features.TechShop.Products.Models; using LiteCharms.Features.TechShop.Quotes.Models; using LiteCharms.Features.TechShop.ShoppingCarts.Models; namespace LiteCharms.Features.TechShop.Extensions; public static class Mappers { public static ShoppingCartPackage ToModel(this ShoppingCarts.Entities.ShoppingCartPackage entity) => new() { Id = entity.Id, CreatedAt = entity.CreatedAt, PackageId = entity.PackageId, ShoppingCartId = entity.ShoppingCartId }; public static PackageItem ToModel(this CartPackages.Entities.PackageItem entity) => new() { Id = entity.Id, Active = entity.Active, CreatedAt = entity.CreatedAt, PackageId = entity.PackageId, ProductPriceId = entity.ProductPriceId }; public static Package ToModel(this CartPackages.Entities.Package entity) => new() { Id = entity.Id, CreatedAt = entity.CreatedAt, Active = entity.Active, Description = entity.Description, Name = entity.Name, UpdatedAt = entity.UpdatedAt, ImageUrl = entity.ImageUrl, Summary = entity.Summary }; public static ShoppingCartItem ToModel(this ShoppingCarts.Entities.ShoppingCartItem entity) => new() { Id = entity.Id, CreatedAt = entity.CreatedAt, UpdatedAt = entity.UpdatedAt, ProductPriceId = entity.ProductPriceId, Quantity = entity.Quantity, ShoppingCartId = entity.ShoppingCartId }; public static ShoppingCart ToModel(this ShoppingCarts.Entities.ShoppingCart entity) => new() { Id = entity.Id, CreatedAt = entity.CreatedAt, UpdatedAt = entity.UpdatedAt, CustomerId = entity.CustomerId, OrderId = entity.OrderId }; public static Quote ToModel(this Quotes.Entities.Quote entity) => new() { Id = entity.Id, CreatedAt = entity.CreatedAt, UpdatedAt = entity.UpdatedAt, CustomerId = entity.CustomerId, ExpiredAt = entity.ExpiredAt, Reason = entity.Reason, ShoppingCartId = entity.ShoppingCartId, Status = entity.Status, InvoiceUrl = entity.InvoiceUrl, OrderId = entity.OrderId }; public static Notification ToModel(this Notifications.Entities.Notification entity) => new() { Id = entity.Id, CreatedAt = entity.CreatedAt, Message = entity.Message, Direction = entity.Direction, CorrelationId = entity.CorrelationId, CorrelationIdType = entity.CorrelationIdType, IsInternal = entity.IsInternal, SenderAddress = entity.SenderAddress, Platform = entity.Platform, RecipientName = entity.RecipientName, Subject = entity.Subject, Processed = entity.Processed, SenderName = entity.SenderName, RecipientAddress = entity.RecipientAddress, Priority = entity.Priority, UpdatedAt = entity?.UpdatedAt, IsHtml = entity!.IsHtml, HasError = entity.HasError, Errors = entity.Errors }; public static Customer ToModel(this Customers.Entities.Customer entity) => new() { Id = entity.Id, CreatedAt = entity.CreatedAt, UpdatedAt = entity.UpdatedAt, Active = entity.Active, Address = entity.Address, City = entity.City, Company = entity.Company, Country = entity.Country, Discord = entity.Discord, Email = entity.Email, LastName = entity.LastName, LinkedIn = entity.LinkedIn, Name = entity.Name, Phone = entity.Phone, PostalCode = entity.PostalCode, Region = entity.Region, Slack = entity.Slack, Tax = entity.Tax, Website = entity.Website, Whatsapp = entity.Whatsapp }; public static Lead ToModel(this Leads.Entities.Lead entity) => new() { Id = entity.Id, CreatedAt = entity.CreatedAt, UpdatedAt = entity.UpdatedAt, AdGroupId = entity.AdGroupId, AdName = entity.AdName, AppClickId = entity.AppClickId, AttributionHash = entity.AttributionHash, CampaignId = entity.CampaignId, ClickLocation = entity.ClickLocation, CustomerId = entity.CustomerId, FeedItemId = entity.FeedItemId, Source = entity.Source, ClickId = entity.ClickId, TargetId = entity.TargetId, WebClickId = entity.WebClickId, Status = entity.Status }; public static Order ToModel(this Orders.Entities.Order entity) => new() { Id = entity.Id, CreatedAt = entity.CreatedAt, UpdatedAt = entity.UpdatedAt, CustomerId = entity.CustomerId, Notes = entity.Notes, Status = entity.Status, Requirements = entity.Requirements, Terms = entity.Terms, InvoiceUrl = entity.InvoiceUrl }; public static OrderRefund ToModel(this Orders.Entities.OrderRefund entity) => new() { Id = entity.Id, CreatedAt = entity.CreatedAt, OrderId = entity.OrderId, Reason = entity.Reason, Amount = entity.Amount }; public static Products.Models.Product ToModel(this Products.Entities.Product entity) => new() { Id = entity.Id, CreatedAt = entity.CreatedAt, Name = entity.Name, Description = entity.Description, Active = entity.Active, Summary = entity.Summary, ImageUrl = entity.ImageUrl, Thumbnails = entity.Thumbnails, Metadata = entity.Metadata, }; public static Products.Models.ProductPrice ToModel(this Products.Entities.ProductPrice entity) => new() { Id = entity.Id, ProductId = entity.ProductId, Price = entity.Price, Active = entity.Active, CreatedAt = entity.CreatedAt, Discount = entity.Discount, UpdatedAt = entity.UpdatedAt }; }