internal static PurchaseTransaction Create(PurchaseTransactionId id)
        {
            var purchaseTransaction = new PurchaseTransaction();

            purchaseTransaction.Apply(new Events.PurchaseTransactionCreated
            {
                Id = id
            });

            return(purchaseTransaction);
        }
        public static PurchaseTransaction CreateFull(PurchaseTransactionId id,
                                                     Store store,
                                                     ICollection <LineItemStripped> lineItems,
                                                     PurchaseDate transactionDate)
        {
            ValidateParameters();

            var purchaseTransaction = new PurchaseTransaction();

            purchaseTransaction.Apply(new Events.PurchaseTransactionFullCreated
            {
                Id              = id,
                Store           = store,
                LineItems       = lineItems,
                TransactionDate = (DateTime)transactionDate
            });

            return(purchaseTransaction);

            void ValidateParameters()
            {
                if (id is null)
                {
                    throw new ArgumentNullException(nameof(id), "Purchase transaction without valid identifier cannot be created.");
                }
                if (store is null)
                {
                    throw new ArgumentNullException(nameof(id), "Purchase transaction without valid store cannot be created.");
                }
                if (lineItems is null)
                {
                    throw new ArgumentNullException(nameof(id), "Purchase transaction without at least one line item cannot be created.");
                }
                if (transactionDate is null)
                {
                    throw new ArgumentNullException(nameof(id), "Purchase transaction without purchase date cannot be created.");
                }
            }
        }