"""Write job.json + sheet prompt for the race-car batch (15 Oct 2026 ~11:30 CET, operator: "get Astra to model race cars ...
do a mix with Astra and Gemini 4 through AGY; show the drawer model in the library"). Six race cars in vehicle.car.race,
three drawn by Astra (tools/author/launch.sh), three by Gemini 4 Argon in Google's Antigravity CLI (tools/author/launch_agy.sh).
job.json "pen" picks the launcher and becomes the card's provenance.author (import_job.py).
usage: python3 tools/vehicles/make_jobs_race.py   (order -> /tmp/race-20261015/order.txt, "<slug> <pen>" per line)"""
import json, os

# the car contract text of the 10 Oct batch (FRAME4, GAME, paint(), GLASS_LIGHTS, WHEELS4, TIME, SHEET): make_jobs.py writes its
# 20 jobs at import time, so run only its definitions (everything above its JOBS list)
_src = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'make_jobs.py')).read()
exec(_src[:_src.index('\nJOBS = [')])

ROOT = os.path.expanduser('~/forge-build/forge-assets')
SCR = '/tmp/race-20261015'

RACE = ('RACE CAR RULES: no text, numbers, brands, sponsor logos or flags anywhere (number panels and roundels stay BLANK, '
        'plain light colour); a game paints its own. Carbon fibre, rubber, metal and the race interior are their own materials, '
        'never Paint. Slick or race tyres with a real tread/sidewall shape, race rims with visible brake discs and calipers. '
        'The Exhaust empty sits at the exhaust outlet (a game puts boost flames there). '
        'ORIGINAL DESIGN: the sheet may look like a real make or model; keep its proportions and race parts but make the face '
        '(headlight shapes, grille, bonnet vents), the side window line and the rear lights your own, and put no lettering on '
        'the tyres. ')

OPEN = ('This is an OPEN-COCKPIT car: no windows, so no "Glass" material except the small visor/screen if any; the cockpit '
        'tub, seat, steering wheel and safety halo must be visible from above. Door_L and Door_R empties mark where the driver '
        'climbs in. Lamps: one small material named "Lamps" for the rain light (red, emissive). ')

