"""Declared hypothetical actions, not empirically achieved intervention doses."""
from dataclasses import replace
from forecast_v2 import bounded, predict

def act(w,m,p,*,wt_multiplier=1.,mutant_multiplier=1.,added_wt=0.,
        survival=None,susceptibility=None,coupling=None):
    bounded(wt_multiplier=wt_multiplier,mutant_multiplier=mutant_multiplier,added_wt=added_wt)
    changes={k:v for k,v in dict(survival=survival,susceptibility=susceptibility,coupling=coupling).items() if v is not None}
    q=replace(p,**changes)
    ww,mm=w*wt_multiplier+added_wt,m*mutant_multiplier
    return predict(ww,mm,assumptions=q)

def contrast(w,m,p,**action):
    baseline=predict(w,m,assumptions=p)
    after=act(w,m,p,**action)
    # Matched WT-background action: same transformation and parameter changes.
    wt_before=predict(w,0.,assumptions=p)
    wt_after=act(w,0.,p,**action)
    return dict(baseline=baseline,after=after,
                delta_current=after['current']-baseline['current'],
                delta_wt_surface=after['wt_surface']-baseline['wt_surface'],
                wt_control_delta_current=wt_after['current']-wt_before['current'])
