# Recipe DAG — baguettes
# Source: Henry's own "Baguette weights" calculator (baguette.html). That file gives weights,
# equipment and a proof-time formula but no method; the steps below are a standard
# long-fermentation baguette method written around its equipment list.
#
# Inputs replicated from the calculator: flour per baguette, number of baguettes (1–6), and
# ambient and water temperature (defaults follow the calculator's week-by-week curves for the
# flat: ambient peaks in early August with a 19°C heating floor; the tap runs 51% of the way
# from London mains to room temperature). Added: the proofer temperature (27°C). The proofer
# heats but can't cool, so the dough ferments at whichever is warmer, the room or the proofer.
#   - Flour blend: 85% Lidl Strong White Bread Flour, 15% Lidl Plain White Flour.
#   - Per gram of flour (from the original 950 g recipe): water 730/950 (76.8% hydration),
#     salt 16/950, yeast 2/950. Diastatic malt flour is 0.2% of the flour weight.
#   - Proof time: dough temperature ≈ (water + 2 × max(room, proofer)) / 3; bulk takes 9 h at 21°C, halving
#     for every 10°C warmer, held between 4 h and 24 h. It runs from mixing, so the last bulk
#     step is that time less the 90 minutes of folds before it.
#   - The mould holds 3; for 4–6 use a second mould and bake both together.
#
# Invented (not in the calculator): the fold schedule, pre-shape/bench rest, final proof time,
# oven temperature, steam timing, bake time and the 96°C probe target.
#
# Schema notes:
#   - Each set of folds is its own step, since the fold is a hands-on moment mid-ferment.
#   - The proofer has no lane of its own; bulk and final proof land on "Tray/rack".

recipe:
  id: baguettes
  code: baguettes   # short URL: /baguettes
  category: Bread
  title: Baguettes
  yield: { servings: 3, unit: baguette, options: [1, 2, 3, 4, 5, 6] }
  ingredients_note: "Assumes Lidl Strong White Bread Flour and Lidl Plain White Flour. 85:15 strong to plain ratio. 76.8% hydration."

inputs:
  flour_each:   { label: Flour per baguette, unit: g, default: 150, min: 50, max: 999, step: 10 }
  n:            { label: Number of baguettes }
  proofer_temp: { label: Proofer temperature, short: proofer, unit: °C, default: 27, min: 0, max: 45, step: 0.5, decimals: 1 }
  room_temp:    { label: Ambient temperature, short: room, unit: °C, default: 20, min: 0, max: 45, step: 0.2, decimals: 1,
                  by_week: [19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19.2, 20, 20.8, 21.6, 22.6, 23.4, 24.2, 25, 25.8, 26.4, 27.2, 27.8, 28.2, 28.6, 29, 29.2, 29.4, 29.4, 29.2, 29, 28.8, 28.4, 28, 27.4, 26.8, 26, 25.4, 24.6, 23.8, 23, 22, 21.2, 20.4, 19.6, 19, 19, 19, 19, 19] }
  water_temp:   { label: Water temperature, short: water, unit: °C, default: 20, min: 0, max: 60, step: 0.2, decimals: 1,
                  by_week: [14.8, 14.8, 14.6, 14.6, 14.6, 14.6, 14.6, 14.6, 14.8, 14.8, 15, 15.2, 15.4, 15.8, 16.4, 17.2, 17.8, 18.6, 19.4, 20.2, 21, 21.8, 22.6, 23.2, 24, 24.4, 25, 25.4, 25.6, 25.8, 25.8, 25.8, 25.6, 25.4, 25, 24.6, 24, 23.4, 22.6, 22, 21.2, 20.4, 19.6, 18.8, 18, 17.2, 16.4, 16, 15.6, 15.4, 15.2, 15] }

derived:
  flour: "=flour_each * n"
  dough_temp: "=(water_temp + 2 * max(room_temp, proofer_temp)) / 3"
  bulk_raw: "=540 / pow(2, (dough_temp - 21) / 10)"   # minutes
  bulk: "=clamp(bulk_raw, 240, 1440)"
  fold_rest: "=bulk - 90"

summary:
  - { label: Time to proof, value: bulk, raw: bulk_raw }
  - { label: Proofed by, at_end_of: fold_3 }

