import random, datetime as dt, hashlib
random.seed(25)
T = dt.date(2026,12,2)
out=[]
def q(v):
    if v is None: return 'NULL'
    if isinstance(v,(int,float)): return str(v)
    return "'"+str(v).replace("\\","\\\\").replace("'","''")+"'"
def ins(t, rows):
    if not rows: return
    cols=list(rows[0].keys())
    for i in range(0,len(rows),200):
        out.append(f"INSERT INTO `{t}` ({','.join('`'+c+'`' for c in cols)}) VALUES " + ",".join("("+",".join(q(r[c]) for c in cols)+")" for r in rows[i:i+200])+";")
import subprocess
def h(p): return subprocess.check_output(['php','-r',f'echo password_hash("{p}", PASSWORD_DEFAULT);']).decode()
PW=h('Demo@1234')
out.append("SET FOREIGN_KEY_CHECKS=0;")
for t in ['admin','users','users_logs','students','student_logs','tt_classes','tt_slots','tt_subject_teachers','student_fees','student_payments','school_calendar','exam_assessments','exam_marks','staff_leaves','app_time_requests','parent_accounts','app_staff_accounts','devices','work_months','work_holidays','student_leave_requests','tt_class_teacher_history']:
    out.append(f"DELETE FROM `{t}`;")
ins('admin',[{'id':1,'admin_name':'Mrs. R. Dias','admin_email':'principal@demo.school','admin_pwd':PW,'role':'admin'},
             {'id':2,'admin_name':'Chamari Bandara','admin_email':'office@demo.school','admin_pwd':PW,'role':'staff'}])
ins('devices',[{'id':1,'device_name':'Main Gate','device_dep':'School','device_uid':'a1b2c3d4e5f60708','device_date':'2026-09-01','device_mode':1},
               {'id':2,'device_name':'Pre School Gate','device_dep':'Pre-School','device_uid':'b1b2c3d4e5f60709','device_date':'2026-09-01','device_mode':1}])
staff=[ (1,'Anushka Fernando','Female','School','07:30','14:00'),(2,'Ruwan Silva','Male','School','07:30','14:00'),
 (3,'Shalini Rajan','Female','School','07:30','14:00'),(4,'Kasun Jayawardena','Male','School','07:30','14:00'),
 (5,'Fathima Rizwan','Female','School','07:30','14:00'),(6,'Tharushi Wickramasinghe','Female','Pre-School','08:00','12:30'),
 (7,'Nadeesha Gunawardena','Female','Pre-School','08:00','12:30'),(8,'Dinesh Kumar','Male','School','07:30','14:00'),
 (9,'Chamari Bandara','Female','Administration','08:00','16:00'),(10,'Sunil Herath','Male','Administration','07:00','15:00'),
 (11,'Ishara De Silva','Female','School','07:30','14:00'),(12,'Pradeep Ratnayake','Male','School','07:30','14:00')]
U=[]
for i,n,g,d,di,do in staff:
    U.append({'id':i,'username':n,'serialnumber':100+i,'gender':g,'email':n.split()[0].lower()+'@demo.school','card_uid':f'ST{i:04d}A9','card_select':0,
      'user_date':'2026-01-05','device_uid':'a1b2c3d4e5f60708','device_dep':d,'add_card':1,'department':d,'dob':f'19{85+i%10}-0{1+i%9}-1{i%9}',
      'join_date':'2024-01-08' if i<9 else '2026-06-01','nic':f'19{85+i%10}{i:03d}04567','duty_in':di,'duty_out':do,'basic_salary':85000+i*2500,
      'epf':0,'etf':0,'net_salary':0,'status':'active','emp_status':'confirmed' if i<9 else 'probation','probation_end':None if i<9 else '2026-12-01','confirmed_date':'2024-07-08' if i<9 else None})
ins('users',U)
ins('app_staff_accounts',[{'user_id':i,'pwd_hash':PW,'must_change':0,'set_by':'Mrs. R. Dias','updated_at':'2026-11-01 09:00:00','last_login':'2026-12-02 07:40:00'} for i in range(1,13)])
def wdays(a,b):
    d=a
    while d<=b:
        if d.weekday()<5: yield d
        d+=dt.timedelta(days=1)
