# Recipe DAG — lavash
# Source: Yotam Ottolenghi, "Lavash flatbreads with mint yoghurt and vegetables" (The Guardian,
# 27 Feb 2016, from a screenshot; instructions paraphrased, quantities as published).
# Changes: flatbreads only. The roast vegetables, the mint yoghurt and the 230°C oven (which
# was only for the vegetables) are left out. The ingredient list just says "Salt"; the method's
# teaspoon is used. The 3–4 minute fry is split into two halves around the turn, and the
# hands-on times are our estimates.
#
# Schema notes:
#   - Scales from 4 to 12 breads (yield options); ids with $i are repeated once per bread.
#   - One pan, threaded through the graph as products (pan_0 → pan_1 → …), so the breads fry
#     one at a time; the risen balls are threaded the same way (balls_0 → balls_1 → …).
#   - Each bread is fry (lay in) + turn, so the turn is a real hands-on moment. Each next ball
#     is rolled while the previous bread fries.
#   - Durations: "15s", "5m", "1h", or {min, expected, max}.

recipe:
  id: lavash
  code: lavash   # short URL: /lavash
  category: Sides
  title: Lavash
  yield: { servings: 8, unit: flatbread, options: [4, 6, 8, 10, 12] }

resources:
  cook:            { kind: cook,   capacity: 1 }
  hob:             { kind: hob,    capacity: 1 }
  pan:             { kind: vessel, capacity: 1, name: non-stick frying pan, fits: { amount: 1, unit: flatbread } }
  small_bowl:      { kind: vessel, capacity: 1 }
  whisk:           { kind: tool,   capacity: 1 }
  kitchenaid_bowl: { kind: vessel, capacity: 1, name: KitchenAid bowl }
  dough_hook:      { kind: tool,   capacity: 1 }
  tray:            { kind: vessel, capacity: 1, name: large tray }
  tea_towel:       { kind: tool,   capacity: 1, name: clean tea towels }
  rolling_pin:     { kind: tool,   capacity: 1 }

products:
  yeast:         { kind: ingredient, qty: { amount: 1, unit: tsp, scale: linear }, name: fast-action dried yeast }
  water:         { kind: ingredient, qty: { amount: 180, unit: ml, scale: linear }, name: warm water }
  sugar:         { kind: ingredient, qty: { amount: 1, unit: tsp, scale: linear }, name: caster sugar }
  yoghurt:       { kind: ingredient, qty: { amount: 120, unit: g, scale: linear }, name: plain natural yoghurt }
  plain_flour:   { kind: ingredient, qty: { amount: 250, unit: g, scale: linear }, name: plain flour }
  strong_flour:  { kind: ingredient, qty: { amount: 250, unit: g, scale: linear }, name: strong bread flour }
  salt:          { kind: ingredient, qty: { amount: 1, unit: tsp, scale: linear } }
  ghee:          { kind: ingredient, qty: { amount: 100, unit: g, scale: linear }, name: "ghee, for frying", note: about a tablespoon per bread }
  dusting_flour: { kind: ingredient, name: "extra plain flour, for dusting" }

  yeast_froth: { kind: intermediate, name: frothy yeast, vessel: small_bowl, hold: { max: 15m } }
  dough:       { kind: intermediate, name: kneaded dough, state: smooth yet firm, vessel: kitchenaid_bowl, hold: { max: 15m } }
  shaped:      { kind: intermediate, name: $n dough ball(s), state: covered with a tea towel, vessel: tray, hold: { max: 15m } }
  balls_0:     { kind: intermediate, name: $n risen dough ball(s), vessel: tray, hold: { max: 30m, then: over-proofs } }
  pan_0:       { kind: intermediate, name: "hot pan, medium-high heat", vessel: pan }
  balls_$i:    { kind: intermediate, name: remaining dough balls, vessel: tray, hold: { max: 30m } }
  pan_$i:      { kind: intermediate, name: "hot pan, free again", vessel: pan }
  fb_raw_$i:   { kind: intermediate, name: "lavash $i, rolled", state: "18–20cm across, 1–2mm thick", hold: { max: 10m } }
  fb_half_$i:  { kind: intermediate, name: "lavash $i, one side done", vessel: pan }
  fb_$i:       { kind: intermediate, name: "lavash $i, fried", state: covered with a tea towel, hold: { max: 30m } }
  lavash:      { kind: final, state: "warm, under a tea towel" }