resources:
  cook:                 { kind: cook,   capacity: 1 }
  oven:                 { kind: oven,   capacity: 1, state: { key: temperature, setup: 30m } }
  gram_scale:           { kind: tool,   capacity: 1 }
  milligram_scale:      { kind: tool,   capacity: 1 }
  ambient_thermometer:  { kind: tool,   capacity: 1 }
  probe_thermometer:    { kind: tool,   capacity: 1 }
  infrared_thermometer: { kind: tool,   capacity: 1 }
  kitchenaid_bowl:      { kind: vessel, capacity: 1, name: KitchenAid bowl }
  bowl_cover:           { kind: tool,   capacity: 1, name: KitchenAid bowl cover }
  plastic_scraper:      { kind: tool,   capacity: 1 }
  metal_scraper:        { kind: tool,   capacity: 1 }
  proofer:              { kind: tool,   capacity: 1 }
  timer:                { kind: tool,   capacity: 1 }
  parchment_paper:      { kind: tool,   capacity: 1 }
  baguette_mould:       { kind: vessel, capacity: 1, fits: { amount: 3, unit: baguette } }
  oven_gloves:          { kind: tool,   capacity: 1 }
  water_tray:           { kind: vessel, capacity: 1, name: tray for boiling water }

products:
  strong_flour:  { kind: ingredient, qty: { amount: "=flour * 0.85", unit: g }, name: strong white bread flour }
  plain_flour:   { kind: ingredient, qty: { amount: "=flour * 0.15", unit: g }, name: plain white flour }
  malt:          { kind: ingredient, qty: { amount: "=flour * 0.002", unit: g }, name: diastatic malt flour, decimals: 2, note: 0.2% of flour weight }
  yeast:         { kind: ingredient, qty: { amount: "=flour * 2 / 950", unit: g }, name: yeast, decimals: 2 }
  salt:          { kind: ingredient, qty: { amount: "=flour * 16 / 950", unit: g }, decimals: 2 }
  water:         { kind: ingredient, qty: { amount: "=flour * 730 / 950", unit: g } }
  dusting_flour: { kind: ingredient, name: "a little flour, for the bench" }
  boiling_water: { kind: ingredient, name: "a kettle of boiling water, for steam" }

  dough_mixed:   { kind: intermediate, name: mixed dough, state: "shaggy, covered", vessel: kitchenaid_bowl, hold: { max: 1h } }
  dough_fold1:   { kind: intermediate, name: "dough, folded once", vessel: kitchenaid_bowl, hold: { max: 1h } }
  dough_fold2:   { kind: intermediate, name: "dough, folded twice", vessel: kitchenaid_bowl, hold: { max: 1h } }
  dough_bulked:  { kind: intermediate, name: bulk-fermented dough, state: "risen, domed, bubbly", vessel: kitchenaid_bowl, hold: { max: 1h, then: over-proofs and slackens } }
  preshaped:     { kind: intermediate, name: pre-shaped logs, state: "relaxed, under cover", hold: { max: 30m } }
  shaped:        { kind: intermediate, name: shaped baguettes, state: in the mould on parchment, vessel: baguette_mould, hold: { max: 20m } }
  proofed:       { kind: intermediate, name: proofed baguettes, vessel: baguette_mould, hold: { max: 20m, then: over-proofs and spreads } }
  oven_ready:    { kind: intermediate, name: hot oven, state: "240°C / 220°C fan / gas 9, steam tray on the bottom shelf" }
  baked_steam:   { kind: intermediate, name: "baguettes, steamed and set", vessel: baguette_mould }
  baked:         { kind: intermediate, name: baked baguettes, state: "deep golden, 96°C inside" }
  baguettes:     { kind: final, state: cooled on a rack }

