-- Herbalytics Seed Data
-- Run ONCE after schema is initialized:
--   mysql -u <user> -p <database> < database/seed.sql
-- NOTE: The server auto-seeds on first start via init.js — only run this manually to reset demo data.

USE herbalytics;

INSERT IGNORE INTO user_profiles (user_id, full_name, title, specialization, institution) VALUES
(1, 'System Administrator', 'Admin',    'Platform Administration',        'Herbalytics'),
(2, 'Dr. Pham Nguyen',      'PhD, ND',  'Herbal Medicine & Phytotherapy', 'Pham Bioscience Institute'),
(3, 'Dr. Alex Chen',        'PhD',      'Natural Product Chemistry',      'Pham Bioscience Institute');

-- Plant families
INSERT IGNORE INTO plant_families (name, description) VALUES
('Asteraceae',   'Daisy family'),
('Lamiaceae',    'Mint family'),
('Apiaceae',     'Carrot/Parsley family'),
('Fabaceae',     'Legume family'),
('Ranunculaceae','Buttercup family'),
('Zingiberaceae','Ginger family'),
('Araliaceae',   'Ginseng family');

-- Plants
INSERT IGNORE INTO plants (common_name, scientific_name, family_id, genus, species, origin_regions, description, traditional_uses, preparation_methods, safety_notes, created_by) VALUES
('Turmeric',     'Curcuma longa',       6, 'Curcuma',    'longa',       'South and Southeast Asia',       'Perennial herbaceous plant with aromatic rhizomes. Yellow-orange color from curcuminoids.', 'Anti-inflammatory, digestive aid, wound healing, liver support.',    'Decoction, powder, tincture, capsules, topical paste', 'Generally safe. High doses may cause GI upset. Caution with blood thinners.', 3),
('Ashwagandha',  'Withania somnifera',  1, 'Withania',   'somnifera',   'India, North Africa, Mediterranean', 'Adaptogenic shrub used in Ayurveda for thousands of years.',            'Stress adaptogen, cognitive enhancement, immune support, sleep aid.', 'Root powder, capsules, tincture, milk decoction',      'Avoid in pregnancy. May interact with thyroid medications.',          3),
('Echinacea',    'Echinacea purpurea',  1, 'Echinacea',  'purpurea',    'North America',                  'Purple coneflower widely used in modern herbal medicine.',              'Immune stimulant, cold and flu treatment, anti-inflammatory.',        'Tincture, tea, capsules, fresh juice',                 'Avoid in autoimmune conditions. Short-term use recommended.',         3),
('Ginger',       'Zingiber officinale', 6, 'Zingiber',   'officinale',  'Southeast Asia',                 'Flowering plant with aromatic rhizomes used as spice and medicine.',   'Digestive aid, anti-nausea, anti-inflammatory, circulatory stimulant.','Fresh root, dried powder, tea, tincture, capsules',    'High doses may interact with anticoagulants.',                        3),
('Ginseng',      'Panax ginseng',       7, 'Panax',      'ginseng',     'East Asia',                      'Slow-growing perennial root used medicinally for millennia in TCM.',   'Adaptogen, cognitive enhancement, energy, immune support.',           'Root decoction, standardized extracts, capsules, teas','Avoid in hypertension. May interact with anticoagulants.',            3),
('Milk Thistle', 'Silybum marianum',    1, 'Silybum',    'marianum',    'Mediterranean Europe',           'Thorny plant whose seeds contain the silymarin complex.',              'Liver protection, antioxidant, gallbladder support.',                 'Standardized extract, seed powder, tea, tincture',     'Very safe. May lower blood sugar.',                                   3),
('Valerian',     'Valeriana officinalis',1,'Valeriana',  'officinalis', 'Europe, Asia',                   'Perennial plant with strong characteristic root odor.',                'Sleep aid, anxiety reduction, mild sedative, muscle relaxant.',       'Root tincture, capsules, tea, extract',                'May cause drowsiness. Avoid with sedatives/alcohol.',                 3);

