"""Synthetic v85 arithmetic only: no network, real data or business actions."""
import argparse,json
from decimal import Decimal
D=Decimal
def percent(n,d):
 return None if d==0 else D(str(n))/D(str(d))*100
def overlap_groups(total,a,b,both):
 if min(total,a,b,both)<0 or max(a,b)>total or not max(0,a+b-total)<=both<=min(a,b):raise ValueError('Inconsistent overlap')
 return dict(both=both,firstOnly=a-both,secondOnly=b-both,neither=total-a-b+both)
def fixture_results():
 r={}
 r['administration-devices--nlp']=dict(proposalPercent=percent(16,20),agreementAmongProposalsPercent=percent(12,16),correctCoveragePercent=percent(12,20))
 r['administration-devices--hci']=dict(submissionPercent=percent(9,12),taskCorrectCoveragePercent=percent(7,12),submittedCorrectPercent=percent(7,9))
 r['administration-devices--devops']=dict(**overlap_groups(12,10,9,8),jointPercent=percent(8,12),technicalPercent=percent(10,12),administrativePercent=percent(9,12))
 # Fixed offsets stipulated for this fixture, not a general named-zone conversion.
 r['local-global--operating-systems']=dict(displayPlus0530=f'{(9*60+330)//60:02d}:{(9*60+330)%60:02d}',displayPlus0200=f'{(9*60+120)//60:02d}:{(9*60+120)%60:02d}',differenceMinutes=330-120,knownContextPercent=percent(9,12),unresolvedPercent=percent(3,12))
 r['local-global--databases']=dict(totalAt80=1000+10*80,totalAt90=1000+10*90,completePercent=percent(8,10))
 # Declared classroom conventions only, not a universal locale parser.
 r['local-global--programming']=dict(decimalMeaning=D('1.234'),groupedMeaning=D('1234'),interpretationRatio=D('1234')/D('1.234'),resolvedPercent=percent(10,14),unresolvedPercent=percent(4,14))
 r['local-global--networks']=dict(receiptPercent=percent(24,30),outcomePercent=percent(18,30),acceptedPercent=percent(15,30),outcomeAcceptancePercent=percent(15,18),receivedWithoutOutcome=24-18)
 r['local-global--cloud']=dict(**overlap_groups(10,8,7,6),connectivityPercent=percent(8,10),permissionPercent=percent(7,10),jointPercent=percent(6,10))
 r['local-global--cybersecurity']=dict(approvalPercent=percent(14,18),implementedOverallPercent=percent(11,18),implementedApprovedPercent=percent(11,14),unconfirmedApprovals=14-11)
 r['local-global--software-engineering']=dict(overallPercent=percent(9+7,10+10),aPercent=percent(9,10),bPercent=percent(7,10),pointGap=percent(9,10)-percent(7,10))
 r['local-global--data-engineering']=dict(overallPercent=percent(100+60,200),aPercent=percent(100,100),bPercent=percent(60,100),missingB=100-60,revisedOverallPercent=percent(100+60+20,200),revisedBPercent=percent(60+20,100))
 r['local-global--visualisation']=dict(aEasyPercent=percent(81,90),aDifficultPercent=percent(2,10),bEasyPercent=percent(19,20),bDifficultPercent=percent(24,80),aOverallPercent=percent(81+2,100),bOverallPercent=percent(19+24,100),aEqualWeightPercent=(percent(81,90)+percent(2,10))/2,bEqualWeightPercent=(percent(19,20)+percent(24,80))/2)
 r['local-global--nlp']=dict(overallPercent=percent(18+6,30),aPercent=percent(18,20),bPercent=percent(6,10),pointGap=percent(18,20)-percent(6,10),equalWeightPercent=(percent(18,20)+percent(6,10))/2)
 r['local-global--hci']=dict(baselinePercent=percent(11,16),revisedPercent=percent(15,16),pointIncrease=percent(15-11,16),additionalAccepted=15-11)
 r['local-global--devops']=dict(overallPercent=percent(4+6,12),firstPercent=percent(4,4),secondPercent=percent(6,8),unresolvedSecond=8-6)
 r['balance-wellbeing--operating-systems']=dict(activePercent=percent(40,60),idlePercent=percent(15,60),unknownPercent=percent(5,60),observedActivePercent=percent(40,55))
 return r
def self_test():
 assert percent(0,0) is None
 assert overlap_groups(12,10,9,8)==dict(both=8,firstOnly=2,secondOnly=1,neither=1)
 try:overlap_groups(10,8,7,4)
 except ValueError:pass
 else:raise AssertionError('Impossible overlap accepted')
 r=fixture_results();assert len(r)==16
 assert r['local-global--visualisation']['aOverallPercent']>r['local-global--visualisation']['bOverallPercent']
 assert r['local-global--visualisation']['aEasyPercent']<r['local-global--visualisation']['bEasyPercent']
 return 'Bounded fixture checks passed; not independent validation or general parser/system correctness.'
if __name__=='__main__':
 p=argparse.ArgumentParser(description=__doc__);p.add_argument('--case',default='all');p.add_argument('--self-test',action='store_true');a=p.parse_args()
 if a.self_test:print(self_test())
 else:
  r=fixture_results()
  if a.case!='all':
   if a.case not in r:p.error('Unknown fixture identity')
   r={a.case:r[a.case]}
  print(json.dumps(r,ensure_ascii=False,indent=2,default=str))
