se
    order.copy(status = "Checkout")
```

```scala
checkout(Order(id = 34, status = "Submitted", basket = Nil))
// java.lang.Exception: Invalid status

checkout(Order(id = 34, status = "Draft", basket = Nil))
// java.lang.Exception: Basket is empty
```
]

---
# Solution 1: Exception

<br>

```scala mdoc:reset:invisible
case class Order(id: Long, status: String, basket: List[Item])
case class Item(id: Long, quantity: Int, unitPrice: Double)
```

.eighty-two-left[
```scala mdoc
def checkout(order: Order): O