HOL={dt.date(2026,11,24):'Il Full Moon Poya Day'}
ins('work_holidays',[{'holiday_date':'2026-11-24','title':'Il Full Moon Poya Day','created_by':'Mrs. R. Dias','created_at':'2026-11-01 09:00:00'},
                     {'holiday_date':'2026-12-23','title':'Unduvap Full Moon Poya Day','created_by':'Mrs. R. Dias','created_at':'2026-11-01 09:00:00'},
                     {'holiday_date':'2026-12-25','title':'Christmas Day','created_by':'Mrs. R. Dias','created_at':'2026-11-01 09:00:00'}])
ins('work_months',[{'ym':m,'pattern':'mon_fri','updated_by':'Mrs. R. Dias','updated_at':'2026-09-01 09:00:00'} for m in ['2026-09','2026-10','2026-11','2026-12']])
def tm(base, delta):
    h,m=map(int,base.split(':')); t=h*60+m+delta; return f'{t//60:02d}:{t%60:02d}:{random.randint(0,59):02d}'
L=[]; lid=1
absent_today={7}; late_today={2,8}
for d in wdays(dt.date(2026,10,1),T):
    if d in HOL: continue
    for i,n,g,dep,di,do in staff:
        if d==T and i in absent_today: continue
        if d!=T and random.random()<0.04: continue
        late = (i in late_today) if d==T else random.random()<0.1
        tin=tm(di, random.randint(12,35) if late else random.randint(-25,4))
        tout=None if d==T else tm(do, random.randint(-5,40))
        if d==T and i==10: tout=None
        L.append({'id':lid,'username':n,'serialnumber':100+i,'card_uid':f'ST{i:04d}A9','device_uid':'a1b2c3d4e5f60708','device_dep':dep,'checkindate':d.isoformat(),
                  'timein':tin,'timeout':tout or '00:00:00','card_out':0 if d==T else 1,'department':dep,'duty_in':di,'duty_out':do,'manual':0,'manual_by':None,'manual_note':None}); lid+=1
ins('users_logs',L)
# classes: (id, grade, division, room, class teacher)
C=[(1,-2,'A','P-01',7),(2,-1,'A','P-02',None),(3,0,'A','P-03',6),(4,1,'A','101',None),(5,2,'A','102',None),(6,3,'A','103',5),(7,4,'A','104',1),(8,4,'B','105',3),(9,5,'A','106',2),(10,6,'A','201',4),(11,7,'A','202',8),(12,8,'A','203',12)]
ins('tt_classes',[{'id':c[0],'grade':c[1],'division':c[2],'room':c[3],'class_teacher_id':c[4],'created_at':'2026-09-01 08:00:00'} for c in C])
out.append("UPDATE tt_subjects SET two_teachers=1, name='2nd Language (Sinhala/Tamil)', code='2LNG' WHERE id=5;")
SUBT={1:[1],2:[2],3:[5],4:[8],5:[4,3],7:[4],8:[12],9:[12],10:[5],11:[11],12:[11],13:[12],14:[9],21:[6,7],22:[7,6]}
ins('tt_subject_teachers',[{'subject_id':s,'teacher_id':t} for s,ts in SUBT.items() for t in ts])
S=[];sid=1
busy=set()
CAND={1:[1,11],2:[2,8],3:[5],4:[8],5:[4],7:[4,12],8:[12],9:[12,4],10:[5],11:[11],12:[11],13:[12],14:[11,3],21:[6,7,11],22:[7,6,11]}
LISTS=[[1,2,3,5,10,11,7,13],[2,1,5,3,4,14,8,1],[1,2,3,5,12,10,7,11],[2,1,4,3,5,13,9,1],[1,2,5,3,10,11,14,4]]
pid_int=[1,2,3,5,6,7,8,9]; pid_pre=[10,11,13,14]
for day in range(1,6):
    for c in C:
        cid,g,div=c[0],c[1],c[2]
        if g<=0:
            want=[21,22,21,22] if day%2 else [22,21,11,12]; pids=pid_pre
        else:
            base=LISTS[(day-1)%5]; k=cid%8; want=base[k:]+base[:k]; pids=pid_int
        todo=list(want)
        for p in pids:
            placed=False
            for s_ in todo:
                cands=CAND.get(s_,[2])
                if s_ in (21,22) and c[4]: cands=[c[4]]+[t for t in cands if t!=c[4]]
                for t in cands:
                    if (day,p,t) in busy: continue
                    t2=None
                    if s_==5:
                        if (day,p,3) in busy: continue
                        t2=3
                    busy.add((day,p,t)); 
                    if t2: busy.add((day,p,t2))
                    S.append({'id':sid,'class_id':cid,'day':day,'period_id':p,'subject_id':s_,'teacher_id':t,'teacher2_id':t2,'room':'Lab 1' if s_==4 else None,'note':None,'updated_by':'Mrs. R. Dias','updated_at':'2026-09-01 08:00:00'}); sid+=1
                    todo.remove(s_); placed=True; break
                if placed: break
            if not placed:
                for s_,pool in ([(14,[11,12,8,5,4,2,3,1]),(13,[12,11,8,2,4,5])] if g>0 else [(22,[7,6,11])]):
                    t=next((t for t in pool if (day,p,t) not in busy),None)
                    if t:
                        busy.add((day,p,t)); S.append({'id':sid,'class_id':cid,'day':day,'period_id':p,'subject_id':s_,'teacher_id':t,'teacher2_id':None,'room':None,'note':None,'updated_by':'Mrs. R. Dias','updated_at':'2026-09-01 08:00:00'}); sid+=1; break
