using CartWise.Domain.Enums; namespace CartWise.Domain.Entities; public class ProductIdentifier { public Guid ProductIdentifierId { get; private set; } public Guid ProductId { get; private set; } public ProductIdentifierType IdentifierType { get; private set; } public string Value { get; private set; } = null!; public string NormalizedValue { get; private set; } = null!; private ProductIdentifier() { } internal ProductIdentifier(Guid productId, ProductIdentifierType identifierType, string value) { if (productId == Guid.Empty) { throw new ArgumentException("ProductId is required.", nameof(productId)); } if (string.IsNullOrWhiteSpace(value)) { throw new ArgumentException("Identifier value is required.", nameof(value)); } ProductIdentifierId = Guid.NewGuid(); ProductId = productId; IdentifierType = identifierType; Value = value.Trim(); NormalizedValue = Normalize(value); } public static string Normalize(string value) => value.Trim().ToUpperInvariant(); }