"""Create small synthetic fixtures without extracting real protein embeddings."""
from pathlib import Path

import numpy as np


def main():
    root = Path("demo-embeddings")
    root.mkdir()  # Refuse to overwrite a previous demo directory.
    ids = np.array(["protein_A", "protein_B", "protein_C"], dtype=np.str_)
    vectors = np.array([[0.1, 0.2, 0.3, 0.4],
                        [0.4, 0.3, 0.2, 0.1],
                        [-0.1, 0.0, 0.2, 0.5]], dtype=np.float32)
    (root / "ids.txt").write_text("\n".join(ids.tolist()) + "\n", encoding="utf-8")
    cases = {"good": (ids, vectors),
             "reordered": (ids[::-1], vectors[::-1]),
             "duplicate": (np.array(["protein_A", "protein_A", "protein_C"]), vectors)}
    bad = vectors.copy()
    bad[1, 2] = np.nan
    cases["nan"] = (ids, bad)
    for name, (sample_ids, embedding) in cases.items():
        np.savez(root / f"{name}.npz", sample_id=sample_ids, embedding=embedding,
                 allow_pickle=False)
    print("Created demo-embeddings with four synthetic archives and ids.txt")


if __name__ == "__main__":
    main()
