-- BrainCore pgVector Starter — Synthetic demo data
-- All data is public-safe and synthetic.

INSERT INTO trust_classes (label, description, max_rank)
VALUES
    ('verified',   'Human-reviewed or signed source', 10),
    ('automated',  'System-generated with checks',      30),
    ('community',  'Community-contributed, unverified', 50),
    ('placeholder','Deterministic test data',           99);

INSERT INTO sources (name, source_type, tags, url, metadata)
VALUES
    ('braincore-docs', 'file', '{"docs","official"}', 'https://huggingface.co/spaces/trentdoney/memory-explorer-space',
     '{"format":"markdown","version":"0.1"}'),
    ('demo-user-alpha', 'user', '{"demo","alpha"}', NULL,
     '{"role":"researcher"}'),
    ('synthetic-generator', 'tool', '{"synthetic","test"}', NULL,
     '{"generator":"sql-seed","note":"public-safe synthetic data"}');

-- Insert some memory items with placeholder embeddings
-- We use a simple repeating pattern for the 384-dim vector so cosine search still works deterministically.
INSERT INTO memory_items (tenant_id, content, embedding, visibility, trust_class_id, source_id, metadata)
VALUES
    ('public', 'BrainCore is a collective for agent memory and AI operations.',
     (SELECT array_agg(0.1) FROM generate_series(1, 384))::vector, 'public',
     1, 1, '{"topic":"overview","lang":"en"}'),

    ('public', 'Memory items should carry provenance and trust classes.',
     (SELECT array_agg(0.11) FROM generate_series(1, 384))::vector, 'public',
     1, 1, '{"topic":"design","lang":"en"}'),

    ('tenant-a', 'Tenant A internal research note on retrieval paths.',
     (SELECT array_agg(0.2) FROM generate_series(1, 384))::vector, 'restricted',
     2, 2, '{"topic":"research","confidentiality":"internal"}'),

    ('tenant-a', 'Draft hypothesis: trust classes reduce hallucination risk.',
     (SELECT array_agg(0.21) FROM generate_series(1, 384))::vector, 'restricted',
     2, 2, '{"topic":"hypothesis","review_status":"draft"}'),

    ('tenant-b', 'Tenant B experiment log — synthetic data only.',
     (SELECT array_agg(0.3) FROM generate_series(1, 384))::vector, 'restricted',
     3, 3, '{"topic":"experiment","note":"synthetic"}'),

    ('public', 'Public memory explorer is live at Hugging Face Spaces.',
     (SELECT array_agg(0.12) FROM generate_series(1, 384))::vector, 'public',
     1, 1, '{"topic":"announcement","url":"https://huggingface.co/spaces/trentdoney/memory-explorer-space"}');

-- Add a couple of memory events
INSERT INTO memory_events (memory_id, event_type, actor, details)
SELECT id, 'created', 'seed_script', '{"note":"initial synthetic seed"}'
FROM memory_items;