steps:
  activate_yeast:
    title: Start the yeast
    text: Whisk the yeast, warm water and sugar together in a small bowl, then set aside.
    inputs: [yeast, water, sugar]
    outputs: [yeast_froth]
    phases:
      - { kind: active, duration: 30s }
      - { kind: passive, duration: 15m, timer: true }
    done_when: it starts to froth
    uses: [small_bowl, whisk]
    time_scale: fixed

  mix_knead:
    title: Mix and knead
    text: Tip the yeast into the mixer bowl with the dough hook. Add the yoghurt, both flours and the salt, and knead slowly for 2 minutes to combine; the dough will be quite dry. Turn up to medium-high and knead for 5 minutes.
    inputs: [yeast_froth, yoghurt, plain_flour, strong_flour, salt]
    outputs: [dough]
    phases: [{ kind: active, duration: 8m }]
    done_when: smooth yet firm
    uses: [kitchenaid_bowl, dough_hook]
    time_scale: fixed

  shape_balls:
    title: Shape into balls
    text: Roll the dough into a sausage and cut it into $n piece(s). Roll each piece into a ball, put them on a large tray and cover with a clean tea towel.
    inputs: [dough]
    outputs: [shaped]
    phases: [{ kind: active, duration: 4m }]
    uses: [tray, tea_towel]
    time_scale: linear

  rise:
    title: Leave to rise
    text: Leave the balls covered until they double in size.
    inputs: [shaped]
    outputs: [balls_0]
    phases: [{ kind: passive, duration: 90m }]
    done_when: doubled in size
    uses: [tray, tea_towel]
    time_scale: fixed

  heat_pan:
    title: Heat the pan
    text: Put a non-stick frying pan over a medium-high heat.
    outputs: [pan_0]
    phases:
      - { kind: active, duration: 15s }
      - { kind: passive, duration: 2m }
    uses: [hob, pan]
    time_scale: fixed

  roll_$i:
    title: Roll lavash $i
    text: Roll out the next ball the same way.
    first:
      title: Roll the first lavash
      text: On a lightly floured surface, roll one ball into a circle 18–20cm wide and about 1–2mm thick. Roll the rest one at a time, each while the one before fries.
    inputs: [balls_$prev, dusting_flour]
    outputs: [fb_raw_$i, balls_$i]
    phases: [{ kind: active, duration: 1.5m }]
    done_when: 18–20cm across and 1–2mm thick
    uses: [rolling_pin]
    time_scale: fixed

  cook_$i:
    title: Fry lavash $i
    text: Melt a tablespoon of ghee in the pan and lay in lavash $i.
    inputs: [fb_raw_$i, pan_$prev, ghee]
    outputs: [fb_half_$i]
    phases:
      - { kind: active, duration: 20s }
      - { kind: passive, duration: { min: 1.5m, expected: 1.75m, max: 2m }, timer: true }
    done_when: golden-brown underneath
    uses: [hob, pan]
    time_scale: fixed

  flip_$i:
    title: Turn lavash $i
    text: Turn it over and fry the other side, then lift it out and cover with the others.
    first:
      text: Turn it over and fry the other side, then lift it out, set aside and cover with a clean tea towel.
    inputs: [fb_half_$i]
    outputs: [fb_$i, pan_$i]
    phases:
      - { kind: active, duration: 15s }
      - { kind: passive, duration: { min: 1.5m, expected: 1.75m, max: 2m }, timer: true }
    done_when: golden-brown on both sides
    uses: [hob, pan, tea_towel]
    time_scale: fixed

  serve:
    title: Serve
    text: Serve the lavash warm.
    inputs: [fb_$all]
    outputs: [lavash]
    phases: [{ kind: active, duration: 30s }]
    time_scale: fixed
