"""Illustrative mode table and initial handover only; no distributed fencing."""
import json
MODES={'normal':{'intake':True,'automatic_start':True,'manual_record':False},'degraded':{'intake':True,'automatic_start':False,'manual_record':True},'suspended':{'intake':False,'automatic_start':False,'manual_record':True}}
records={'J10':{'intake':'accepted','external':'confirmed','confirmation':'C10'},'J11':{'intake':'accepted','external':'issued_unconfirmed','confirmation':None}}
def accept(job,mode):
 if not MODES[mode]['intake']:return 'intake_closed'
 records[job]={'intake':'accepted','external':'not_started','confirmation':None};return 'accepted_not_confirmed'
def start(job,mode):
 if not MODES[mode]['automatic_start']:return 'start_blocked'
 records[job]['external']='issued_unconfirmed';return 'issued'
assert start('J11','degraded')=='start_blocked'
assert records['J11']['external']=='issued_unconfirmed'
assert accept('J12','degraded')=='accepted_not_confirmed'
assert start('J12','degraded')=='start_blocked'
manual={'intakeId':'J12','operation':'booking:J12','requestedService':'one agreed service slot','actorRole':'duty operator','action':'manual confirmation recorded','externalConfirmation':'C12','recordedStatus':'confirmed'}
records['J12']['external']='manually_confirmed';records['J12']['confirmation']='C12'
assert accept('J13','suspended')=='intake_closed' and 'J13' not in records
report={'modes':MODES,'initialHandover':records,'manualRecord':manual,'suspendedJ13':'intake_closed','scope':'Synchronous mode checks; no concurrent worker takeover, external API or restart implemented'}
if __name__=='__main__':print(json.dumps(report,indent=2))
