"""Two authored toy patches, not AI model outputs or a model benchmark."""
import csv
from io import StringIO

def candidate_a(text):
    reader=csv.DictReader(StringIO(text))
    if 'customer_id' not in (reader.fieldnames or []):return 'reject'
    return 'accept' if all(row['customer_id'] for row in reader) else 'reject'

def candidate_b(text):
    rows=list(csv.reader(StringIO(text)))
    if not rows:return 'reject'
    headers=rows[0]
    positions=[i for i,h in enumerate(headers) if h in ('Customer ID','customer_id')]
    if len(positions)!=1:return 'reject'
    position=positions[0]
    if any(len(row)!=len(headers) or not row[position] for row in rows[1:]):return 'reject'
    return 'accept'

CASES=[
 ('legacy header','Customer ID,notes\nC17,existing export\n','accept'),
 ('canonical header','customer_id,notes\nC17,new export\n','accept'),
 ('missing identity','notes\nno identifier\n','reject'),
 ('ambiguous aliases','Customer ID,customer_id\nC17,C18\n','reject'),
 ('empty identity','customer_id,notes\n,missing value\n','reject'),
 ('extra column value','customer_id,notes\nC17,a,b\n','reject'),
]
if __name__=='__main__':
    a_correct=b_correct=0
    for name,text,want in CASES:
        a=candidate_a(text);b=candidate_b(text)
        a_correct+=a==want;b_correct+=b==want
        assert b==want,(name,b,want)
        print(f'{name}: expected={want}; A={a}; B={b}')
    assert a_correct==3 and b_correct==6
    print('7/7 assertions passed. A matches3/6 cases; B matches6/6. These are toy contract results, not model scores.')
