-- Rozsireni ekonomickeho rozpadu planu (audit transparence: cashflow vs arbitraz vs penalizace vs bonus).
-- Drive byl v planning_interval jen expected_cost_czk = gi*buy - ge*sell (bez penalizaci a bez acquisition).

alter table ems.planning_interval
  add column if not exists cashflow_czk numeric,
  add column if not exists battery_arbitrage_czk numeric,
  add column if not exists penalty_czk numeric,
  add column if not exists green_bonus_czk numeric;

comment on column ems.planning_interval.cashflow_czk is
  'Net penezni tok ze site v slotu: gi*buy_price*h - ge*sell_price*h (Kc). '
  'Kladne = platba EMS, zaporne = prijem. Shodne s expected_cost_czk (ponechano jako legacy).';

comment on column ems.planning_interval.battery_arbitrage_czk is
  'Marze z exportu baterie do site: ge_bat * (sell_price - acquisition_used) * h (Kc). '
  'Kladne = zisk arbitraze (cena prodeje > vazeny nakup zasoby).';

comment on column ems.planning_interval.penalty_czk is
  'Soucet penalizaci v slotu (Kc): shortfall (peak_export, pv_charge, neg_sell_dump) + safety_deficit '
  '+ curtailment + commitment. Neviditelne v cashflow_czk, ale solver je optimalizuje.';

comment on column ems.planning_interval.green_bonus_czk is
  'Planovany zeleny bonus z vyroby poli s active green_bonus_czk_kwh (Kc). '
  'pv_*_forecast_solver_w * green_bonus_czk_kwh * h, scitano pres vsechna pole se zelenym bonusem '
  'platnym v slotu (ems.asset_pv_array.green_bonus_*).';