ins('tt_slots',S)
ins('tt_class_teacher_history',[{'id':i+1,'year':2026,'term':3 if c[1]<=0 else 1,'grp':'preschool' if c[1]<=0 else 'international','class_id':c[0],'class_label':'', 'teacher_id':c[4],'teacher_name':[s[1] for s in staff if s[0]==c[4]][0],'updated_by':'Mrs. R. Dias','updated_at':'2026-09-01 08:00:00'} for i,c in enumerate(C) if c[4]])
# students
first_b=['Kavin','Sahan','Dulan','Nethum','Yohan','Rishan','Thisal','Ashen','Arjun','Imran','Lahiru','Pasindu','Dinuk','Kesara','Vihanga','Ayaan']
first_g=['Senuli','Nethmi','Sanduni','Hiruni','Amaya','Dinara','Tharushi','Kavya','Aisha','Methmi','Sithmi','Ruvini','Nadia','Isuri','Shenaya','Anya']
last=['Perera','Fernando','Silva','Jayasinghe','Wijesinghe','Rathnayake','Gunasekara','Mendis','Kumar','Rajapaksha','Herath','Dissanayake','Ahamed','Senanayake','De Mel','Weerasinghe']
houses=['Ruby','Sapphire','Emerald','Topaz']
ST=[]; stid=1
def student(g,div,fn,ln,gender,fnic,father,mother,mnic,fam=None,adm='2025-01-06'):
    global stid
    s={'id':stid,'admission_no':f'PDS/{2024+stid%3}/{stid:04d}','full_name':f'{fn} {ln}','name_with_initials':f'{fn} {ln}','gender':gender,
       'dob':f'{2026-5-g if g>0 else 2026-5-g}-{1+stid%12:02d}-{1+stid%27:02d}' if g>0 else f'{2026-4+g}-{1+stid%12:02d}-{1+stid%27:02d}',
       'nationality':'Sri Lankan','medium':'English','grade':g,'class_name':div,'house':houses[stid%4],'admission_date':adm,'admitted_grade':g,
       'address':f'{10+stid}, Temple Road','city':'Colombo','district':'Colombo','blood_group':['A+','B+','O+','AB+'][stid%4],
       'medical_notes':'Mild asthma – inhaler in school bag' if stid==1 else None,
       'father_name':father,'father_occupation':'Engineer','father_phone':f'07{stid%8+1}{1234560+stid}','father_nic':fnic,
       'mother_name':mother,'mother_occupation':'Teacher','mother_phone':f'07{(stid+3)%8+1}{7654320+stid}','mother_nic':mnic,
       'emergency_phone':f'0771{234500+stid}','parent_email':f'family{stid}@example.com','transport':'School van',
       'fee_discount':0,'monthly_fee':18500 if g>0 else 12500,'admission_fee':50000,'family_id':fam,
       'card_uid':f'SC{stid:05d}','card_date':adm,'status':'active','created_by':'Mrs. R. Dias','created_at':adm+' 09:00:00','updated_at':adm+' 09:00:00'}
    ST.append(s); stid+=1; return s
