# Recipe DAG — yoghurt flatbreads with nigella seeds
# Source: flatbread half of a "yoghurt flatbreads with soy-butter eggs" recipe (BBC Food, from a
# screenshot; instructions paraphrased, quantities as published). Nigella seeds are our addition.
#
# Schema notes:
#   - Scales from 2 to 6 breads (yield options); ids with $i are repeated once per bread.
#   - Only one large pan, and the scheduler doesn't enforce resource capacity, so the pan is
#     threaded through the graph as products: pan_0 → (flatbread 1) → pan_1 → (flatbread 2) → …
#     The dough pieces are threaded the same way (pieces_0 → pieces_1 → …).
#   - Each side of each flatbread is its own step so the flip is a real hands-on moment; the
#     next flatbread gets rolled while the previous one cooks.
#   - Durations: "15s", "5m", "1h", or {min, expected, max}.

recipe:
  id: yoghurt_flatbreads
  code: flatbreads   # short URL: /flatbreads
  category: Sides
  title: Yoghurt flatbreads with nigella seeds
  yield: { servings: 2, unit: flatbread, options: [2, 3, 4, 5, 6] }

resources:
  cook:        { kind: cook,   capacity: 1 }
  hob:         { kind: hob,    capacity: 1 }
  pan:         { kind: vessel, capacity: 1, fits: { amount: 1, unit: flatbread } }
  bowl:        { kind: vessel, capacity: 1 }
  fork:        { kind: tool,   capacity: 1 }
  rolling_pin: { kind: tool,   capacity: 1 }

products:
  salt:          { kind: ingredient, qty: { amount: 0.25, unit: tsp, scale: linear }, name: fine salt }
  nigella:       { kind: ingredient, qty: { amount: 1, unit: tsp, scale: linear }, name: nigella seeds }
  flour:         { kind: ingredient, qty: { amount: 100, unit: g, scale: linear }, name: self-raising flour }
  yoghurt:       { kind: ingredient, qty: { amount: 100, unit: g, scale: linear }, name: full-fat Greek-style yoghurt }
  veg_oil:       { kind: ingredient, qty: { amount: 0.5, unit: tbsp, scale: linear }, name: vegetable oil }
  dusting_flour: { kind: ingredient, name: "extra flour, for dusting" }

  dough:          { kind: intermediate, name: dough, state: smooth dough, vessel: bowl, hold: { max: 30m } }
  pieces_0:       { kind: intermediate, name: $n dough piece(s), hold: { max: 30m } }
  pan_0:          { kind: intermediate, name: hot pan, state: "dry, medium–high heat", vessel: pan }
  pieces_$i:      { kind: intermediate, name: remaining dough, state: waiting to be rolled, hold: { max: 30m } }
  pan_$i:         { kind: intermediate, name: "hot pan, free again", vessel: pan }
  flatbread_raw_$i:  { kind: intermediate, name: "flatbread $i, rolled", state: ⅔ dinner-plate size, hold: { max: 20m } }
  flatbread_half_$i: { kind: intermediate, name: "flatbread $i, one side done", vessel: pan }
  flatbread_$i:   { kind: intermediate, name: "flatbread $i, cooked", state: puffed and golden, hold: { max: 15m, then: cools and stiffens } }
  flatbreads:     { kind: final, state: "warm, stacked" }

steps:
  make_dough:
    title: Make the dough
    text: Stir the salt and nigella seeds into the flour in a large bowl. Add the yoghurt and oil, mix with a fork, then bring it together with your hands into a smooth dough.
    inputs: [salt, nigella, flour, yoghurt, veg_oil]
    outputs: [dough]
    phases: [{ kind: active, duration: 3m }]
    done_when: smooth and no longer sticky
    uses: [bowl, fork]
    time_scale: fixed

  divide:
    title: Divide the dough
    text: Cut the dough into $n equal piece(s).
    inputs: [dough]
    outputs: [pieces_0]
    phases: [{ kind: active, duration: 30s }]
    time_scale: fixed

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

  roll_$i:
    title: Roll flatbread $i
    text: Roll the next piece of dough out the same way.
    first:
      title: Roll the first flatbread
      text: On a floured surface, roll one piece of dough into a flatbread about two thirds the size of a large dinner plate.
    inputs: [pieces_$prev, dusting_flour]
    outputs: [flatbread_raw_$i, pieces_$i]
    phases: [{ kind: active, duration: 2m }]
    done_when: about ⅔ the size of a dinner plate
    uses: [rolling_pin]
    time_scale: fixed

  cook_$i:
    title: Cook flatbread $i
    text: Lay flatbread $i in the hot, dry pan.
    inputs: [flatbread_raw_$i, pan_$prev]
    outputs: [flatbread_half_$i]
    phases:
      - { kind: active, duration: 15s }
      - { kind: passive, duration: { min: 3m, expected: 3.5m, max: 4m }, timer: true }
    done_when: underside golden and the bread starts to puff
    uses: [hob, pan]
    time_scale: fixed

  flip_$i:
    title: Flip flatbread $i
    text: Turn it over and cook the other side, then lift it out and set aside.
    inputs: [flatbread_half_$i]
    outputs: [flatbread_$i, pan_$i]
    phases:
      - { kind: active, duration: 15s }
      - { kind: passive, duration: { min: 3m, expected: 3.5m, max: 4m }, timer: true }
    done_when: puffed and golden on both sides
    uses: [hob, pan]
    time_scale: fixed

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