TakeawayOrder

data class TakeawayOrder(val id: OrderId, val restaurantId: RestaurantId, val customerId: CustomerId, val status: OrderStatus, val items: List<OrderItem>, val takeawayInfo: TakeawayInfo) : Order

Represents a takeaway order in the system.

Constructors

Link copied to clipboard
constructor(id: OrderId, restaurantId: RestaurantId, customerId: CustomerId, status: OrderStatus, items: List<OrderItem>, takeawayInfo: TakeawayInfo)

Types

Link copied to clipboard
sealed interface UpdateResult

Represents the result of an update operation on the takeaway order.

Properties

Link copied to clipboard
open override val customerId: CustomerId

The unique identifier of the customer who placed the order.

Link copied to clipboard
open override val id: OrderId

The unique identifier of the order.

Link copied to clipboard
open override val items: List<OrderItem>

The list of items included in the order.

Link copied to clipboard
open override val restaurantId: RestaurantId

The unique identifier of the restaurant associated with the order.

Link copied to clipboard
open override val status: OrderStatus

The current status of the order.

Link copied to clipboard

The takeaway information associated with the order.

Functions

Link copied to clipboard

Cancels the order if it is in a cancellable state.

Link copied to clipboard

Advances the status of the order to the next logical state.

Link copied to clipboard

Converts an Order domain model to an OrderDocument for persistence.

Link copied to clipboard
Link copied to clipboard
fun updateInfo(pickupTime: Long, customerName: String): TakeawayOrder.UpdateResult

Updates the takeaway information of the order.

Link copied to clipboard

Updates the items in the order after validating them.