-- Compounds
INSERT IGNORE INTO compounds (plant_id, name, molecular_formula, molecular_weight, compound_class, bioactivity, mechanism_of_action, known_targets) VALUES
(1, 'Curcumin',             'C21H20O6',  368.38,  'Polyphenol/Curcuminoid', 'Anti-inflammatory, antioxidant, anticancer, neuroprotective', 'Inhibits NF-κB pathway, COX-2 inhibition',               'NF-κB, COX-2, STAT3, Nrf2'),
(2, 'Withanolide A',        'C28H38O6',  470.60,  'Steroidal lactone',      'Adaptogenic, anti-stress, neuroprotective',                   'Modulates HPA axis, GABAergic activity',                  'HSP90, HPA axis, GABA receptors'),
(3, 'Echinacoside',         'C35H46O20', 786.72,  'Caffeic acid glycoside', 'Immunostimulant, antiviral, antioxidant',                     'Enhances phagocytosis, stimulates T-cell proliferation',   'Macrophages, T-lymphocytes, NK cells'),
(4, 'Gingerol (6-Gingerol)','C17H26O4',  294.38,  'Phenylpropanoid',        'Anti-nausea, anti-inflammatory, antioxidant',                 'TRPV1 agonist, 5-HT3 antagonism',                        'TRPV1, 5-HT3, COX-2'),
(5, 'Ginsenoside Rb1',      'C54H92O23', 1109.27, 'Triterpenoid saponin',   'Cognitive enhancement, anti-stress',                         'Modulates neurotransmitter systems, promotes neurogenesis','NMDA receptors, HPA axis, BDNF'),
(6, 'Silymarin (Silybin)',  'C25H22O10', 482.44,  'Flavonolignan',          'Hepatoprotective, antioxidant',                              'Membrane stabilization, inhibits hepatotoxin uptake',     'Liver membranes, CYP3A4, NF-κB'),
(7, 'Valerenic acid',       'C15H22O2',  234.33,  'Sesquiterpene acid',     'Sedative, anxiolytic',                                       'Inhibits GABA transaminase, GABA-A partial agonist',      'GABA-A receptors, GABA-T');

-- Plant tags
INSERT IGNORE INTO plant_tags (name, color) VALUES
('Anti-inflammatory', '#e74c3c'),
('Adaptogen',         '#9b59b6'),
('Antioxidant',       '#27ae60'),
('Immunomodulator',   '#3498db'),
('Hepatoprotective',  '#f39c12'),
('Neuroprotective',   '#1abc9c'),
('Sedative',          '#2c3e50'),
('Digestive',         '#e67e22'),
('TCM',               '#d35400'),
('Ayurvedic',         '#8e44ad');

-- Drug-herb interactions
INSERT IGNORE INTO drug_herb_interactions (plant_id, drug_name, drug_class, interaction_type, severity, mechanism, description) VALUES
(1, 'Warfarin',   'Anticoagulant',          'potentiates', 'moderate', 'Curcumin inhibits platelet aggregation',          'Turmeric at high doses may increase bleeding risk with warfarin'),
(2, 'Levothyroxine','Thyroid hormone',       'inhibits',   'moderate', 'May affect thyroid hormone metabolism',            'Ashwagandha may alter thyroid function; monitor TSH levels'),
(4, 'Aspirin',    'NSAID/Antiplatelet',      'additive',   'mild',     'Additive antiplatelet effects',                   'Combined use may increase bleeding risk, especially pre-surgery'),
(5, 'Insulin',    'Antidiabetic',            'potentiates','moderate', 'Ginseng may enhance insulin sensitivity',          'Risk of hypoglycemia; blood glucose monitoring recommended'),
(6, 'Indinavir',  'HIV Protease Inhibitor',  'inhibits',   'severe',   'Silymarin inhibits CYP3A4 which metabolizes indinavir','May significantly reduce indinavir levels; avoid combination'),
(7, 'Alprazolam', 'Benzodiazepine',          'additive',   'moderate', 'Additive CNS depression via GABA potentiation',   'Enhanced sedation; avoid operating machinery');

