import React from 'react'
import { storiesOf } from '@storybook/react'
import products from './mock/products'

import OrderSummary from '../components/OrderSummary'

/*
  Ideal data shape for grouping by agents

  {
    agents: [
      {
        agent,
        orderPlans
      }
    ]
  }
  {
    agent,
    orderplans:

  }
*/

const agent = {
  profile: {
    name: 'Ella Banks'
  }
}

// desired order, optimistic thinking
const intents = [{
  // agent that made the order
  desiredQuantity: 1,
  minimumQuantity: 1,
  maximumQuantity: 2,
  productId: products[0].id,
  product: products[0],
  priceSpecId: 456
}]

// What has actually happened
const orderPlans = [{
  quantity: 1,
  intent: intents[0]
}]

const orderSummary = {
  agentOrderPlans: [
    {
      agent,
      orderPlans
    }
  ]
}

storiesOf('ordering.orderSummary', module)
  .add('default', () => (
    <OrderSummary orderSummary={orderSummary} />
  ))

@@ -334,19 +334,21 @@
 st agent
+s
  = 
+%5B
 %7B%0A  prof
@@ -382,16 +382,60 @@
 s'%0A  %7D%0A%7D
+,%0A%7B%0A  profile: %7B%0A    name: 'Kath Uru'%0A  %7D%0A%7D%5D
 %0A%0A// des
@@ -466,16 +466,17 @@
 hinking%0A
+%0A
 const in
@@ -487,42 +487,49 @@
 s = 
-%5B%7B%0A  // agent that made the order%0A
+products.map((product) =%3E %7B%0A  return %7B%0A  
   de
@@ -546,16 +546,18 @@
 ity: 1,%0A
+  
   minimu
@@ -570,16 +570,18 @@
 ity: 1,%0A
+  
   maximu
@@ -594,16 +594,18 @@
 ity: 2,%0A
+  
   produc
@@ -620,19 +620,17 @@
 duct
-s%5B0%5D
 .id,%0A  
+  
 prod
@@ -645,14 +645,12 @@
 duct
-s%5B0%5D
 ,%0A
+  
   pr
@@ -664,15 +664,39 @@
 Id: 
-456%0A%7D%5D%0A
+product.priceSpecs%5B0%5D.id%0A  %7D%0A%7D)
 %0A// 
@@ -741,19 +741,55 @@
 Plans = 
-%5B
+intents.map((intent) =%3E %7B%0A  return 
 %7B%0A
+  
   quanti
@@ -795,20 +795,54 @@
 ity:
+ Math.floor(Math.random() * 6) +
  1,%0A
+  
   intent
 : in
@@ -841,23 +841,15 @@
 tent
-: intents%5B0%5D%0A%7D%5D
+%0A  %7D%0A%7D)
 %0A%0Aco
@@ -888,21 +888,50 @@
 rPlans: 
-%5B%0A   
+agents.map((agent) =%3E %7B%0A    return
  %7B%0A     
@@ -963,17 +963,18 @@
     %7D%0A  
-%5D
+%7D)
 %0A%7D%0A%0Astor

update mock data