# (slug, pen, description, real size, default paint, extra paint note, tags)
JOBS = [
 ('gt-racer', 'astra',
  'An original-design modern GT3 endurance race car built from a FRONT-engine two-door coupe with a long bonnet, the cabin set '
  'far back, a fastback roof and slim angular LED headlights (no round headlamps): wide bolted-on fender flares, a big rear wing on '
  'swan-neck mounts, front splitter with dive planes, rear diffuser, roof air scoop, side-exit exhausts, centre-lock race wheels '
  'on slick tyres, a roll cage and one bucket seat visible through the glass, blank number panels on the doors.',
  '4.60 m long, 2.04 m wide, 1.22 m high, wheelbase 2.65 m', '[0.80, 0.03, 0.02] (race red)',
  'The body panels are Paint; splitter, wing, diffuser and flares edges are carbon. ', ['gt', 'gt3', 'endurance', 'circuit']),
 ('stock-car', 'astra',
  'An American oval-track stock car (top-class oval racing): a long two-door sedan-shaped race body with flat sides and no door '
  'openings, blank number circles on both doors and the roof, a tall rear spoiler, front splitter, a window net on the driver side, '
  'roll cage and one seat inside, steel race wheels with five lug nuts, slick tyres, headlights only as flat shapes.',
  '5.08 m long, 1.98 m wide, 1.30 m high, wheelbase 2.79 m', '[0.02, 0.10, 0.45] (deep blue)',
  'The whole body shell is Paint; splitter and spoiler are not. ', ['stock-car', 'oval', 'nascar', 'american']),
 ('le-mans-prototype', 'astra',
  'An original-design modern endurance prototype (hypercar class): angular faceted bodywork, a flat wide nose with narrow '
  'horizontal LED slits, a closed cockpit in the middle of a low wide body, a shark fin running '
  'from the roof to the rear wing, a full-width rear light bar, big rear wing, front splitter, deep side intakes, slick tyres on '
  'race rims, slim LED headlight clusters.',
  '5.00 m long, 2.00 m wide, 1.15 m high, wheelbase 3.05 m', '[0.03, 0.03, 0.035] (gloss black)',
  'The body panels are Paint; wing, fin edges, splitter and diffuser are carbon. ', ['prototype', 'hypercar', 'endurance', 'le-mans', 'circuit']),
 ('formula-racer', 'gemini4',
  'A modern open-wheel single-seater formula race car (top-class formula racing): exposed wheels, multi-element front and rear '
  'wings, a safety halo over the open cockpit, sidepods with radiator inlets, an airbox above the driver\'s head, a flat floor and '
  'diffuser, push-rod suspension arms as real thin geometry, a rain light under the rear wing.',
  '5.60 m long, 2.00 m wide, 0.95 m high, wheelbase 3.60 m', '[0.75, 0.05, 0.02] (race red)',
  'The engine cover, sidepods and nose are Paint; wings, floor, halo and suspension are carbon or metal. ', ['formula', 'open-wheel', 'single-seater', 'f1', 'circuit']),
 ('rally-car', 'gemini4',
  'An original-design modern rally car built from a compact three-door hatchback with angular creased panels, a short '
  'bonnet, a steeply raked windscreen and slim LED headlights: wide wheel arches, a big rear wing, a roof air scoop, mud flaps '
  'behind every wheel, gravel tyres on white multi-spoke rims, a light pod with four extra lamps on the bonnet, a sump guard, '
  'a roll cage and two bucket seats visible through the glass, light mud and dust on the lower body.',
  '4.10 m long, 1.88 m wide, 1.42 m high, wheelbase 2.63 m', '[0.92, 0.92, 0.90] (white)',
  'The body panels are Paint (mud and dust live in the near-white detail texture); arches, wing and mud flaps are not. ', ['rally', 'gravel', 'off-road', 'hatchback']),
 ('future-racer', 'gemini4',
  'A futuristic concept race car for a near-future racing game, believable in construction: a low wedge body with a canopy '
  'cockpit, exposed glowing turbine intakes on the sides, floating aero blades over the rear wheels, large wheels with turbine-blade '
  'rims and slick tyres, twin rear thruster nozzles with a glowing inner ring (Lamps material), panel lines and vents as geometry.',
  '4.70 m long, 2.10 m wide, 1.10 m high, wheelbase 2.90 m', '[0.10, 0.20, 0.55] (electric blue)',
  'The body panels are Paint; blades, intakes and nozzles are not. ', ['futuristic', 'sci-fi', 'concept', 'rocket', 'circuit']),
]


def main():
    os.makedirs(SCR, exist_ok=True)
    order = []
    for slug, pen, desc, size, default, extra, tags in JOBS:
        open_cockpit = slug == 'formula-racer'
        nodes = WHEELS4 + (OPEN if open_cockpit else GLASS_LIGHTS) + RACE + paint(default, extra)
        if open_cockpit:
            nodes = nodes.replace('A simple but believable interior must be visible through the glass: seats, dashboard, steering '
                                  'wheel, door cards, no empty hollow shell. ',
                                  'The cockpit tub, seat, pedals area and steering wheel are modelled (seen from above). ')
        nodes = GAME + nodes + TIME
        jd = f'{ROOT}/jobs/{slug}-v1'
        os.makedirs(jd, exist_ok=True)
        title = ' '.join(w.upper() if w == 'gt' else w.capitalize() for w in slug.split('-'))
        j = dict(id=f'vehicle.car.race/{slug}', version=1, name=f'{desc[2:-1]} (the one on sheet.jpg)', title=title, slug=slug,
                 refs=['sheet.jpg'], size=size, tris='60k to 110k', mats=8, effort='medium', frame=FRAME4, nodes=nodes,
                 family='cars', pen=pen, tags=tags)
        json.dump(j, open(f'{jd}/job.json', 'w'), indent=1)
        open(f'{jd}/sheet_prompt.txt', 'w').write(SHEET.format(desc=desc, size=size, extra=', carbon fibre'))
        order.append(f'{slug} {pen}')
    open(f'{SCR}/order.txt', 'w').write('\n'.join(order) + '\n')
    print(len(JOBS), 'jobs ->', f'{SCR}/order.txt')


if __name__ == '__main__':
    main()