-- Research study
INSERT IGNORE INTO research_studies (title, lead_researcher_id, hypothesis, methodology, study_type, status, start_date, abstract, keywords) VALUES
('Anti-inflammatory Effects of Curcumin Nanoparticles on LPS-Induced Macrophage Activation', 3,
 'Curcumin nanoparticles will demonstrate superior anti-inflammatory activity compared to free curcumin due to enhanced bioavailability',
 'In vitro study using RAW264.7 macrophage cell line. LPS stimulation, cytokine profiling by ELISA, Western blot for NF-κB.',
 'in_vitro', 'active', '2026-01-15',
 'This study investigates comparative anti-inflammatory efficacy of curcumin nanoparticles versus free curcumin in macrophage activation.',
 'curcumin, nanoparticles, inflammation, NF-κB, macrophage');

INSERT IGNORE INTO research_pipelines (study_id, step_name, step_order, description, status) VALUES
(1, 'Cell culture preparation',    1, 'Maintain RAW264.7 cells in DMEM + 10% FBS',              'completed'),
(1, 'Nanoparticle synthesis',      2, 'Prepare curcumin PLGA nanoparticles via nanoprecipitation','completed'),
(1, 'Characterization (DLS, TEM)', 3, 'Size, PDI, zeta potential, morphology analysis',          'completed'),
(1, 'LPS stimulation & treatment', 4, 'LPS activation with compound treatment at 6h',            'running'),
(1, 'Cytokine ELISA',              5, 'IL-6, TNF-α, IL-1β quantification',                       'pending'),
(1, 'Western Blot - NF-κB',        6, 'p65, IκB-α, pIκB-α protein analysis',                    'pending'),
(1, 'Statistical analysis',        7, 'ANOVA + Tukey post-hoc test',                             'pending');

-- Collaboration project
INSERT IGNORE INTO projects (name, description, lead_id, status, visibility, start_date, tags) VALUES
('Global Adaptogen Research Consortium', 'Multi-institutional study on adaptogenic herbs and HPA axis modulation.', 3, 'active', 'private', '2026-02-01', 'adaptogen,HPA axis,clinical');

INSERT IGNORE INTO project_members (project_id, user_id, role) VALUES (1, 3, 'lead'), (1, 2, 'co_investigator');

INSERT IGNORE INTO discussions (project_id, author_id, title, content, is_pinned) VALUES
(1, 3, 'Welcome & Data Standardization Protocol',
 'Welcome to the Global Adaptogen Research Consortium. All clinical data should follow CONSORT guidelines. Compound data must include CAS numbers and validated HPLC quantification.',
 1);

-- Formulation
INSERT IGNORE INTO formulations (creator_id, name, formulation_type, target_condition, description, preparation_instructions, dosage_recommendation, version, is_published) VALUES
(2, 'Calm & Restore Adaptogen Blend', 'capsule', 'Stress, Fatigue, Sleep Disturbance',
 'Synergistic adaptogen formula combining ashwagandha, ginseng, and valerian.',
 'Blend standardized extracts to specified ratios. Encapsulate in size 00 vegetarian capsules.',
 '2 capsules twice daily with food.', '2.1', 1);

INSERT IGNORE INTO formulation_ingredients (formulation_id, plant_id, ingredient_name, quantity, unit, percentage, role) VALUES
(1, 2,    'Ashwagandha Root Extract (5% withanolides)',     300, 'mg', 50.0, 'primary'),
(1, 5,    'Panax Ginseng Root Extract (20% ginsenosides)', 150, 'mg', 25.0, 'primary'),
(1, 7,    'Valerian Root Extract (0.8% valerenic acid)',   100, 'mg', 16.7, 'secondary'),
(1, NULL, 'Magnesium Glycinate',                            50, 'mg',  8.3, 'adjuvant');
