namespace CartWise.Domain.Entities;

public class GroceryConcept
{
    public Guid GroceryConceptId { get; private set; }

    public string Name { get; private set; } = null!;

    public string NormalizedName { get; private set; } = null!;

    public Guid? CategoryId { get; private set; }

    public DateTime CreatedUtc { get; private set; }

    private GroceryConcept()
    {
    }

    public GroceryConcept(string name, DateTime createdUtc, Guid? categoryId = null)
    {
        if (string.IsNullOrWhiteSpace(name))
        {
            throw new ArgumentException("Grocery concept name is required.", nameof(name));
        }

        GroceryConceptId = Guid.NewGuid();
        Name = name.Trim();
        NormalizedName = Name.ToUpperInvariant();
        CategoryId = categoryId;
        CreatedUtc = createdUtc;
    }
}