# demo family
senuli=student(4,'A','Senuli','Perera','Female','198512304567','Nimal Perera','Dilani Perera','198862201234',1,'2024-09-02')
kavin=student(0,'A','Kavin','Perera','Male','198512304567','Nimal Perera','Dilani Perera','198862201234',1,'2026-01-05')
for c in C:
    n= 14 if c[1]==4 and c[2]=='A' else 7
    for k in range(n - (1 if c[0] in (7,3) else 0)):
        gb=random.random()<0.5; fn=random.choice(first_b if gb else first_g); ln=random.choice(last)
        fnic=f'19{random.randint(75,92)}{random.randint(1000000,9999999):07d}'[:12]
        fnic=fnic.ljust(12,'1')
        student(c[1],c[2],fn,ln,'Male' if gb else 'Female',fnic,'Mr. '+random.choice(first_b)+' '+ln,'Mrs. '+random.choice(first_g)+' '+ln,None)
ins('students',ST)
SL=[];slid=1
for d in wdays(dt.date(2026,10,1),T):
    if d in HOL: continue
    for s in ST:
        r=random.random()
        if s['id']==1 and d in (dt.date(2026,11,12),dt.date(2026,11,13)): continue
        if s['id']==2 and d==dt.date(2026,11,19): continue
        if s['id']>2 and r<0.05: continue
        if d==T and s['id']>2 and r<0.09: continue
        st='08:00' if s['grade']>0 else '08:30'; en='13:30' if s['grade']>0 else ('12:15' if s['grade']==0 else '11:30')
        late = random.random()<0.07 or (s['id']==1 and d==dt.date(2026,11,26))
        tin=tm(st, random.randint(12,30) if late else random.randint(-35,5))
        tout=None if d==T else tm(en, random.randint(0,25))
        SL.append({'id':slid,'student_id':s['id'],'admission_no':s['admission_no'],'student_name':s['name_with_initials'],'grade':s['grade'],'class_name':s['class_name'],
                   'card_uid':s['card_uid'],'device_uid':'a1b2c3d4e5f60708','device_dep':'School' if s['grade']>0 else 'Pre-School','log_date':d.isoformat(),
                   'time_in':tin,'time_out':tout,'card_out':0 if d==T else 1,'manual':0,'manual_by':None,'manual_note':None}); slid+=1
ins('student_logs',SL)
# fees
F=[];P=[];fid=1;pid=1
for s in ST:
    F.append({'id':fid,'student_id':s['id'],'fee_type_id':5,'fee_name':'Admission fee','period':'','amount':50000,'discount':0,'net_amount':50000,'due_date':s['admission_date'],'note':None,'status':'active','cancel_reason':None,'cancelled_by':None,'created_by':'Mrs. R. Dias','created_at':s['admission_date']+' 09:00:00'}); fid+=1
    P.append({'id':pid,'receipt_no':f'PDS-2026-{pid:05d}','student_id':s['id'],'payment_date':s['admission_date'],'amount':50000,'method':'Bank transfer','reference':None,'paid_for':'Admission fee','note':None,'billing_month':None,'bf_amount':None,'month_fee':None,'prior_paid':None,'cf_amount':None,'status':'valid','void_reason':None,'voided_by':None,'received_by':'Chamari Bandara','created_at':s['admission_date']+' 10:00:00'}); pid+=1
    F.append({'id':fid,'student_id':s['id'],'fee_type_id':3,'fee_name':'Facility fee','period':'Term 1 2026/27','amount':7500,'discount':0,'net_amount':7500,'due_date':'2026-09-30','note':None,'status':'active','cancel_reason':None,'cancelled_by':None,'created_by':'Mrs. R. Dias','created_at':'2026-09-01 09:00:00'}); fid+=1
    F.append({'id':fid,'student_id':s['id'],'fee_type_id':4,'fee_name':'Examination fee','period':'Term 1 2026/27','amount':3500,'discount':0,'net_amount':3500,'due_date':'2026-12-10','note':None,'status':'active','cancel_reason':None,'cancelled_by':None,'created_by':'Mrs. R. Dias','created_at':'2026-11-20 09:00:00'}); fid+=1
    P.append({'id':pid,'receipt_no':f'PDS-2026-{pid:05d}','student_id':s['id'],'payment_date':'2026-09-12','amount':7500,'method':'Cash','reference':None,'paid_for':'Facility fee – Term 1 2026/27','note':None,'billing_month':None,'bf_amount':None,'month_fee':None,'prior_paid':None,'cf_amount':None,'status':'valid','void_reason':None,'voided_by':None,'received_by':'Chamari Bandara','created_at':'2026-09-12 10:00:00'}); pid+=1
    for m in ['2026-09','2026-10','2026-11','2026-12']:
        F.append({'id':fid,'student_id':s['id'],'fee_type_id':1,'fee_name':'Monthly school fee','period':m,'amount':s['monthly_fee'],'discount':0,'net_amount':s['monthly_fee'],'due_date':m+'-10','note':None,'status':'active','cancel_reason':None,'cancelled_by':None,'created_by':'Mrs. R. Dias','created_at':m+'-01 06:00:00'}); fid+=1
    for m,dd in [('2026-09','2026-09-08'),('2026-10','2026-10-07'),('2026-11','2026-11-09'),('2026-12','2026-12-0'+str(1+s['id']%2))]:
        if m=='2026-12' and (s['id']%3!=0 or s['id'] in (1,2)): continue
        if m=='2026-11' and s['id']%7==0: continue
        P.append({'id':pid,'receipt_no':f'PDS-2026-{pid:05d}','student_id':s['id'],'payment_date':dd,'amount':s['monthly_fee'],'method':random.choice(['Cash','Bank deposit','Online payment']),'reference':None,'paid_for':None,'note':None,'billing_month':m,'bf_amount':0,'month_fee':s['monthly_fee'],'prior_paid':0,'cf_amount':0,'status':'valid','void_reason':None,'voided_by':None,'received_by':'Chamari Bandara','created_at':dd+' 09:30:00'}); pid+=1
