Files
components/LiteCharms.Features/Shop/Orders/Commands/CreateOrderCommand.cs
T
2026-05-13 20:06:24 +02:00

41 lines
1.4 KiB
C#

namespace LiteCharms.Features.Orders.Commands;
public class CreateOrderCommand : IRequest<Result<Guid>>
{
public Guid CustomerId { get; set; }
public Guid ShoppingCartId { get; set; }
public Guid? QuoteId { get; set; }
public string[]? Requirements { get; set; }
public string[]? Notes { get; set; }
public string[]? Terms { get; set; }
public bool DepositRequired { get; set; }
private CreateOrderCommand(Guid customerId, Guid shoppingCartId, bool depositRequired, Guid? quoteId = null, string[]? requirements = null, string[]? notes = null, string[]? terms = null)
{
CustomerId = customerId;
ShoppingCartId = shoppingCartId;
DepositRequired = depositRequired;
QuoteId = quoteId;
Requirements = requirements;
Notes = notes;
Terms = terms;
}
public static CreateOrderCommand Create(Guid customerId, Guid shoppingCartId, bool depositRequired, Guid? quoteId = null, string[]? requirements = null, string[]? notes = null, string[]? terms = null)
{
if (customerId == Guid.Empty)
throw new ArgumentException("CustomerId is required.", nameof(customerId));
if (shoppingCartId == Guid.Empty)
throw new ArgumentException("ShoppingCartId is required.", nameof(shoppingCartId));
return new(customerId, shoppingCartId, depositRequired, quoteId, requirements, notes, terms);
}
}