Skip to content

Instantly share code, notes, and snippets.

@amitaibu amitaibu/Model.elm
Created Dec 23, 2017

Embed
What would you like to do?
Excerpt of Item's status
{-| These are the the states of an open item. You will notice there is a state
called `GoneTranstion` which exists under the Open. This state is a special case
that really exists only as a transition state. That is, when we want to finish
the sale of an item we cannot decide ourself it it's "sold" or "unsold" - that
is the responsibility of the server. So we will send the server a `gone` request,
which will be later decided if the item is sold or not.
So a `GoneTransition` is a very temporarye state, for until we are clear on the `SoldStatus`.
This also works the other way around. That is, when we are in `ItemClosed` state, the clerk
may still go back to `Going` or `Open` in case there was some mistake or a bid was
placed in the room in the right time.
-}
type OpenStatus
= Open
| Going
| GoneTransition
type SoldStatus
= Sold
| Unsold
type EditableItemStatus
= LiveOnly (EditableWebData OpenStatus)
-- Live sale has not started, or is paused.
| MailOnly (EditableWebData OpenStatus)
type ReadOnlyItemStatus
= ItemClosed SoldStatus
| SaleNotStarted
| SaleClosed
| Withdrawn
| ItemNotActiveButAlreadyHasLiveBids
{-| The item status can be either open for bidding or not. We keep the exact
reason to why it could be closed.
-}
type Status
= EditableStatus EditableItemStatus
| ReadOnlyStatus ReadOnlyItemStatus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.