# Nabooru madura con bunny suit (nov-2026).
import json, pathlib, sys
sys.path.insert(0, "Engine")
from api_client import ForgeClient

BASE = pathlib.Path(r"C:\Users\Usuario\Downloads\SD")
OUT = BASE / "Output" / "test_nabooru_bunny"
OUT.mkdir(parents=True, exist_ok=True)

MASTER = """masterpiece, best quality, highly detailed, sharp focus, very aesthetic, very awa,
detailed background, score_9, score_8_up, <lora:IFL_v1.0_IL:0.7> <lora:add-detail-xl:0.5>
<lora:blackwhiplash(bwl)-guy90-Illust-Lorav3:0.6> blaash, <lora:scara2b_ill_v1.00:0.7> scara2b-style,
<lora:Add_color_ILXLv1:3>, 1girl, solo"""

NEG = ("lowres, bad anatomy, bad hands, extra fingers, missing fingers, extra limbs, missing limbs, "
       "fused fingers, poorly drawn face, poorly drawn hands, censored, mosaic censoring, bar censor, "
       "mirror, reflection, extra person, 2girls, 2boys, duplicate")

NABOORU = "<lora:NabooruZelda_IXL:0.8> nabooru, gerudo, red hair, green eyes, mature_female, large_breasts, thick_thighs, muscular_female, desert theme"
BUNNY = "playboy_bunny, white_leotard, strapless_leotard, white_gloves, cuffs, black_bowtie, fishnet_pantyhose, rabbit_tail, half naked, solo"

POSES = [
    "standing, hands on hips, muscular, casino, neon lights, night, looking_at_viewer, from front, night, moon",
    "standing, holding tray, serving pose, casino, night, from front, night, moon",
]

client = ForgeClient("http://127.0.0.1:7860")
assert client.check_status(), "Forge no responde"

manifest = []
for i, pose in enumerate(POSES, 1):
    prompt = (f"{MASTER}\nBREAK\n1girl, {NABOORU}, {BUNNY}\n"
              f"BREAK\n{pose}")
    images, info = client.txt2img(prompt, negative_prompt=NEG, width=832, height=1216,
                                  steps=28, cfg_scale=6.0, seed=-1)
    for j, img in enumerate(images, 1):
        fname = f"nabooru_bunny_{i:02d}_{j}.png"
        (OUT / fname).write_bytes(img)
        manifest.append({"file": fname, "pose": pose, "outfit": BUNNY,
                         "prompt": prompt, "seed": info.get("seed")})
        print(f"[OK] {fname} seed={info.get('seed')}")

(OUT / "manifest.json").write_text(json.dumps(manifest, ensure_ascii=False, indent=1), encoding="utf-8")
print(f"[OK] {OUT} ({len(manifest)} imgs)")