ins('student_fees',F); ins('student_payments',P)
cal=[('international','term','Term 1 (2026/27)','2026-09-01','2026-12-18',None,None,None),
 ('all','exam','Term 1 tests','2026-12-07','2026-12-11',None,None,'Main hall'),
 ('all','event','Christmas Carol Service','2026-12-16','2026-12-16','17:00','19:00','School auditorium'),
 ('all','meeting',"Parent–teacher meeting",'2026-12-12','2026-12-12','08:30','12:00','Classrooms'),
 ('preschool','event','Pre School Concert rehearsal','2026-12-04','2026-12-04','09:00','11:00','Pre School hall'),
 ('all','holiday','Christmas holidays','2026-12-19','2027-01-04',None,None,None),
 ('international','special',"Children's Day",'2026-10-01','2026-10-01',None,None,None),
 ('all','event','Inter-house Sports Meet','2026-11-14','2026-11-14','07:30','13:00','School grounds'),
 ('international','term','Term 2 (2026/27)','2027-01-05','2027-04-09',None,None,None)]
ins('school_calendar',[{'id':i+1,'grp':c[0],'kind':c[1],'title':c[2],'date_from':c[3],'date_to':c[4],'time_from':c[5],'time_to':c[6],'venue':c[7],'details':'Please note in your diary.' if c[1]!='term' else None,'for_parents':1,'for_staff':1,'created_by':'Mrs. R. Dias','created_at':'2026-08-25 09:00:00','updated_by':'','updated_at':'2026-08-25 09:00:00'} for i,c in enumerate(cal)])
# marks for grade 4 A + 4 B and preschool final
A=[];M=[];aid=1
cls_students=lambda g,div:[s for s in ST if s['grade']==g and s['class_name']==div]
for cid,g,div in [(4,1,'A'),(5,2,'A'),(6,3,'A'),(7,4,'A'),(8,4,'B'),(9,5,'A')]:
    for sub,teacher in ([(1,1),(2,2),(3,5),(5,4)] if cid in (7,8,9) else [(1,1)]):
        for unit,dte in [(1,'2026-09-25'),(2,'2026-10-23'),(3,'2026-11-20')]:
            A.append({'id':aid,'kind':'unit','grp':'international','year':2026,'term':1,'unit_no':unit,'class_id':cid,'grade':g,'division':div,'subject_id':sub,'title':'','test_date':dte,'max_marks':50 if sub!=2 else 100,'published':1,'notified_at':dte+' 15:00:00','created_by_kind':'staff','created_by_id':teacher,'created_by_name':[x[1] for x in staff if x[0]==teacher][0],'updated_by_name':'','created_at':dte+' 14:00:00','updated_at':dte+' 14:00:00'})
            mx=50 if sub!=2 else 100
            for s in cls_students(g,div):
                base=0.86 if s['id']==1 else random.uniform(0.5,0.92)
                mk=round(min(mx,max(5,mx*(base+random.uniform(-0.12,0.1)+ (0.03*unit if s['id']==1 else 0)))))
                M.append({'assessment_id':aid,'student_id':s['id'],'marks':mk,'absent':0,'remark':'Excellent work' if s['id']==1 and unit==3 else None,'entered_by':'','updated_at':dte+' 14:00:00'})
            aid+=1