steps:
  preheat:
    title: Preheat the oven
    text: Put the empty tray for boiling water on the bottom shelf and set the oven to 240°C (220°C fan) / gas mark 9. Give it a good 30 minutes so the walls are properly hot; check with the infrared thermometer.
    outputs: [oven_ready]
    phases:
      - { kind: active, duration: 30s }
      - { kind: passive, duration: 30m }
    uses: [{ resource: oven, requires: { temperature: 240 } }, water_tray, infrared_thermometer]
    time_scale: fixed

  mix:
    title: Weigh and mix
    text: >-
      Measure the room and water temperatures and enter them under Inputs. At about
      $dough_temp.1°C the dough needs $bulk.hm of bulk from now. Weigh the flours, water and salt
      on the gram scale, and the yeast and malt on the milligram scale. Mix everything in the
      KitchenAid bowl with the plastic scraper until no dry flour is left, then cover and put it in the proofer.
    inputs: [strong_flour, plain_flour, malt, yeast, salt, water]
    outputs: [dough_mixed]
    phases:
      - { kind: active, duration: 6m }
      - { kind: passive, duration: 30m, timer: true }
    done_when: no dry flour left
    uses: [gram_scale, milligram_scale, ambient_thermometer, probe_thermometer, kitchenaid_bowl, bowl_cover, plastic_scraper, proofer, timer]
    time_scale: fixed

  fold_1:
    title: First set of folds
    text: With a wet hand, lift one side of the dough and fold it over the middle. Turn the bowl and repeat all the way round, then cover and put it back in the proofer.
    inputs: [dough_mixed]
    outputs: [dough_fold1]
    phases:
      - { kind: active, duration: 1m }
      - { kind: passive, duration: 30m, timer: true }
    done_when: the dough tightens into a ball
    uses: [bowl_cover, timer]
    time_scale: fixed

  fold_2:
    title: Second set of folds
    text: Fold the dough the same way, then cover and put it back in the proofer.
    inputs: [dough_fold1]
    outputs: [dough_fold2]
    phases:
      - { kind: active, duration: 1m }
      - { kind: passive, duration: 30m, timer: true }
    done_when: smoother and holding its shape
    uses: [bowl_cover, timer]
    time_scale: fixed

  fold_3:
    title: Last folds, then bulk
    text: Give the dough a last set of folds, cover, and leave it in the proofer for the rest of the bulk ferment. That is $bulk.hm in all from mixing, so about $fold_rest.hm from now.
    inputs: [dough_fold2]
    outputs: [dough_bulked]
    phases:
      - { kind: active, duration: 1m }
      - { kind: passive, duration: "=fold_rest", timer: true }
    done_when: "risen by about half, domed, with bubbles at the sides"
    uses: [bowl_cover, proofer, timer]
    time_scale: fixed

  preshape:
    title: Divide and pre-shape
    text: Tip the dough onto a lightly floured bench. Divide it into $n equal piece(s) by weight with the metal scraper. Fold each into a loose log, seam down, and cover.
    inputs: [dough_bulked, dusting_flour]
    outputs: [preshaped]
    phases:
      - { kind: active, duration: 5m }
      - { kind: passive, duration: 20m, timer: true }
    done_when: the logs have relaxed and spread a little
    uses: [gram_scale, metal_scraper, timer]
    time_scale: linear

  shape:
    title: Shape the baguettes
    text: Shape each log into a baguette as long as the mould, sealing the seam well. Lay them seam down on parchment in the baguette mould, 3 to a mould (use a second mould for more).
    inputs: [preshaped]
    outputs: [shaped]
    phases: [{ kind: active, duration: 6m }]
    done_when: tight, even and as long as the mould
    uses: [baguette_mould, parchment_paper, metal_scraper]
    time_scale: linear

  proof:
    title: Final proof
    text: Cover and leave in the proofer.
    inputs: [shaped]
    outputs: [proofed]
    phases:
      - { kind: active, duration: 30s }
      - { kind: passive, duration: { min: 30m, expected: 45m, max: 1h }, timer: true }
    done_when: a floured fingertip leaves a dent that springs back slowly
    uses: [proofer, timer]
    time_scale: fixed

  bake_steam:
    title: Score and bake with steam
    text: Score each baguette with 3–4 long, shallow cuts. Slide the mould (or moulds) into the oven, pour boiling water into the hot tray and shut the door quickly.
    inputs: [proofed, oven_ready, boiling_water]
    outputs: [baked_steam]
    phases:
      - { kind: active, duration: 2m }
      - { kind: passive, duration: 12m, timer: true }
    done_when: risen, with the cuts opened up
    uses: [{ resource: oven, requires: { temperature: 240 } }, water_tray, oven_gloves, timer]
    time_scale: fixed

  bake_dry:
    title: Remove the steam and finish
    text: Take the water tray out with oven gloves and bake the baguettes in the dry oven until well coloured. Check one with the probe.
    inputs: [baked_steam]
    outputs: [baked]
    phases:
      - { kind: active, duration: 30s }
      - { kind: passive, duration: { min: 10m, expected: 12m, max: 15m }, timer: true }
    done_when: "deep golden brown, hollow when tapped, 96°C inside"
    uses: [{ resource: oven, requires: { temperature: 240 } }, oven_gloves, probe_thermometer, timer]
    time_scale: fixed

  cool:
    title: Cool
    text: Lift the baguettes out of the mould and leave them to cool before cutting.
    inputs: [baked]
    outputs: [baguettes]
    phases:
      - { kind: active, duration: 30s }
      - { kind: passive, duration: { min: 20m, expected: 30m, max: 45m } }
    done_when: just warm, and the crust crackles
    uses: [oven_gloves]
    time_scale: fixed
