# Workflow Design Doc

## Overview

The workflow for constructing decks is as follows:

1. Create deck of cards. Currently we select from all cards.  Maybe we
   should just select cards from inventory.  The majority of this
   functionality in place and isn't expected to change. A deck will
   always just be a list of cards plus metadata.

2. The deck of cards has metadata about author, name of deck, time of
   creation. The main content of the deck is three lists, comprising
   the main, extra, and side decks.  This information is not expected
   to change in the future. Decks created by a particular user for
   example.  The underlying metadata representation is what's being
   worked on. Currently each item in the database has all information
   duplicated from the rest of the database. Changing the price for
   one card changes the price for only that one card matching that row
   in the database. There will be additional tables to store pricing
   information in the next step.

3. On the Deck Overview page, selecting "Pull Deck" will decrease the
   inventory of the lowest priced card in inventory by one for every
   card in the deck. This is like "add to cart" in an online shopping
   platform, with additional inventory keeping.  This is analagous to
   the deck construction step, except instead of selecting cards to be
   put into a deck, that information is provided a priori, and we use
   that list of information to construct secondary lists.

4. On the pulled deck page, for every card in the deck, you will be
   able to select cards by edition, condition, and rarity of every
   card in the inventory matching that card's passcode.  I can
   conceive a very simple concept where you attempt to check out, and
   then are returned with error messages saying which items had
   errors. This is the current approach.

5. There will be an intermediate stage. Once there is enough inventory
   and the deck is "pulled" it will enter an area where each
   individual card will be selected. e.g. selecting the rarity or set
   of a particular card in each deck.

6. Once all "errors" are resolved (banlists, constraings, etc), the
   "pulled" deck will allow you to "construct" it, which will finalize
   the state of this pulled deck in the database, moving it to another
   table, the list of decks for sale.

7. The list of decks for sale is just pulled, constructed decks with
   pricing information attached and whether or not it was sold and
   what price it was sold at and when.