ins('exam_assessments',A); ins('exam_marks',M)
ins('parent_accounts',[{'id':1,'father_nic':'198512304567','phone_key':None,'phone':'0771234561','name':'Nimal Perera / Dilani Perera','pwd_hash':PW,'must_change':0,'set_by':'Mrs. R. Dias','created_at':'2026-09-01 09:00:00','updated_at':'2026-09-01 09:00:00','last_login':'2026-12-02 07:00:00','notify_taps':1}])
# staff leaves
SLV=[(1,'2026-11-06','full',None,None,'Family function','approved'),(1,'2026-12-09','half','08:00','11:00','Medical appointment','pending'),
     (5,'2026-12-04','full',None,None,'Sick','pending'),(8,'2026-12-03','short','12:30','14:00','Bank work','pending'),(7,'2026-12-02','full',None,None,'Fever','approved'),(2,'2026-11-18','full',None,None,'Personal','approved')]
ins('staff_leaves',[{'id':i+1,'user_id':u,'username':staff[u-1][1],'serialnumber':100+u,'department':staff[u-1][3],'leave_date':d,'leave_type':ty,'time_from':a,'time_to':b,'reason':r,
  'authorized_by_id':1,'authorized_by_name':'Mrs. R. Dias','substitute_id':2 if u==1 else 1,'substitute_name':staff[1][1] if u==1 else staff[0][1],'substitute_dept':'School','entered_by_id':u,'entered_by_name':'Staff app',
  'status':stt,'approved_by_id':1 if stt=='approved' else None,'approved_by_name':'Mrs. R. Dias' if stt=='approved' else None,'decided_at':(d+' 07:00:00') if stt=='approved' else None,'decision_note':None,'created_at':'2026-11-30 18:00:00'} for i,(u,d,ty,a,b,r,stt) in enumerate(SLV)])
ins('app_time_requests',[{'id':1,'user_id':4,'username':staff[3][1],'serialnumber':104,'department':'School','req_date':'2026-12-01','kind':'out','time_in':None,'time_out':'14:10:00','reason':'Forgot to tap out – left with the sports team','status':'pending','decided_by_id':None,'decided_by_name':None,'decided_at':None,'decision_note':None,'log_id':None,'created_at':'2026-12-01 19:00:00'},
                         {'id':2,'user_id':1,'username':staff[0][1],'serialnumber':101,'department':'School','req_date':'2026-11-27','kind':'in','time_in':'07:22:00','time_out':None,'reason':'Left my card at home','status':'approved','decided_by_id':1,'decided_by_name':'Mrs. R. Dias','decided_at':'2026-11-27 12:00:00','decision_note':None,'log_id':None,'created_at':'2026-11-27 08:00:00'}])
ins('student_leave_requests',[{'id':1,'student_id':1,'parent_id':1,'parent_name':'Nimal Perera / Dilani Perera','leave_type':'full','date_from':'2026-11-12','date_to':'2026-11-13','days':2,'time_at':None,'reason_type':'Sick','reason':'Fever and cold','att_name':None,'att_file':None,'att_type':None,'att_size':None,'status':'approved','decided_by_kind':'staff','decided_by_name':'Anushka Fernando','decided_at':'2026-11-11 19:00:00','decision_note':'Get well soon','created_at':'2026-11-11 18:30:00'},
 {'id':2,'student_id':2,'parent_id':1,'parent_name':'Nimal Perera / Dilani Perera','leave_type':'early','date_from':'2026-12-04','date_to':'2026-12-04','days':0.5,'time_at':'10:30:00','reason_type':'Medical appointment','reason':'Dentist appointment','att_name':None,'att_file':None,'att_type':None,'att_size':None,'status':'pending','decided_by_kind':None,'decided_by_name':None,'decided_at':None,'decision_note':None,'created_at':'2026-12-01 20:10:00'}])
open('/home/claude/build/seed.sql','w').write("\n".join(out))
print(len(ST),'students',len(SL),'slogs',len(L),'stafflogs')
