// neurotransmitter_pathways.sy -- Synthesis, receptors, degradation,
// and pharmacology of all major neurotransmitters as native Scyla.
//
// Marjorie McCubbins + Aether, April 2026
// Patent pending: 64/034,536
//
// Seven transmitter systems: dopamine, serotonin, norepinephrine,
// acetylcholine, GABA, glutamate, and minor transmitters (glycine,
// histamine, endorphins, endocannabinoids, nitric oxide).
//
// Every enzyme, transporter, and receptor carries its UniProt accession.
// Synthesis pathways encode rate-limiting steps and cofactors.
// Receptor entries distinguish ionotropic from metabotropic, and
// specify G-protein coupling (Gs, Gi/o, Gq) where applicable.
// Degradation and reuptake entries name the responsible protein
// and its gene (SLC6A3, SLC6A4, etc).
// Clinical entries connect each system to disease and pharmacology.
//
// Sources:
//   Stahl SM. Stahl's Essential Psychopharmacology, 5th ed, 2021
//   Brunton LL et al. Goodman & Gilman's The Pharmacological Basis
//     of Therapeutics, 14th ed, 2023
//   Kandel ER et al. Principles of Neural Science, 6th ed, 2021
//   UniProt Consortium. UniProt release 2026_02
//
// Nomenclature note: "state" and "channel" are reserved Scyla keywords.
// We use nt_status for transmitter status and receptor_type for
// channel/receptor classification throughout.


// ═══════════════════════════════════════════════════════
// STRUCTS
// ═══════════════════════════════════════════════════════

struct SynthesisStep {
    step_number: Int,
    substrate: String,
    product: String,
    enzyme: String,
    enzyme_gene: String,
    enzyme_accession: String,
    cofactor: String,
    rate_limiting: Bool,
    citation: String,
}

struct Receptor {
    name: String,
    gene: String,
    accession: String,
    receptor_type: String,        // "GPCR", "ionotropic", "enzyme_linked"
    coupling: String,             // "Gs", "Gi", "Gq", "Na_K_Ca", "Cl", "none"
    ion_permeability: String,     // for ionotropic receptors
    primary_locations: String,
    functional_effect: String,
    citation: String,
}

struct DegradationPathway {
    enzyme: String,
    enzyme_gene: String,
    enzyme_accession: String,
    substrate: String,
    product: String,
    location: String,
    inhibitor: String,
    clinical_use: String,
    citation: String,
}

struct Transporter {
    name: String,
    gene: String,
    accession: String,
    transmitter: String,
    mechanism: String,
    inhibitor: String,
    clinical_use: String,
    citation: String,
}

struct NTPathway {
    name: String,
    origin: String,
    target: String,
    functional_role: String,
    clinical_relevance: String,
    citation: String,
}

struct ClinicalEntry {
    transmitter: String,
    condition: String,
    mechanism: String,
    pharmacotherapy: String,
    drug_target_accession: String,
    citation: String,
}


// ═══════════════════════════════════════════════════════
// HELPER CONSTRUCTORS
// ═══════════════════════════════════════════════════════

fn synth(sn: Int, sub: String, prod: String, enz: String, eg: String, ea: String, cof: String, rl: Bool, ci: String) -> SynthesisStep {
    return SynthesisStep { step_number: sn, substrate: sub, product: prod, enzyme: enz, enzyme_gene: eg, enzyme_accession: ea, cofactor: cof, rate_limiting: rl, citation: ci }
}

fn recep(n: String, g: String, a: String, rt: String, co: String, ip: String, pl: String, fe: String, ci: String) -> Receptor {
    return Receptor { name: n, gene: g, accession: a, receptor_type: rt, coupling: co, ion_permeability: ip, primary_locations: pl, functional_effect: fe, citation: ci }
}

fn degrad(e: String, eg: String, ea: String, sub: String, prod: String, loc: String, inh: String, cl: String, ci: String) -> DegradationPathway {
    return DegradationPathway { enzyme: e, enzyme_gene: eg, enzyme_accession: ea, substrate: sub, product: prod, location: loc, inhibitor: inh, clinical_use: cl, citation: ci }
}

fn transp(n: String, g: String, a: String, tr: String, mech: String, inh: String, cl: String, ci: String) -> Transporter {
    return Transporter { name: n, gene: g, accession: a, transmitter: tr, mechanism: mech, inhibitor: inh, clinical_use: cl, citation: ci }
}

fn ntpath(n: String, o: String, t: String, fr: String, cr: String, ci: String) -> NTPathway {
    return NTPathway { name: n, origin: o, target: t, functional_role: fr, clinical_relevance: cr, citation: ci }
}

fn clinical(tr: String, cond: String, mech: String, pharm: String, dta: String, ci: String) -> ClinicalEntry {
    return ClinicalEntry { transmitter: tr, condition: cond, mechanism: mech, pharmacotherapy: pharm, drug_target_accession: dta, citation: ci }
}


// ═══════════════════════════════════════════════════════
// SECTION ONE: DOPAMINE
// ═══════════════════════════════════════════════════════
//
// Catecholamine transmitter. Synthesis from tyrosine via
// tyrosine hydroxylase (TH, rate-limiting) and aromatic
// L-amino acid decarboxylase (AADC).
//
// Kandel 6th ed, Ch 40; Stahl 5th ed, Ch 4; Goodman & Gilman 14th ed, Ch 13

// ─── Dopamine Synthesis ───

fn dopamine_synthesis(step: Int) -> SynthesisStep {
    if step == 1 { return synth(1, "L-Tyrosine", "L-DOPA (L-3,4-dihydroxyphenylalanine)", "Tyrosine hydroxylase (TH)", "TH", "P07101", "BH4 (tetrahydrobiopterin), Fe2+, O2", true, "Nagatsu T et al. J Biol Chem 239:2910-2917, 1964. Kandel 6th ed Ch 40") }
    if step == 2 { return synth(2, "L-DOPA", "Dopamine", "Aromatic L-amino acid decarboxylase (AADC/DDC)", "DDC", "P20711", "PLP (pyridoxal 5-phosphate, vitamin B6)", false, "Christenson JG et al. PNAS 69:343-347, 1972. Goodman & Gilman 14th ed Ch 13") }
    return synth(0, "", "", "", "", "", "", false, "")
}

// ─── Dopamine Receptors ───
// D1-like family (D1, D5): Gs-coupled, increase cAMP
// D2-like family (D2, D3, D4): Gi/Go-coupled, decrease cAMP

fn dopamine_receptor(name: String) -> Receptor {
    if name == "D1" { return recep("Dopamine D1 receptor", "DRD1", "P21728", "GPCR", "Gs", "", "striatum (caudate, putamen), cortex, nucleus accumbens, olfactory tubercle", "Increases cAMP via adenylyl cyclase activation. Excitatory postsynaptic. Enhances DARPP-32 phosphorylation.", "Stahl 5th ed Ch 4. Missale C et al. Physiol Rev 78:189-225, 1998") }
    if name == "D2" { return recep("Dopamine D2 receptor", "DRD2", "P14416", "GPCR", "Gi/Go", "", "striatum, substantia nigra, VTA (autoreceptor), pituitary (lactotrophs)", "Decreases cAMP. Presynaptic autoreceptor on DA neurons. Postsynaptic inhibitory. Target of ALL antipsychotics.", "Stahl 5th ed Ch 5. Beaulieu JM, Bhaiferbach R. Pharmacol Rev 63:182-217, 2011") }
    if name == "D3" { return recep("Dopamine D3 receptor", "DRD3", "P35462", "GPCR", "Gi/Go", "", "nucleus accumbens, islands of Calleja, ventral striatum, limbic areas", "Decreases cAMP. High affinity for DA. Implicated in reward and addiction circuitry. Autoreceptor function.", "Sokoloff P et al. Nature 347:146-151, 1990") }
    if name == "D4" { return recep("Dopamine D4 receptor", "DRD4", "P21917", "GPCR", "Gi/Go", "", "prefrontal cortex, hippocampus, amygdala, retina", "Decreases cAMP. Polymorphic VNTR in exon III (48bp repeat). 7-repeat allele associated with ADHD and novelty seeking.", "Van Tol HH et al. Nature 358:149-152, 1992") }
    if name == "D5" { return recep("Dopamine D5 receptor", "DRD5", "P21918", "GPCR", "Gs", "", "hippocampus, hypothalamus, thalamus, cerebral cortex (low density)", "Increases cAMP. Ten-fold higher constitutive activity than D1. Expressed at lower levels than D1.", "Sunahara RK et al. Nature 350:614-619, 1991") }
    return recep("", "", "", "", "", "", "", "", "")
}

// ─── Dopamine Pathways ───

fn dopamine_pathway(name: String) -> NTPathway {
    if name == "mesolimbic" { return ntpath("Mesolimbic pathway", "Ventral tegmental area (VTA)", "Nucleus accumbens, amygdala, hippocampus", "Reward, motivation, reinforcement learning, pleasure. Mediates the wanting component of reward (incentive salience).", "Positive symptoms of schizophrenia (hyperactive DA). Addiction (hijacked reward). Anhedonia in depression (hypoactive DA).", "Stahl 5th ed Ch 4. Wise RA. Nat Rev Neurosci 5:483-494, 2004") }
    if name == "mesocortical" { return ntpath("Mesocortical pathway", "Ventral tegmental area (VTA)", "Prefrontal cortex (dorsolateral and ventromedial PFC)", "Executive function, working memory, attention, cognitive control, decision making.", "Negative and cognitive symptoms of schizophrenia (hypoactive DA in PFC). ADHD (PFC DA deficit). Cognitive decline in PD.", "Stahl 5th ed Ch 4. Goldman-Rakic PS. Neuron 14:477-485, 1995") }
    if name == "nigrostriatal" { return ntpath("Nigrostriatal pathway", "Substantia nigra pars compacta (SNc)", "Dorsal striatum (caudate nucleus, putamen)", "Voluntary motor control, motor planning, habit formation. Part of basal ganglia direct and indirect pathways.", "Parkinson disease (80% DA neuron loss before motor symptoms). Tardive dyskinesia (D2 blockade). Huntington disease (striatal degeneration).", "Stahl 5th ed Ch 4. Kandel 6th ed Ch 43. DeLong MR. Trends Neurosci 13:281-285, 1990") }
    if name == "tuberoinfundibular" { return ntpath("Tuberoinfundibular pathway", "Arcuate nucleus and periventricular nucleus of hypothalamus", "Median eminence, anterior pituitary (portal circulation)", "Tonic inhibition of prolactin release from lactotrophs via D2 receptors on pituitary.", "Antipsychotic-induced hyperprolactinemia (D2 blockade removes DA inhibition). Prolactinoma treatment with cabergoline (D2 agonist).", "Stahl 5th ed Ch 4. Ben-Jonathan N, Hnasko R. Endocr Rev 22:724-763, 2001") }
    return ntpath("", "", "", "", "", "")
}

// ─── Dopamine Degradation ───

fn dopamine_degradation(enzyme: String) -> DegradationPathway {
    if enzyme == "MAO-A" { return degrad("Monoamine oxidase A", "MAOA", "P21397", "Dopamine", "3,4-dihydroxyphenylacetaldehyde (DOPAL)", "Outer mitochondrial membrane (presynaptic terminal, glia)", "Moclobemide (reversible), phenelzine, tranylcypromine (irreversible)", "MAOIs for treatment-resistant depression. MAOA polymorphism associated with aggression.", "Stahl 5th ed Ch 7. Shih JC et al. Annu Rev Neurosci 22:197-217, 1999") }
    if enzyme == "MAO-B" { return degrad("Monoamine oxidase B", "MAOB", "P27338", "Dopamine", "3,4-dihydroxyphenylacetaldehyde (DOPAL)", "Outer mitochondrial membrane (glia, serotonergic neurons, platelets)", "Selegiline (deprenyl), rasagiline (irreversible selective MAO-B)", "Adjunct in early Parkinson disease. Preserves DA by blocking glial degradation.", "Goodman & Gilman 14th ed Ch 18. Youdim MB et al. Nat Rev Neurosci 7:295-309, 2006") }
    if enzyme == "COMT" { return degrad("Catechol-O-methyltransferase", "COMT", "P21964", "Dopamine (and NE, L-DOPA, catechol estrogens)", "3-methoxytyramine (3-MT)", "Cytoplasm (soluble S-COMT) and membrane (MB-COMT). Predominantly in PFC, liver, kidney", "Entacapone, tolcapone (peripheral and central COMT inhibitors)", "Adjunct in PD (extends L-DOPA half-life). Val158Met polymorphism: Val = high activity = lower PFC DA = poorer working memory.", "Goodman & Gilman 14th ed Ch 18. Weinshilboum RM et al. Annu Rev Pharmacol Toxicol 39:19-52, 1999") }
    return degrad("", "", "", "", "", "", "", "", "")
}

// ─── Dopamine Transporter ───

fn dopamine_transporter() -> Transporter {
    return transp("Dopamine transporter (DAT)", "SLC6A3", "Q01959", "Dopamine", "Na+/Cl- dependent reuptake from synaptic cleft into presynaptic terminal. Stoichiometry: 2 Na+, 1 Cl- co-transported with 1 DA.", "Cocaine (competitive blocker), amphetamine (reverses transport direction, causes DA efflux), methylphenidate (Ritalin, competitive blocker), GBR 12909 (selective)", "Methylphenidate and amphetamine for ADHD. Cocaine mechanism of action. DAT-SPECT imaging for PD diagnosis (DaTscan).", "Stahl 5th ed Ch 4. Giros B et al. Nature 379:606-612, 1996. Torres GE et al. Curr Opin Neurobiol 13:296-302, 2003")
}

// ─── Dopamine Clinical ───

fn dopamine_clinical(condition: String) -> ClinicalEntry {
    if condition == "parkinson" { return clinical("Dopamine", "Parkinson disease", "Progressive loss of dopaminergic neurons in substantia nigra pars compacta. Lewy body alpha-synuclein aggregation. Motor symptoms appear after 60-80% DA depletion.", "Levodopa/carbidopa (gold standard), DA agonists (pramipexole, ropinirole), MAO-B inhibitors (selegiline, rasagiline), COMT inhibitors (entacapone), amantadine (NMDA antagonist, anti-dyskinetic)", "P07101", "Kandel 6th ed Ch 43. Kalia LV, Lang AE. Lancet 386:896-912, 2015") }
    if condition == "schizophrenia" { return clinical("Dopamine", "Schizophrenia", "DA hypothesis: mesolimbic hyperactivity (positive symptoms: hallucinations, delusions) + mesocortical hypoactivity (negative symptoms: flat affect, avolition, cognitive deficit). Revised to glutamate-DA interaction model.", "Typical antipsychotics (haloperidol, D2 antagonist), atypical antipsychotics (clozapine, olanzapine, 5-HT2A/D2 antagonists), aripiprazole (D2 partial agonist)", "P14416", "Stahl 5th ed Ch 5. Howes OD, Kapur S. Schizophr Bull 35:549-562, 2009") }
    if condition == "addiction" { return clinical("Dopamine", "Substance use disorder / addiction", "Drugs of abuse hijack mesolimbic DA system. Cocaine blocks DAT, amphetamine reverses DAT, opioids disinhibit VTA DA neurons via GABA interneurons, nicotine activates VTA nAChRs. Chronic use downregulates D2 receptors.", "Naltrexone (opioid antagonist), buprenorphine (partial mu agonist), varenicline (partial nAChR agonist), no approved cocaine pharmacotherapy", "Q01959", "Goodman & Gilman 14th ed Ch 24. Volkow ND et al. Neuron 69:599-602, 2011") }
    if condition == "adhd" { return clinical("Dopamine", "Attention-deficit/hyperactivity disorder", "Hypofunctional DA and NE signaling in prefrontal cortex. DAT gene (SLC6A3) 10-repeat allele associated with ADHD. DRD4 7-repeat allele associated with ADHD.", "Methylphenidate (DAT/NET blocker), amphetamine salts (DAT/NET reversal + vesicular release), atomoxetine (selective NET inhibitor), guanfacine (alpha-2A agonist)", "Q01959", "Stahl 5th ed Ch 12. Faraone SV et al. Lancet 421:730-746, 2024") }
    return clinical("", "", "", "", "", "")
}


// ═══════════════════════════════════════════════════════
// SECTION TWO: SEROTONIN (5-HYDROXYTRYPTAMINE, 5-HT)
// ═══════════════════════════════════════════════════════
//
// Indolamine transmitter. Synthesis from tryptophan via
// TPH (rate-limiting) and AADC. Ninety-five percent of
// body 5-HT is in the gut (enterochromaffin cells).
//
// Kandel 6th ed, Ch 40; Stahl 5th ed, Ch 6-7; Goodman & Gilman 14th ed, Ch 15

// ─── Serotonin Synthesis ───

fn serotonin_synthesis(step: Int) -> SynthesisStep {
    if step == 1 { return synth(1, "L-Tryptophan", "5-Hydroxytryptophan (5-HTP)", "Tryptophan hydroxylase (TPH)", "TPH1 (peripheral) / TPH2 (CNS)", "P17752 (TPH1) / Q8IWU9 (TPH2)", "BH4 (tetrahydrobiopterin), Fe2+, O2", true, "Walther DJ et al. Science 299:76, 2003 (TPH2 discovery). Goodman & Gilman 14th ed Ch 15") }
    if step == 2 { return synth(2, "5-Hydroxytryptophan (5-HTP)", "Serotonin (5-HT, 5-hydroxytryptamine)", "Aromatic L-amino acid decarboxylase (AADC/DDC)", "DDC", "P20711", "PLP (pyridoxal 5-phosphate, vitamin B6)", false, "Kandel 6th ed Ch 40. Same enzyme as dopamine synthesis step two.") }
    return synth(0, "", "", "", "", "", "", false, "")
}

// ─── Serotonin Receptors ───
// Fourteen receptor subtypes in seven families (5-HT1 through 5-HT7).
// All GPCR except 5-HT3 (ligand-gated ion chan).

fn serotonin_receptor(name: String) -> Receptor {
    // 5-HT1 family: Gi/Go coupled, inhibitory
    if name == "5-HT1A" { return recep("Serotonin 5-HT1A receptor", "HTR1A", "P08908", "GPCR", "Gi/Go", "", "Raphe nuclei (somatodendritic autoreceptor), hippocampus, cortex, amygdala", "Somatodendritic autoreceptor: decreases raphe firing rate. Postsynaptic: hyperpolarization via GIRK channels. Anxiolytic target.", "Stahl 5th ed Ch 7. Albert PR et al. Philos Trans R Soc B 367:2382-2394, 2012") }
    if name == "5-HT1B" { return recep("Serotonin 5-HT1B receptor", "HTR1B", "P28222", "GPCR", "Gi/Go", "", "Basal ganglia, striatum, presynaptic terminals (terminal autoreceptor)", "Terminal autoreceptor: inhibits 5-HT release at axon terminal. Also heteroreceptor on non-serotonergic neurons. Triptan target.", "Goodman & Gilman 14th ed Ch 15. Sari Y. Neurosci Biobehav Rev 28:565-582, 2004") }
    if name == "5-HT1D" { return recep("Serotonin 5-HT1D receptor", "HTR1D", "P28221", "GPCR", "Gi/Go", "", "Trigeminal ganglion, cranial blood vessels, basal ganglia", "Inhibits trigeminal nociceptive signaling. Triptan target for migraine (constricts cranial vessels and inhibits neuropeptide release).", "Goodman & Gilman 14th ed Ch 15. Humphrey PP et al. Trends Pharmacol Sci 11:156-160, 1990") }
    if name == "5-HT1E" { return recep("Serotonin 5-HT1E receptor", "HTR1E", "P28566", "GPCR", "Gi/Go", "", "Cortex, hippocampus, caudate (low expression)", "Function poorly characterized. May modulate memory. No selective ligands in clinical use.", "Levy FO et al. FEBS Lett 296:201-206, 1992") }
    if name == "5-HT1F" { return recep("Serotonin 5-HT1F receptor", "HTR1F", "P30939", "GPCR", "Gi/Go", "", "Trigeminal ganglion, hippocampus, cortex, dorsal raphe", "Inhibits trigeminal nociception without vasoconstriction. Lasmiditan target for migraine.", "Goodman & Gilman 14th ed Ch 15. Phebus LA et al. Life Sci 61:2117-2126, 1997") }

    // 5-HT2 family: Gq coupled, excitatory (PLC, IP3, DAG)
    if name == "5-HT2A" { return recep("Serotonin 5-HT2A receptor", "HTR2A", "P28223", "GPCR", "Gq", "", "Cortex (layer V pyramidal, high density), platelets, smooth muscle, limbic areas", "Excitatory postsynaptic. Activates PLC -> IP3 + DAG. Target of atypical antipsychotics (inverse agonism). Psychedelic hallucinogens are agonists (psilocybin, LSD). Platelet aggregation.", "Stahl 5th ed Ch 5. Gonzalez-Maeso J et al. Neuron 53:439-452, 2007") }
    if name == "5-HT2B" { return recep("Serotonin 5-HT2B receptor", "HTR2B", "P41595", "GPCR", "Gq", "", "Stomach fundus, heart valves, gut, CNS (low)", "Activates PLC. Valvular heart disease when chronically stimulated (fenfluramine, ergotamine). Gut motility.", "Goodman & Gilman 14th ed Ch 15. Rothman RB et al. Circulation 102:2836-2841, 2000") }
    if name == "5-HT2C" { return recep("Serotonin 5-HT2C receptor", "HTR2C", "P28335", "GPCR", "Gq", "", "Choroid plexus (highest density), hippocampus, cortex, amygdala, striatum, hypothalamus", "Activates PLC. Modulates DA release (tonic inhibition of mesolimbic DA). Appetite regulation. Weight gain from antipsychotics (5-HT2C antagonism/inverse agonism). Lorcaserin (agonist, anti-obesity, withdrawn).", "Stahl 5th ed Ch 5. Tecott LH et al. Nature 374:542-546, 1995") }

    // 5-HT3: ligand-gated ion (the only non-GPCR serotonin receptor)
    if name == "5-HT3" { return recep("Serotonin 5-HT3 receptor (5-HT3A subunit)", "HTR3A", "P46098", "ionotropic", "none (ligand-gated cation)", "Na+, K+ (nonselective cation, some Ca2+)", "Area postrema (chemoreceptor trigger zone), vagal afferents, hippocampus, amygdala, spinal cord", "Fast excitatory postsynaptic. Cation influx causes depolarization. Emesis reflex via vagal afferents and area postrema. Ondansetron (antagonist) is gold-standard antiemetic.", "Goodman & Gilman 14th ed Ch 15. Lummis SC. J Biol Chem 287:40239-40245, 2012") }

    // 5-HT4: Gs coupled
    if name == "5-HT4" { return recep("Serotonin 5-HT4 receptor", "HTR4", "Q13639", "GPCR", "Gs", "", "GI tract (enteric neurons), hippocampus, cortex, heart atria", "Increases cAMP. Enhances GI motility (prokinetic). Enhances ACh release in hippocampus (procognitive). Prucalopride (agonist) for chronic constipation.", "Goodman & Gilman 14th ed Ch 15. Bockaert J et al. Neuropharmacology 55:922-931, 2008") }

    // 5-HT5A: Gi coupled
    if name == "5-HT5A" { return recep("Serotonin 5-HT5A receptor", "HTR5A", "P47898", "GPCR", "Gi", "", "Cortex, hippocampus, cerebellum, raphe (low expression)", "Decreases cAMP. Poorly characterized. May modulate circadian rhythms and exploratory behavior. No approved drugs targeting 5-HT5A.", "Goodman & Gilman 14th ed Ch 15. Nelson DL. Curr Drug Targets CNS Neurol Disord 3:53-58, 2004") }

    // 5-HT6: Gs coupled
    if name == "5-HT6" { return recep("Serotonin 5-HT6 receptor", "HTR6", "P50406", "GPCR", "Gs", "", "Striatum, nucleus accumbens, cortex, hippocampus, olfactory tubercle", "Increases cAMP. Modulates glutamate and GABA release. Procognitive target. Idalopirdine (antagonist, failed Phase III for Alzheimer). Clozapine has high affinity.", "Stahl 5th ed Ch 7. Maher-Edwards G et al. Alzheimers Dement 11:1163-1174, 2015") }

    // 5-HT7: Gs coupled
    if name == "5-HT7" { return recep("Serotonin 5-HT7 receptor", "HTR7", "P34969", "GPCR", "Gs", "", "Hypothalamus (SCN), thalamus, hippocampus, cortex, blood vessels", "Increases cAMP. Circadian rhythm regulation (SCN). Thermoregulation. Smooth muscle relaxation. Potential antidepressant target. Lurasidone has high 5-HT7 antagonism.", "Goodman & Gilman 14th ed Ch 15. Hedlund PB. Psychopharmacology 206:345-354, 2009") }

    return recep("", "", "", "", "", "", "", "", "")
}

// ─── Serotonin Degradation ───

fn serotonin_degradation() -> DegradationPathway {
    return degrad("Monoamine oxidase A", "MAOA", "P21397", "Serotonin (5-HT)", "5-Hydroxyindoleacetic acid (5-HIAA) via aldehyde intermediate", "Outer mitochondrial membrane (presynaptic terminal, glia)", "Moclobemide (RIMA), phenelzine, tranylcypromine (irreversible non-selective). MAO-A is the primary isoform for 5-HT degradation.", "MAOIs for treatment-resistant depression. Serotonin syndrome risk with MAOI + SSRI. Elevated urinary 5-HIAA is diagnostic marker for carcinoid syndrome.", "Stahl 5th ed Ch 7. Shih JC et al. Annu Rev Neurosci 22:197-217, 1999")
}

// ─── Serotonin Transporter ───

fn serotonin_transporter() -> Transporter {
    return transp("Serotonin transporter (SERT)", "SLC6A4", "P31645", "Serotonin (5-HT)", "Na+/Cl- dependent reuptake. Stoichiometry: 1 Na+, 1 Cl- co-transported with 1 5-HT; 1 K+ counter-transported. Electrogenic.", "SSRIs (fluoxetine, sertraline, paroxetine, citalopram, escitalopram), SNRIs (venlafaxine, duloxetine), TCAs (clomipramine), MDMA (reverses transport), cocaine (non-selective)", "SSRIs are first-line for major depression, GAD, OCD, PTSD, panic disorder, social anxiety. 5-HTTLPR polymorphism (short allele) associated with increased stress sensitivity.", "Stahl 5th ed Ch 7. Caspi A et al. Science 301:386-389, 2003 (5-HTTLPR). Blakely RD et al. J Clin Invest 123:4986-4991, 2013")
}

// ─── Serotonin Clinical ───

fn serotonin_clinical(condition: String) -> ClinicalEntry {
    if condition == "depression" { return clinical("Serotonin", "Major depressive disorder", "Monoamine hypothesis: decreased 5-HT (and NE/DA) in synaptic cleft. Tryptophan depletion worsens mood in remitted depressed patients on SSRIs. Neuroplasticity hypothesis: 5-HT promotes BDNF expression and hippocampal neurogenesis.", "SSRIs (first-line), SNRIs, TCAs, MAOIs, mirtazapine (alpha-2 antagonist + 5-HT2A/2C/3 antagonist), ketamine/esketamine (NMDA antagonist, rapid onset)", "P31645", "Stahl 5th ed Ch 6-7. Malhi GS, Mann JJ. Lancet 392:2299-2312, 2018") }
    if condition == "anxiety" { return clinical("Serotonin", "Generalized anxiety disorder", "5-HT1A partial agonism (buspirone) reduces anxiety. SSRIs increase synaptic 5-HT, downregulate postsynaptic 5-HT2A/2C over weeks (therapeutic delay explains lag). Amygdala serotonergic modulation.", "SSRIs (first-line), SNRIs (venlafaxine), buspirone (5-HT1A partial agonist), pregabalin (alpha-2-delta ligand, not serotonergic)", "P08908", "Stahl 5th ed Ch 9. Baldwin DS et al. Int J Neuropsychopharmacol 17:445-468, 2014") }
    if condition == "migraine" { return clinical("Serotonin", "Migraine", "Trigeminovascular activation. Calcitonin gene-related peptide (CGRP) release from trigeminal afferents. 5-HT1B/1D agonism constricts cranial vessels and inhibits CGRP release. 5-HT1F agonism inhibits trigeminal nociception without vasoconstriction.", "Triptans (sumatriptan, rizatriptan: 5-HT1B/1D agonists), lasmiditan (5-HT1F agonist, no vasoconstriction), CGRP mAbs (erenumab, fremanezumab), gepants (rimegepant, ubrogepant: CGRP antagonists)", "P28222", "Goodman & Gilman 14th ed Ch 15. Goadsby PJ et al. N Engl J Med 377:2515-2523, 2017") }
    if condition == "carcinoid" { return clinical("Serotonin", "Carcinoid syndrome", "Neuroendocrine tumors (enterochromaffin cell origin) secrete massive 5-HT into systemic circulation. Flushing, diarrhea, bronchoconstriction, right-sided valvular heart disease (5-HT2B-mediated fibrosis).", "Octreotide (somatostatin analog, inhibits tumor hormone secretion), telotristat ethyl (TPH inhibitor, reduces peripheral 5-HT synthesis), surgical resection. Urinary 5-HIAA > 25 mg/24h diagnostic.", "P17752", "Goodman & Gilman 14th ed Ch 15. Rubin de Celis Ferrari AC et al. Cancer Treat Rev 55:129-138, 2017") }
    return clinical("", "", "", "", "", "")
}


// ═══════════════════════════════════════════════════════
// SECTION THREE: NOREPINEPHRINE (NORADRENALINE)
// ═══════════════════════════════════════════════════════
//
// Catecholamine transmitter. Synthesized from dopamine by
// dopamine beta-hydroxylase (DBH) inside synaptic vesicles.
//
// Kandel 6th ed, Ch 40; Stahl 5th ed, Ch 6; Goodman & Gilman 14th ed, Ch 12

// ─── Norepinephrine Synthesis ───

fn norepinephrine_synthesis(step: Int) -> SynthesisStep {
    // Steps one and two are shared with dopamine (tyrosine -> L-DOPA -> DA)
    if step == 1 { return synth(1, "L-Tyrosine", "L-DOPA", "Tyrosine hydroxylase (TH)", "TH", "P07101", "BH4, Fe2+, O2", true, "Same as dopamine step one. Kandel 6th ed Ch 40") }
    if step == 2 { return synth(2, "L-DOPA", "Dopamine", "AADC (DDC)", "DDC", "P20711", "PLP (vitamin B6)", false, "Same as dopamine step two. Goodman & Gilman 14th ed Ch 12") }
    if step == 3 { return synth(3, "Dopamine", "Norepinephrine", "Dopamine beta-hydroxylase (DBH)", "DBH", "P09172", "Ascorbate (vitamin C), Cu2+, O2. Reaction occurs INSIDE synaptic vesicles (DBH is a vesicular enzyme).", false, "Goodman & Gilman 14th ed Ch 12. Kaufman S, Friedman S. Pharmacol Rev 17:71-100, 1965") }
    return synth(0, "", "", "", "", "", "", false, "")
}

// ─── Norepinephrine Receptors (Adrenergic) ───

fn adrenergic_receptor(name: String) -> Receptor {
    // Alpha-1: Gq coupled, excitatory (PLC -> IP3 + DAG -> Ca2+ release)
    if name == "alpha1A" { return recep("Alpha-1A adrenergic receptor", "ADRA1A", "P35348", "GPCR", "Gq", "", "Prostate, lower urinary tract, blood vessels, heart, cerebral cortex", "Vasoconstriction (smooth muscle contraction), mydriasis, urethral contraction. Tamsulosin (antagonist) for BPH.", "Goodman & Gilman 14th ed Ch 12. Hieble JP et al. Pharmacol Rev 47:267-270, 1995") }
    if name == "alpha1B" { return recep("Alpha-1B adrenergic receptor", "ADRA1B", "P35368", "GPCR", "Gq", "", "Liver, spleen, blood vessels, cortex, brainstem", "Vasoconstriction, glycogenolysis (liver), smooth muscle contraction.", "Goodman & Gilman 14th ed Ch 12. Graham RM et al. Circ Res 78:737-749, 1996") }
    if name == "alpha1D" { return recep("Alpha-1D adrenergic receptor", "ADRA1D", "P25100", "GPCR", "Gq", "", "Aorta, coronary arteries, bladder, prostate, cortex, hippocampus", "Vasoconstriction (major mediator of aortic contraction).", "Goodman & Gilman 14th ed Ch 12") }

    // Alpha-2: Gi/Go coupled, inhibitory (decreases cAMP)
    if name == "alpha2A" { return recep("Alpha-2A adrenergic receptor", "ADRA2A", "P08913", "GPCR", "Gi/Go", "", "Locus coeruleus (presynaptic autoreceptor), brainstem, cortex (PFC), spinal cord, pancreatic beta cells", "Presynaptic autoreceptor: inhibits NE release. PFC postsynaptic: enhances working memory at low NE (inverted U). Sedation, analgesia, sympatholytic. Clonidine and guanfacine are agonists.", "Stahl 5th ed Ch 12. Arnsten AF. Nat Rev Neurosci 8:429-437, 2007") }
    if name == "alpha2B" { return recep("Alpha-2B adrenergic receptor", "ADRA2B", "P18089", "GPCR", "Gi/Go", "", "Thalamus, vascular smooth muscle, kidney, liver", "Vasoconstriction (postjunctional in some vascular beds). Salt-dependent hypertension.", "Goodman & Gilman 14th ed Ch 12") }
    if name == "alpha2C" { return recep("Alpha-2C adrenergic receptor", "ADRA2C", "P18825", "GPCR", "Gi/Go", "", "Basal ganglia (striatum), cortex, hippocampus, presynaptic (modulates DA/NE release)", "Presynaptic modulation of DA and NE release. Deletion variant associated with heart failure risk.", "Goodman & Gilman 14th ed Ch 12. Small KM et al. N Engl J Med 347:1135-1142, 2002") }

    // Beta-1: Gs coupled (increases cAMP)
    if name == "beta1" { return recep("Beta-1 adrenergic receptor", "ADRB1", "P08588", "GPCR", "Gs", "", "Heart (SA node, AV node, ventricular myocytes), kidney (juxtaglomerular cells)", "Increases heart rate (chronotropy), contractility (inotropy), conduction velocity (dromotropy), renin release. Beta-blockers (metoprolol, atenolol) for hypertension, heart failure, arrhythmia.", "Goodman & Gilman 14th ed Ch 12. Brodde OE. Pharmacol Ther 47:1-28, 1990") }

    // Beta-2: Gs coupled
    if name == "beta2" { return recep("Beta-2 adrenergic receptor", "ADRB2", "P07550", "GPCR", "Gs", "", "Bronchial smooth muscle, uterus, vascular smooth muscle (skeletal muscle beds), liver, skeletal muscle", "Bronchodilation, vasodilation, glycogenolysis, uterine relaxation. Albuterol (salbutamol, agonist) for asthma. Salmeterol, formoterol (long-acting). Propranolol (non-selective beta antagonist).", "Goodman & Gilman 14th ed Ch 12. Johnson M. J Allergy Clin Immunol 117:18-24, 2006") }

    // Beta-3: Gs coupled
    if name == "beta3" { return recep("Beta-3 adrenergic receptor", "ADRB3", "P13945", "GPCR", "Gs", "", "Adipose tissue (brown and white), bladder detrusor muscle, GI tract", "Lipolysis and thermogenesis (brown fat UCP1 induction). Bladder relaxation. Mirabegron (agonist) for overactive bladder.", "Goodman & Gilman 14th ed Ch 12. Emorine LJ et al. Science 245:1118-1121, 1989") }

    return recep("", "", "", "", "", "", "", "", "")
}

// ─── Norepinephrine Degradation ───

fn norepinephrine_degradation(enzyme: String) -> DegradationPathway {
    if enzyme == "MAO-A" { return degrad("Monoamine oxidase A", "MAOA", "P21397", "Norepinephrine", "3,4-dihydroxymandelic acid (DHMA, via aldehyde intermediate)", "Outer mitochondrial membrane", "Moclobemide, phenelzine, tranylcypromine", "MAOIs for depression. NE is preferentially degraded by MAO-A (not MAO-B).", "Goodman & Gilman 14th ed Ch 12") }
    if enzyme == "COMT" { return degrad("Catechol-O-methyltransferase", "COMT", "P21964", "Norepinephrine", "Normetanephrine (NMN)", "Cytoplasm (postsynaptic, glia, liver). Especially important in PFC where NET expression is low.", "Entacapone, tolcapone", "Plasma normetanephrine elevated in pheochromocytoma (COMT product). Val158Met polymorphism affects PFC catecholamine levels.", "Goodman & Gilman 14th ed Ch 12. Weinshilboum RM. Annu Rev Pharmacol Toxicol 39:19-52, 1999") }
    return degrad("", "", "", "", "", "", "", "", "")
}

// ─── Norepinephrine Transporter ───

fn norepinephrine_transporter() -> Transporter {
    return transp("Norepinephrine transporter (NET)", "SLC6A2", "P23975", "Norepinephrine (also takes up dopamine in PFC where DAT is sparse)", "Na+/Cl- dependent reuptake. Also transports DA in PFC (NET has similar affinity for DA and NE).", "Atomoxetine (selective NET inhibitor), reboxetine, desipramine/nortriptyline (TCAs), venlafaxine/duloxetine (SNRIs at higher doses), cocaine (non-selective), amphetamine (reversal)", "Atomoxetine for ADHD (non-stimulant). SNRIs for depression, neuropathic pain, fibromyalgia. NET blockade in PFC increases both NE and DA (since NET clears DA there).", "Stahl 5th ed Ch 6. Pacholczyk T et al. Nature 350:350-354, 1991")
}

// ─── Norepinephrine Clinical ───

fn norepinephrine_clinical(condition: String) -> ClinicalEntry {
    if condition == "snri_depression" { return clinical("Norepinephrine", "Depression (NE component)", "Dual 5-HT + NE reuptake inhibition. NE deficiency associated with fatigue, psychomotor retardation, poor concentration, apathy. NE system originates in locus coeruleus (LC) with diffuse cortical projections.", "Venlafaxine (SNRI), duloxetine (SNRI), desvenlafaxine. TCAs: desipramine (relatively NET-selective), amitriptyline (mixed).", "P23975", "Stahl 5th ed Ch 6. Ressler KJ, Nemeroff CB. Biol Psychiatry 46:1219-1233, 1999") }
    if condition == "clonidine" { return clinical("Norepinephrine", "Hypertension, ADHD, opioid withdrawal, PTSD nightmares", "Alpha-2A agonism in brainstem (nucleus tractus solitarius) reduces sympathetic outflow. In PFC alpha-2A agonism strengthens working memory networks (HCN channel closure on dendritic spines).", "Clonidine (alpha-2 agonist, non-selective), guanfacine (alpha-2A selective, preferred for ADHD and PTSD)", "P08913", "Arnsten AF. Nat Rev Neurosci 8:429-437, 2007. Goodman & Gilman 14th ed Ch 12") }
    if condition == "prazosin" { return clinical("Norepinephrine", "PTSD nightmares, BPH, hypertension", "Alpha-1 antagonism reduces nightmare frequency in PTSD (noradrenergic hyperarousal during REM sleep). Also relaxes prostate smooth muscle (alpha-1A) for BPH.", "Prazosin (alpha-1 antagonist, for PTSD nightmares), tamsulosin (alpha-1A selective, for BPH), doxazosin (for hypertension)", "P35348", "Raskind MA et al. Am J Psychiatry 160:371-373, 2003. Goodman & Gilman 14th ed Ch 12") }
    return clinical("", "", "", "", "", "")
}


// ═══════════════════════════════════════════════════════
// SECTION FOUR: ACETYLCHOLINE (ACh)
// ═══════════════════════════════════════════════════════
//
// The first neurotransmitter discovered (Loewi 1921).
// Used at NMJ, autonomic ganglia, parasympathetic postganglionic,
// and CNS (basal forebrain cholinergic system).
//
// Kandel 6th ed, Ch 15 & 40; Goodman & Gilman 14th ed, Ch 9-11

// ─── Acetylcholine Synthesis ───

fn acetylcholine_synthesis() -> SynthesisStep {
    return synth(1, "Choline + Acetyl-CoA", "Acetylcholine (ACh)", "Choline acetyltransferase (ChAT)", "CHAT", "P28329", "Acetyl-CoA (from mitochondrial pyruvate dehydrogenase). Choline from diet (essential nutrient) or recycled from synaptic ACh hydrolysis. Synthesis occurs in cytoplasm; ACh loaded into vesicles by VAChT (SLC18A3, Q16572).", false, "Kandel 6th ed Ch 15. Nachmansohn D, Machado AL. J Neurophysiol 6:397-403, 1943")
}

// ─── Acetylcholine Receptors ───
// Two families: nicotinic (ionotropic) and muscarinic (GPCR)

fn acetylcholine_receptor(name: String) -> Receptor {
    // Nicotinic receptors (ligand-gated ion): pentameric, Na+/K+ (some Ca2+)
    if name == "nAChR_muscle" { return recep("Nicotinic AChR, muscle type (alpha1-2/beta1/delta/epsilon)", "CHRNA1", "P02708", "ionotropic", "none (ligand-gated cation)", "Na+, K+, Ca2+ (non-selective cation)", "Neuromuscular junction (motor end plate)", "Fast excitatory. End plate potential (EPP) triggers muscle AP. Succinylcholine (depolarizing blocker). Tubocurarine, vecuronium (competitive non-depolarizing blockers). Target in myasthenia gravis (autoantibodies).", "Kandel 6th ed Ch 15. Unwin N. J Mol Biol 346:967-989, 2005") }
    if name == "nAChR_ganglionic" { return recep("Nicotinic AChR, ganglionic type (alpha3/beta4)", "CHRNA3", "P32297", "ionotropic", "none (ligand-gated cation)", "Na+, K+, Ca2+", "Autonomic ganglia (sympathetic and parasympathetic), adrenal medulla", "Fast synaptic transmission at all autonomic ganglia. Hexamethonium (ganglion blocker, historical). Trimethaphan.", "Goodman & Gilman 14th ed Ch 11. Sargent PB. Annu Rev Neurosci 16:403-443, 1993") }
    if name == "nAChR_CNS" { return recep("Nicotinic AChR, CNS type (alpha4/beta2 predominant)", "CHRNA4", "P43681", "ionotropic", "none (ligand-gated cation)", "Na+, K+, Ca2+ (high Ca2+ permeability for alpha7)", "Cortex, hippocampus, thalamus, VTA, striatum. Alpha7 subtype high in hippocampus.", "Cognitive enhancement, attention, reward. Nicotine addiction via VTA alpha4beta2. Varenicline (partial agonist, smoking cessation). Alpha7 agonists in clinical trials for schizophrenia cognition.", "Stahl 5th ed Ch 14. Changeux JP. Nat Rev Neurosci 19:383-399, 2018") }

    // Muscarinic receptors (GPCR, metabotropic)
    if name == "M1" { return recep("Muscarinic M1 receptor", "CHRM1", "P11229", "GPCR", "Gq", "", "Cortex, hippocampus, striatum, autonomic ganglia", "Excitatory. Activates PLC -> IP3 + DAG. Cognitive function (memory, learning). M1 agonists pursued for Alzheimer (xanomeline). Scopolamine blockade causes cognitive impairment.", "Goodman & Gilman 14th ed Ch 9. Scarr E. CNS Drug Rev 12:340-354, 2006") }
    if name == "M2" { return recep("Muscarinic M2 receptor", "CHRM2", "P08172", "GPCR", "Gi/Go", "", "Heart (SA node, AV node, atria), presynaptic autoreceptor on cholinergic terminals, brainstem", "Decreases heart rate (negative chronotropy), AV conduction (negative dromotropy) via GIRK channel activation. Presynaptic autoreceptor inhibits ACh release.", "Goodman & Gilman 14th ed Ch 9. Caulfield MP, Birdsall NJ. Pharmacol Rev 50:279-290, 1998") }
    if name == "M3" { return recep("Muscarinic M3 receptor", "CHRM3", "P20309", "GPCR", "Gq", "", "Smooth muscle (GI, bronchial, bladder detrusor, iris sphincter), exocrine glands (salivary, lacrimal, sweat), vascular endothelium", "Smooth muscle contraction, glandular secretion, endothelial NO release (vasodilation). Tiotropium (M3 antagonist, inhaled for COPD). Oxybutynin (antagonist, overactive bladder). Pilocarpine (agonist, glaucoma, dry mouth).", "Goodman & Gilman 14th ed Ch 9") }
    if name == "M4" { return recep("Muscarinic M4 receptor", "CHRM4", "P08173", "GPCR", "Gi/Go", "", "Striatum (high density), cortex, hippocampus", "Decreases cAMP. Inhibits DA release in striatum. M4 positive allosteric modulators (PAMs) pursued as antipsychotics without D2 blockade side effects.", "Stahl 5th ed Ch 5. Byun NE et al. Neuropsychopharmacology 39:1620-1630, 2014") }
    if name == "M5" { return recep("Muscarinic M5 receptor", "CHRM5", "P08912", "GPCR", "Gq", "", "VTA dopamine neurons, substantia nigra, cerebral blood vessels, salivary glands", "Activates PLC. On VTA DA neurons: facilitates DA release (modulates reward). Cerebral vasodilation. Only muscarinic subtype on VTA DA neurons.", "Goodman & Gilman 14th ed Ch 9. Yamada M et al. Life Sci 68:2603-2613, 2001") }

    return recep("", "", "", "", "", "", "", "", "")
}

// ─── Acetylcholine Degradation ───

fn acetylcholine_degradation() -> DegradationPathway {
    return degrad("Acetylcholinesterase (AChE)", "ACHE", "P22303", "Acetylcholine", "Choline + Acetate (choline recycled by high-affinity choline transporter CHT1, SLC5A7 Q9GZV3)", "Synaptic cleft (anchored to basal lamina at NMJ, synaptic membrane in CNS). One of the fastest enzymes known: turnover ~25000 ACh/sec.", "Donepezil, rivastigmine, galantamine (reversible, for Alzheimer). Pyridostigmine, neostigmine (reversible, for myasthenia gravis). Organophosphates (sarin, VX: irreversible, nerve agents). Pralidoxime (2-PAM, reactivator for OP poisoning if given early).", "Donepezil for Alzheimer (mild-moderate). Neostigmine to reverse neuromuscular blockade. Atropine + pralidoxime for OP poisoning.", "Kandel 6th ed Ch 15. Sussman JL et al. Science 253:872-879, 1991. Taylor P. J Biol Chem 266:4025-4028, 1991")
}

// ─── Acetylcholine Clinical ───

fn acetylcholine_clinical(condition: String) -> ClinicalEntry {
    if condition == "myasthenia_gravis" { return clinical("Acetylcholine", "Myasthenia gravis", "Autoimmune destruction of nicotinic AChR at NMJ. Anti-AChR antibodies (IgG) cause complement-mediated lysis, cross-linking and endocytosis of receptors, and direct functional block. Reduces EPP below AP threshold. Fatigable weakness.", "Pyridostigmine (AChE inhibitor, symptomatic). Immunosuppression (prednisone, azathioprine, mycophenolate). Thymectomy. Rituximab. Eculizumab (complement C5 inhibitor). IVIG/plasmapheresis for crisis.", "P02708", "Goodman & Gilman 14th ed Ch 10. Gilhus NE. N Engl J Med 375:2570-2581, 2016") }
    if condition == "alzheimer" { return clinical("Acetylcholine", "Alzheimer disease (cholinergic component)", "Cholinergic hypothesis: degeneration of basal forebrain cholinergic neurons (nucleus basalis of Meynert) projecting to cortex and hippocampus. Loss of ChAT activity correlates with cognitive decline. Amyloid and tau pathology are primary; cholinergic loss is downstream.", "Donepezil (AChE inhibitor, most prescribed). Rivastigmine (AChE + BuChE inhibitor, patch). Galantamine (AChE inhibitor + nAChR allosteric modulator). Symptomatic only. Lecanemab, donanemab (anti-amyloid mAbs) target disease mechanism.", "P22303", "Stahl 5th ed Ch 13. Bartus RT et al. Science 217:408-414, 1982. Birks J. Cochrane Database Syst Rev CD005593, 2006") }
    if condition == "organophosphate" { return clinical("Acetylcholine", "Organophosphate poisoning", "Irreversible AChE inhibition causes ACh accumulation at all cholinergic synapses. Muscarinic crisis: SLUDGE/BBB (salivation, lacrimation, urination, defecation, GI distress, emesis / bradycardia, bronchospasm, bronchorrhea). Nicotinic: fasciculations then paralysis. CNS: seizures, coma.", "Atropine (muscarinic antagonist, high doses, titrate to secretions). Pralidoxime (2-PAM, AChE reactivator, must give before aging of enzyme-OP complex). Benzodiazepines (diazepam for seizures).", "P22303", "Goodman & Gilman 14th ed Ch 10. Eddleston M et al. Lancet 371:597-607, 2008") }
    if condition == "succinylcholine" { return clinical("Acetylcholine", "Neuromuscular blockade (succinylcholine)", "Depolarizing NMJ blocker. Phase I: persistent depolarization of motor end plate (mimics ACh but not hydrolyzed by AChE). Phase II: desensitization block with prolonged use. Rapid onset (45-60 sec), ultra-short duration (5-10 min). Hydrolyzed by plasma cholinesterase (BChE/BCHE P06276).", "Succinylcholine (depolarizing blocker for rapid sequence intubation). Butyrylcholinesterase deficiency (atypical pseudocholinesterase, BCHE variants) causes prolonged paralysis (hours instead of minutes).", "P02708", "Goodman & Gilman 14th ed Ch 11. Naguib M et al. Anesthesiology 96:202-231, 2002") }
    return clinical("", "", "", "", "", "")
}


// ═══════════════════════════════════════════════════════
// SECTION FIVE: GABA (GAMMA-AMINOBUTYRIC ACID)
// ═══════════════════════════════════════════════════════
//
// Principal inhibitory transmitter of the CNS. Synthesized
// from glutamate by glutamic acid decarboxylase (GAD).
// GABA-A: ionotropic (Cl- channel). GABA-B: metabotropic (Gi).
//
// Kandel 6th ed, Ch 12; Stahl 5th ed, Ch 9; Goodman & Gilman 14th ed, Ch 17

// ─── GABA Synthesis ───

fn gaba_synthesis() -> SynthesisStep {
    return synth(1, "L-Glutamate", "GABA (gamma-aminobutyric acid)", "Glutamic acid decarboxylase (GAD)", "GAD1 (GAD67, constitutive) / GAD2 (GAD65, nerve terminal)", "Q99259 (GAD67) / Q05329 (GAD65)", "PLP (pyridoxal 5-phosphate, vitamin B6). B6 deficiency causes seizures (inadequate GABA synthesis). GAD67 constitutive; GAD65 activity-regulated at nerve terminals.", true, "Kandel 6th ed Ch 12. Erlander MG et al. Neuron 7:91-100, 1991")
}

// ─── GABA Receptors ───

fn gaba_receptor(name: String) -> Receptor {
    if name == "GABA-A" { return recep("GABA-A receptor (heteropentamer, most common: alpha1/beta2/gamma2)", "GABRA1 (alpha1 subunit)", "P14867", "ionotropic", "none (ligand-gated anion)", "Cl- (permeable, inhibitory hyperpolarization)", "Ubiquitous CNS. Alpha1: cortex, cerebellum (sedation). Alpha2: limbic (anxiolysis). Alpha3: brainstem (muscle relaxation). Alpha5: hippocampus (memory).", "Cl- influx hyperpolarizes postsynaptic membrane (IPSPs). Benzodiazepine binding site at alpha/gamma interface (positive allosteric modulator, increases GABA affinity and Cl- channel opening frequency). Barbiturate site on beta subunit (increases open duration). Ethanol site. Neurosteroid site (allopregnanolone, brexanolone for PPD).", "Stahl 5th ed Ch 9. Sigel E, Steinmann ME. J Biol Chem 287:40224-40231, 2012. Olsen RW, Sieghart W. Neuropharmacology 56:218-229, 2009") }
    if name == "GABA-B" { return recep("GABA-B receptor (obligate heterodimer: GABABR1/GABABR2)", "GABBR1 (R1) / GABBR2 (R2)", "Q9UBS5 (R1) / O75899 (R2)", "GPCR", "Gi/Go", "", "Cortex, thalamus, cerebellum, spinal cord, hippocampus. Presynaptic (autoreceptor and heteroreceptor) and postsynaptic.", "Presynaptic: inhibits voltage-gated Ca2+ channels -> reduces transmitter release. Postsynaptic: activates GIRK K+ channels -> slow IPSP (hyperpolarization). Baclofen (agonist) for spasticity, GHB is GABA-B agonist at high concentrations.", "Goodman & Gilman 14th ed Ch 17. Bettler B et al. Physiol Rev 84:835-867, 2004") }
    if name == "GABA-A-rho" { return recep("GABA-A-rho receptor (formerly GABA-C, homomeric rho subunits)", "GABRR1", "P24046", "ionotropic", "none (ligand-gated anion)", "Cl-", "Retina (bipolar cells), superior colliculus, hippocampus", "Cl- channel, but NOT modulated by benzodiazepines, barbiturates, or neurosteroids. Higher GABA sensitivity and slower kinetics than GABA-A. TPMPA is selective antagonist.", "Enz R, Bhiting GR. Trends Neurosci 24:137-139, 2001") }
    return recep("", "", "", "", "", "", "", "", "")
}

// ─── GABA Degradation ───

fn gaba_degradation() -> DegradationPathway {
    return degrad("GABA transaminase (GABA-T)", "ABAT", "P80404", "GABA", "Succinic semialdehyde (then to succinate via SSADH, entering TCA cycle)", "Mitochondrial matrix (neurons and glia). Part of the GABA shunt: glutamate -> GABA -> succinic semialdehyde -> succinate -> (TCA cycle) -> alpha-ketoglutarate -> glutamate.", "Vigabatrin (gamma-vinyl-GABA, irreversible inhibitor, suicide substrate). Raises brain GABA levels.", "Vigabatrin for infantile spasms (West syndrome, first-line) and refractory complex partial seizures. Side effect: irreversible concentric visual field defects (retinal toxicity, peripheral vision loss).", "Goodman & Gilman 14th ed Ch 17. Yogeeswari P et al. Curr Drug Metab 6:127-139, 2005")
}

// ─── GABA Transporter ───

fn gaba_transporter(name: String) -> Transporter {
    if name == "GAT1" { return transp("GABA transporter type-1 (GAT-1)", "SLC6A1", "P30531", "GABA", "Na+/Cl- dependent reuptake from synaptic cleft. Stoichiometry: 2 Na+, 1 Cl- co-transported with 1 GABA. Primary mechanism of GABA clearance in CNS.", "Tiagabine (selective GAT-1 inhibitor)", "Tiagabine for adjunctive treatment of partial seizures. Raises synaptic GABA by blocking reuptake. SLC6A1 mutations cause myoclonic-atonic epilepsy.", "Goodman & Gilman 14th ed Ch 17. Conti F et al. J Histochem Cytochem 52:1093-1105, 2004") }
    if name == "GAT3" { return transp("GABA transporter type-3 (GAT-3)", "SLC6A11", "P48066", "GABA", "Na+/Cl- dependent reuptake. Predominantly glial (astrocytic). Complements GAT-1 neuronal uptake.", "None in clinical use", "GAT-3 expressed mainly in astrocytes. Contributes to GABA clearance especially at high synaptic GABA concentrations.", "Goodman & Gilman 14th ed Ch 17") }
    return transp("", "", "", "", "", "", "", "")
}

// ─── GABA Clinical ───

fn gaba_clinical(condition: String) -> ClinicalEntry {
    if condition == "benzodiazepines" { return clinical("GABA", "Anxiety, insomnia, seizures, alcohol withdrawal, procedural sedation", "Benzodiazepines are positive allosteric modulators (PAMs) at GABA-A receptor alpha/gamma interface. Increase frequency of Cl- channel opening in response to GABA. Do NOT directly open the pore (require GABA). Subtype selectivity: alpha1 = sedation, alpha2 = anxiolysis, alpha3 = muscle relaxation.", "Diazepam (long-acting, alcohol withdrawal, status epilepticus). Lorazepam (intermediate, SE first-line IV). Alprazolam (short-acting, panic, high abuse potential). Midazolam (ultra-short, procedural sedation). Flumazenil (competitive antagonist, reversal agent).", "P14867", "Stahl 5th ed Ch 9. Rudolph U, Knoflach F. Nat Rev Drug Discov 10:685-697, 2011") }
    if condition == "barbiturates" { return clinical("GABA", "Anesthesia, refractory status epilepticus", "Barbiturates bind GABA-A receptor beta subunit. At low doses: positive allosteric modulator (increase Cl- channel open duration). At high doses: directly gate the Cl- channel WITHOUT GABA. This is why barbiturate overdose causes fatal respiratory depression (benzos do not directly gate).", "Phenobarbital (long-acting, seizures, neonatal). Thiopental (ultra-short, induction of anesthesia, now largely replaced). Pentobarbital (refractory SE in ICU). Low therapeutic index.", "P14867", "Goodman & Gilman 14th ed Ch 17. Macdonald RL, Olsen RW. Annu Rev Neurosci 17:569-602, 1994") }
    if condition == "epilepsy" { return clinical("GABA", "Epilepsy (GABAergic mechanisms)", "Seizures result from excitation/inhibition imbalance. GABA enhancement is a major antiepileptic strategy. GAD mutations (GAD65 antibody in stiff person syndrome and autoimmune epilepsy). GABA-A receptor mutations cause genetic epilepsy (Dravet: SCN1A on inhibitory interneurons).", "Vigabatrin (GABA-T inhibitor), tiagabine (GAT-1 inhibitor), valproate (multiple mechanisms including GABA enhancement), benzodiazepines, phenobarbital, gabapentin/pregabalin (alpha-2-delta ligand, indirectly enhances GABA), topiramate (multiple including GABA-A PAM at non-BZD site)", "P14867", "Goodman & Gilman 14th ed Ch 17. Meldrum BS, Rogawski MA. Neurotherapeutics 4:18-61, 2007") }
    return clinical("", "", "", "", "", "")
}


// ═══════════════════════════════════════════════════════
// SECTION SIX: GLUTAMATE
// ═══════════════════════════════════════════════════════
//
// Principal excitatory transmitter of the CNS. Every
// cortical projection neuron is glutamatergic. Three
// ionotropic receptor families (NMDA, AMPA, kainate) and
// eight metabotropic receptors (mGluR1-8).
//
// Kandel 6th ed, Ch 12-13; Goodman & Gilman 14th ed, Ch 17

// ─── Glutamate Synthesis ───

fn glutamate_synthesis(step: Int) -> SynthesisStep {
    if step == 1 { return synth(1, "Glutamine", "Glutamate", "Glutaminase (phosphate-activated glutaminase, PAG)", "GLS (kidney-type) / GLS2 (liver-type)", "O94925 (GLS) / Q9UI32 (GLS2)", "Phosphate activation. Occurs in neuronal mitochondria. Glutamine supplied by astrocytes (glutamate-glutamine cycle).", true, "Kandel 6th ed Ch 12. Kvamme E et al. Neurochem Res 26:885-898, 2001") }
    if step == 2 { return synth(2, "Alpha-ketoglutarate (TCA cycle intermediate)", "Glutamate", "Aspartate aminotransferase (AAT, also called glutamic-oxaloacetic transaminase GOT)", "GOT2 (mitochondrial)", "P00505", "PLP (vitamin B6). Transamination from aspartate to alpha-ketoglutarate. Links amino acid metabolism to TCA cycle.", false, "Kandel 6th ed Ch 12") }
    return synth(0, "", "", "", "", "", "", false, "")
}

// ─── Glutamate Receptors ───

fn glutamate_receptor(name: String) -> Receptor {
    // Ionotropic: NMDA
    if name == "NMDA" { return recep("NMDA receptor (GluN1/GluN2A-D heterotetramer)", "GRIN1 (GluN1, obligatory) / GRIN2A-D", "Q05586 (GluN1) / Q12879 (GluN2A) / Q13224 (GluN2B)", "ionotropic", "none (ligand-gated cation, voltage-dependent Mg2+ block)", "Na+, K+, Ca2+ (high Ca2+ permeability, critical for LTP)", "Ubiquitous CNS. Hippocampus (CA1: GluN2A/2B, LTP). Cortex. Striatum. Cerebellum (GluN2C).", "Requires dual agonism: glutamate (GluN2 site) + glycine/D-serine (GluN1 co-agonist site). Voltage-dependent Mg2+ block removed by depolarization (coincidence detector). Ca2+ influx triggers LTP (CaMKII activation). Ketamine, PCP, MK-801 are open-pore blockers. Memantine (low-affinity uncompetitive antagonist, Alzheimer).", "Kandel 6th ed Ch 13. Traynelis SF et al. Pharmacol Rev 62:405-496, 2010") }

    // Ionotropic: AMPA
    if name == "AMPA" { return recep("AMPA receptor (GluA1-4 heterotetramer)", "GRIA1-4", "P42261 (GluA1) / P42262 (GluA2) / P42263 (GluA3) / P48058 (GluA4)", "ionotropic", "none (ligand-gated cation)", "Na+, K+ (Ca2+ permeable if GluA2 absent: RNA editing Q/R site)", "Ubiquitous CNS. Mediates majority of fast excitatory transmission.", "Fast EPSPs (sub-millisecond kinetics). GluA2 subunit RNA editing (Q -> R) blocks Ca2+ permeability (edited in virtually all adult neurons). LTP expression partly via AMPA receptor trafficking (insertion into postsynaptic membrane). Perampanel (antagonist, anti-epileptic).", "Kandel 6th ed Ch 12. Huganir RL, Nicoll RA. Neuron 80:704-717, 2013") }

    // Ionotropic: Kainate
    if name == "kainate" { return recep("Kainate receptor (GluK1-5)", "GRIK1-5", "P39086 (GluK1) / P39087 (GluK2) / Q13002 (GluK3) / Q16099 (GluK4) / Q16478 (GluK5)", "ionotropic", "none (ligand-gated cation)", "Na+, K+", "Hippocampus (mossy fiber-CA3 synapse), DRG (pain), cortex, amygdala", "Presynaptic: modulates glutamate and GABA release (bidirectional). Postsynaptic: EPSPs with slower kinetics than AMPA. Mossy fiber LTP. Involved in epileptogenesis (kainate injection causes seizures and hippocampal sclerosis, temporal lobe epilepsy model).", "Goodman & Gilman 14th ed Ch 17. Lerma J, Bhiques JM. Physiol Rev 93:1721-1783, 2013") }

    // Metabotropic: Group I (Gq, excitatory)
    if name == "mGluR1" { return recep("Metabotropic glutamate receptor type 1 (mGluR1)", "GRM1", "Q13255", "GPCR", "Gq", "", "Cerebellum (Purkinje cells, high density), hippocampus, thalamus", "Activates PLC -> IP3 + DAG. Postsynaptic excitation. Cerebellar LTD (with AMPA and mGluR1). Spinocerebellar ataxia when mutated.", "Kandel 6th ed Ch 12. Bhatt et al. Neuroscience 309:55-78, 2015") }
    if name == "mGluR5" { return recep("Metabotropic glutamate receptor type 5 (mGluR5)", "GRM5", "P41594", "GPCR", "Gq", "", "Cortex, hippocampus, striatum, nucleus accumbens, amygdala", "Activates PLC. Postsynaptic to NMDA (physical and functional coupling via Homer/Shank scaffolding). Enhances NMDA currents. Fragile X syndrome (excessive mGluR5 signaling). Mavoglurant (negative allosteric modulator, failed in Fragile X trials).", "Goodman & Gilman 14th ed Ch 17. Bear MF et al. Trends Neurosci 27:370-377, 2004") }

    // Metabotropic: Group II (Gi, inhibitory)
    if name == "mGluR2" { return recep("Metabotropic glutamate receptor type 2 (mGluR2)", "GRM2", "Q14416", "GPCR", "Gi/Go", "", "Cortex, hippocampus, striatum, amygdala. Presynaptic (especially glutamate terminals).", "Presynaptic autoreceptor: inhibits glutamate release. Decreases cAMP. mGluR2/3 agonists explored as novel antipsychotics and anxiolytics (pomaglumetad, failed Phase III).", "Stahl 5th ed Ch 5. Moghaddam B, Adams BW. Science 281:1349-1352, 1998") }
    if name == "mGluR3" { return recep("Metabotropic glutamate receptor type 3 (mGluR3)", "GRM3", "Q14832", "GPCR", "Gi/Go", "", "Cortex, thalamus, hippocampus. Both neuronal and glial (astrocytic) expression.", "Decreases cAMP. On astrocytes: promotes glutamate uptake and glutamine synthetase activity. Neuroprotective. GRM3 SNPs associated with schizophrenia risk (GWAS).", "Goodman & Gilman 14th ed Ch 17. Egan MF et al. PNAS 101:12604-12609, 2004") }

    // Metabotropic: Group III (Gi, inhibitory)
    if name == "mGluR4" { return recep("Metabotropic glutamate receptor type 4 (mGluR4)", "GRM4", "Q14833", "GPCR", "Gi/Go", "", "Cerebellum (parallel fiber-Purkinje cell synapse), basal ganglia (striatopallidal), presynaptic", "Presynaptic inhibition of glutamate release. Potential target for Parkinson disease (reduce overactive subthalamic output).", "Goodman & Gilman 14th ed Ch 17. Niswender CM, Bhann PJ. Annu Rev Pharmacol Toxicol 50:295-322, 2010") }
    if name == "mGluR6" { return recep("Metabotropic glutamate receptor type 6 (mGluR6)", "GRM6", "O15303", "GPCR", "Gi/Go", "", "Retina (ON bipolar cells, exclusive expression)", "Mediates ON response in retina. Glutamate released by photoreceptors in dark activates mGluR6 -> Gi closes TRPM1 cation chan -> hyperpolarization. Light reduces glutamate -> TRPM1 opens -> depolarization (ON response). Night blindness (congenital stationary, CSNB1B) when mutated.", "Kandel 6th ed Ch 26. Masu M et al. Cell 73:1393-1396, 1993") }
    if name == "mGluR7" { return recep("Metabotropic glutamate receptor type 7 (mGluR7)", "GRM7", "Q14831", "GPCR", "Gi/Go", "", "Widely distributed presynaptic. Hippocampus, cortex, amygdala", "Lowest glutamate affinity of all mGluRs (activated only during intense firing). Presynaptic inhibition as emergency brake against excessive glutamate release. Anxiety and epilepsy phenotypes in knockout mice.", "Goodman & Gilman 14th ed Ch 17. Sansig G et al. J Neurosci 21:8734-8745, 2001") }
    if name == "mGluR8" { return recep("Metabotropic glutamate receptor type 8 (mGluR8)", "GRM8", "O00222", "GPCR", "Gi/Go", "", "Lateral perforant path (hippocampus), olfactory bulb, cerebellum, retina", "Presynaptic inhibition. High affinity for glutamate. DCPG is selective agonist. Potential anxiolytic target.", "Goodman & Gilman 14th ed Ch 17. Duvoisin RM et al. J Neurosci 15:3075-3083, 1995") }

    return recep("", "", "", "", "", "", "", "", "")
}

// ─── Glutamate Reuptake (EAATs) ───

fn glutamate_transporter(name: String) -> Transporter {
    if name == "EAAT1" { return transp("Excitatory amino acid transporter 1 (EAAT1/GLAST)", "SLC1A3", "P43003", "L-Glutamate, L-Aspartate, D-Aspartate", "3 Na+ + 1 H+ co-transported with 1 glutamate; 1 K+ counter-transported. Electrogenic. Concentrates glutamate ~10000x inside cell.", "None in clinical use", "Astrocytic. Cerebellum (predominant). Episodic ataxia type 6 (SLC1A3 mutations).", "Kandel 6th ed Ch 12. Danbolt NC. Prog Neurobiol 65:1-105, 2001") }
    if name == "EAAT2" { return transp("Excitatory amino acid transporter 2 (EAAT2/GLT-1)", "SLC1A2", "P43004", "L-Glutamate", "Same stoichiometry as EAAT1. Responsible for > 90% of forebrain glutamate clearance.", "Ceftriaxone (upregulates EAAT2 expression, experimental for ALS)", "Astrocytic. Forebrain (cortex, hippocampus, striatum). Loss of EAAT2 in ALS leads to excitotoxicity. Single most important glutamate transporter in CNS.", "Rothstein JD et al. Neuron 16:675-686, 1996. Danbolt NC. Prog Neurobiol 65:1-105, 2001") }
    if name == "EAAT3" { return transp("Excitatory amino acid transporter 3 (EAAT3/EAAC1)", "SLC1A1", "P43005", "L-Glutamate, L-Cysteine (for glutathione synthesis)", "Neuronal (postsynaptic). Also transports cysteine for intracellular glutathione production (antioxidant defense).", "None in clinical use", "Neuronal. Hippocampus, cortex, cerebellum, kidney. SLC1A1 variants associated with OCD (GWAS). Dicarboxylic aminoaciduria when mutated (renal glutamate/aspartate wasting).", "Goodman & Gilman 14th ed Ch 17. Arnold PD et al. Mol Psychiatry 11:238-243, 2006") }
    if name == "EAAT4" { return transp("Excitatory amino acid transporter 4 (EAAT4)", "SLC1A6", "P48664", "L-Glutamate", "Neuronal. High Cl- conductance (functions partly as inhibitory Cl- channel gated by glutamate).", "None in clinical use", "Cerebellar Purkinje cells (very high expression). Limits glutamate spillover at climbing fiber synapses.", "Goodman & Gilman 14th ed Ch 17") }
    if name == "EAAT5" { return transp("Excitatory amino acid transporter 5 (EAAT5)", "SLC1A7", "O00341", "L-Glutamate", "Neuronal. Large Cl- conductance (inhibitory). Low transport rate.", "None in clinical use", "Retina (photoreceptors, bipolar cells). Functions primarily as glutamate-gated Cl- channel rather than transporter.", "Goodman & Gilman 14th ed Ch 17. Bhiddon AR et al. J Biol Chem 272:3703-3708, 1997") }
    return transp("", "", "", "", "", "", "", "")
}

// ─── Glutamate Clinical ───

fn glutamate_clinical(condition: String) -> ClinicalEntry {
    if condition == "excitotoxicity" { return clinical("Glutamate", "Excitotoxicity (stroke, TBI, neurodegeneration)", "Excessive glutamate release during ischemia (ATP depletion -> reversal of EAATs and failure of Na+/K+ ATPase). Sustained NMDA activation -> massive Ca2+ influx -> calpain activation, mitochondrial failure, free radical production, apoptosis. Glutamate levels rise 80-fold in ischemic penumbra.", "No approved anti-excitotoxic drugs for stroke (all NMDA antagonists failed clinical trials due to psychotomimetic side effects, narrow therapeutic window). Hypothermia (neuroprotective). Riluzole (reduces glutamate release, only approved drug for ALS).", "Q05586", "Kandel 6th ed Ch 13. Bhk DW, Bhon RL. N Engl J Med 347:1549-1556, 2002") }
    if condition == "ketamine" { return clinical("Glutamate", "Treatment-resistant depression (ketamine/esketamine)", "NMDA receptor open-pore blocker on GABA interneurons. Block of tonic NMDA input to interneurons -> disinhibition of glutamatergic pyramidal neurons -> burst of glutamate -> AMPA receptor activation -> BDNF release -> mTOR activation -> rapid synaptogenesis. Antidepressant effect in hours, not weeks.", "Esketamine (Spravato, S-enantiomer, intranasal, FDA-approved for TRD). Racemic IV ketamine (off-label, ketamine clinics). Arketamine (R-enantiomer, in clinical trials, may have fewer dissociative effects).", "Q05586", "Stahl 5th ed Ch 7. Zanos P, Gould TD. Pharmacol Rev 70:621-660, 2018") }
    if condition == "memantine" { return clinical("Glutamate", "Alzheimer disease (glutamatergic component)", "Tonic low-level NMDA activation by ambient glutamate creates noise that obscures signal (LTP/LTD). Memantine is a low-affinity, fast off-rate uncompetitive NMDA antagonist that blocks pathological tonic activation but preserves phasic synaptic signaling.", "Memantine (moderate-severe Alzheimer, often combined with donepezil). Modest benefit on cognition and function. Does not modify disease progression.", "Q05586", "Goodman & Gilman 14th ed Ch 17. Lipton SA. Nat Rev Drug Discov 5:160-170, 2006") }
    if condition == "als" { return clinical("Glutamate", "Amyotrophic lateral sclerosis (ALS)", "Motor neuron death from glutamate excitotoxicity (loss of astrocytic EAAT2/GLT-1 in spinal cord -> failure to clear synaptic glutamate). AMPA receptor-mediated Ca2+ entry (motor neurons express Ca2+-permeable AMPA-R lacking GluA2). SOD1 mutations (familial ALS) cause oxidative stress and EAAT2 downregulation.", "Riluzole (inhibits presynaptic glutamate release + blocks postsynaptic NMDA, extends survival ~3 months). Edaravone (free radical scavenger). Neither is curative.", "P43004", "Goodman & Gilman 14th ed Ch 17. Rothstein JD et al. Ann Neurol 38:73-84, 1995. Van Den Bosch L et al. Biochim Biophys Acta 1762:1068-1082, 2006") }
    return clinical("", "", "", "", "", "")
}


// ═══════════════════════════════════════════════════════
// SECTION SEVEN: OTHER NEUROTRANSMITTERS
// ═══════════════════════════════════════════════════════
//
// Glycine, histamine, endogenous opioids, endocannabinoids,
// and nitric oxide.

// ─── A. Glycine ───

struct GlycineReceptor {
    name: String,
    gene: String,
    accession: String,
    receptor_type: String,
    ion_permeability: String,
    location: String,
    function_desc: String,
    antagonist: String,
    citation: String,
}

fn glycine_receptor() -> GlycineReceptor {
    return GlycineReceptor {
        name: "Glycine receptor (alpha1/beta heteropentamer, strychnine-sensitive)",
        gene: "GLRA1 (alpha1) / GLRB (beta)",
        accession: "P23415 (alpha1) / P48167 (beta)",
        receptor_type: "ionotropic (ligand-gated Cl- channel, Cys-loop family)",
        ion_permeability: "Cl- (inhibitory hyperpolarization)",
        location: "Spinal cord (ventral horn, Renshaw cells), brainstem, retina. Principal inhibitory transmitter of spinal cord and brainstem (GABA dominates supraspinally).",
        function_desc: "Fast inhibitory postsynaptic potentials. Reciprocal inhibition (Ia inhibitory interneurons). Renshaw cell recurrent inhibition of motor neurons. Also serves as obligatory co-agonist at NMDA receptor GluN1 glycine site (distinct from strychnine-sensitive GlyR).",
        antagonist: "Strychnine (competitive antagonist, convulsant poison from Strychnos nux-vomica). Blocks spinal cord inhibition -> opisthotonus, convulsions, respiratory failure.",
        citation: "Kandel 6th ed Ch 12. Lynch JW. Physiol Rev 84:1051-1095, 2004",
    }
}

fn glycine_nmda_coagonist_note() -> String {
    return "Glycine (or D-serine, synthesized by serine racemase P56202) is required at the GluN1 co-agonist site for NMDA receptor activation. The glycine site is never fully saturated in vivo. D-cycloserine (partial agonist at glycine site) enhances NMDA function and is used as cognitive enhancer in exposure therapy for PTSD/phobias. GLYT1 (SLC6A9, P48067) clears glycine from the NMDA synapse."
}


// ─── B. Histamine ───

fn histamine_receptor(name: String) -> Receptor {
    if name == "H1" { return recep("Histamine H1 receptor", "HRH1", "P35367", "GPCR", "Gq", "", "Smooth muscle (bronchial, GI, uterine), endothelium, CNS (hypothalamus, thalamus, cortex)", "Bronchoconstriction, vasodilation (endothelial NO), increased capillary permeability, pruritus, wakefulness. First-gen antihistamines (diphenhydramine, chlorpheniramine) cross BBB -> sedation. Second-gen (loratadine, cetirizine, fexofenadine) do not cross BBB.", "Goodman & Gilman 14th ed Ch 39. Haas HL et al. Physiol Rev 88:1183-1241, 2008") }
    if name == "H2" { return recep("Histamine H2 receptor", "HRH2", "P25021", "GPCR", "Gs", "", "Gastric parietal cells (high density), heart, CNS, immune cells", "Increases cAMP. Gastric acid secretion (via H+/K+ ATPase activation). Positive inotropy and chronotropy (cardiac). H2 blockers (ranitidine, famotidine) reduce gastric acid for GERD and peptic ulcer.", "Goodman & Gilman 14th ed Ch 49. Black JW et al. Nature 236:385-390, 1972 (Nobel Prize 1988)") }
    if name == "H3" { return recep("Histamine H3 receptor", "HRH3", "Q9Y5N1", "GPCR", "Gi/Go", "", "CNS (cortex, striatum, tuberomammillary nucleus). Presynaptic autoreceptor AND heteroreceptor.", "Presynaptic autoreceptor: inhibits histamine synthesis and release. Heteroreceptor: inhibits release of ACh, NE, DA, 5-HT, glutamate, GABA. Pitolisant (H3 inverse agonist) increases wakefulness for narcolepsy (FDA approved).", "Stahl 5th ed Ch 11. Schwartz JC. Br J Pharmacol 163:713-721, 2011") }
    if name == "H4" { return recep("Histamine H4 receptor", "HRH4", "Q9H3N8", "GPCR", "Gi/Go", "", "Immune cells (eosinophils, mast cells, T cells, dendritic cells), bone marrow, spleen", "Chemotaxis of eosinophils and mast cells. Modulates cytokine release. Target for allergic and inflammatory diseases. No approved H4 drugs yet; JNJ-39758979 in clinical trials for pruritus.", "Goodman & Gilman 14th ed Ch 39. Thurmond RL et al. Nat Rev Drug Discov 7:41-53, 2008") }
    return recep("", "", "", "", "", "", "", "", "")
}

fn histamine_synthesis_note() -> String {
    return "Histamine is synthesized from L-histidine by histidine decarboxylase (HDC, P19113). PLP cofactor. Tuberomammillary nucleus (TMN) of posterior hypothalamus is the sole source of CNS histaminergic neurons. Degraded by histamine N-methyltransferase (HNMT, P50135) intracellularly, or diamine oxidase (DAO/AOC1, P19801) extracellularly."
}


// ─── C. Endogenous Opioids ───

struct OpioidPeptide {
    name: String,
    precursor: String,
    precursor_gene: String,
    precursor_accession: String,
    sequence_example: String,
    primary_receptor: String,
    citation: String,
}

fn opioid_peptide(name: String) -> OpioidPeptide {
    if name == "beta-endorphin" { return OpioidPeptide { name: "Beta-endorphin", precursor: "Proopiomelanocortin (POMC)", precursor_gene: "POMC", precursor_accession: "P01189", sequence_example: "YGGFMTSEKSQTPLVTLFKNAIIKNAYKKGE (31 aa)", primary_receptor: "Mu (MOR, highest affinity)", citation: "Kandel 6th ed Ch 24. Li CH, Chung D. PNAS 73:1145-1148, 1976" } }
    if name == "met-enkephalin" { return OpioidPeptide { name: "Met-enkephalin", precursor: "Proenkephalin", precursor_gene: "PENK", precursor_accession: "P01210", sequence_example: "YGGFM (5 aa)", primary_receptor: "Delta (DOR), Mu (MOR)", citation: "Hughes J et al. Nature 258:577-579, 1975 (discovery)" } }
    if name == "leu-enkephalin" { return OpioidPeptide { name: "Leu-enkephalin", precursor: "Proenkephalin (also prodynorphin)", precursor_gene: "PENK", precursor_accession: "P01210", sequence_example: "YGGFL (5 aa)", primary_receptor: "Delta (DOR)", citation: "Hughes J et al. Nature 258:577-579, 1975" } }
    if name == "dynorphin_A" { return OpioidPeptide { name: "Dynorphin A", precursor: "Prodynorphin (proenkephalin B)", precursor_gene: "PDYN", precursor_accession: "P01213", sequence_example: "YGGFLRRIRPKLKWDNQ (17 aa)", primary_receptor: "Kappa (KOR, highest affinity)", citation: "Goldstein A et al. PNAS 78:7219-7223, 1981" } }
    if name == "nociceptin" { return OpioidPeptide { name: "Nociceptin (orphanin FQ)", precursor: "Pronociceptin", precursor_gene: "PNOC", precursor_accession: "Q13519", sequence_example: "FGGFTGARKSARKLANQ (17 aa)", primary_receptor: "NOP (ORL1, nociceptin receptor)", citation: "Meunier JC et al. Nature 377:532-535, 1995" } }
    return OpioidPeptide { name: "", precursor: "", precursor_gene: "", precursor_accession: "", sequence_example: "", primary_receptor: "", citation: "" }
}

fn opioid_receptor(name: String) -> Receptor {
    if name == "mu" { return recep("Mu opioid receptor (MOR)", "OPRM1", "P35372", "GPCR", "Gi/Go", "", "PAG, RVM, spinal cord dorsal horn, VTA, nucleus accumbens, thalamus, locus coeruleus, GI tract (enteric neurons)", "Gi coupling: decreases cAMP, opens GIRK K+ channels (hyperpolarization), closes N-type Ca2+ channels (reduces transmitter release). Analgesia (supraspinal and spinal). Euphoria/reward (VTA DA disinhibition). Respiratory depression (pre-Botzinger complex). Constipation. Miosis. Physical dependence.", "Kandel 6th ed Ch 24. Matthes HW et al. Nature 383:819-823, 1996 (MOR knockout)") }
    if name == "delta" { return recep("Delta opioid receptor (DOR)", "OPRD1", "P41143", "GPCR", "Gi/Go", "", "Cortex, amygdala, olfactory bulb, striatum, spinal cord", "Analgesia (spinal, less supraspinal than mu). Anxiolytic-like effects. Modulates emotional processing. Less respiratory depression and abuse potential than mu.", "Goodman & Gilman 14th ed Ch 20. Pradhan AA et al. Trends Pharmacol Sci 32:581-590, 2011") }
    if name == "kappa" { return recep("Kappa opioid receptor (KOR)", "OPRK1", "P41145", "GPCR", "Gi/Go", "", "Hypothalamus, striatum, nucleus accumbens, spinal cord, periphery", "Analgesia (spinal and visceral). Dysphoria, hallucinations, sedation (unlike mu euphoria). Anti-pruritic. Diuretic. Salvinorin A (Salvia divinorum) is selective KOR agonist. KOR activation in nucleus accumbens opposes DA reward (anti-reward).", "Goodman & Gilman 14th ed Ch 20. Chavkin C. Neuropsychopharmacology 36:369-370, 2011") }
    if name == "NOP" { return recep("Nociceptin/OFQ receptor (NOP, ORL1)", "OPRL1", "P41146", "GPCR", "Gi/Go", "", "Cortex, hippocampus, amygdala, hypothalamus, spinal cord, brainstem", "Anti-opioid in some circuits (reverses mu-mediated analgesia at supraspinal level). Anxiolytic at low doses. Analgesic at spinal level. Does not respond to naloxone. Cebranopadol (NOP + mu dual agonist) in clinical trials.", "Goodman & Gilman 14th ed Ch 20. Lambert DG. Nat Rev Drug Discov 7:694-710, 2008") }
    return recep("", "", "", "", "", "", "", "", "")
}


// ─── D. Endocannabinoids ───

struct Endocannabinoid {
    name: String,
    full_name: String,
    synthesis_enzyme: String,
    synthesis_accession: String,
    degradation_enzyme: String,
    degradation_accession: String,
    primary_receptor: String,
    mechanism: String,
    citation: String,
}

fn endocannabinoid(name: String) -> Endocannabinoid {
    if name == "anandamide" { return Endocannabinoid { name: "Anandamide (AEA)", full_name: "N-arachidonoylethanolamine", synthesis_enzyme: "NAPE-PLD (N-acyl phosphatidylethanolamine phospholipase D)", synthesis_accession: "Q6NR60", degradation_enzyme: "FAAH (fatty acid amide hydrolase)", degradation_accession: "O00519", primary_receptor: "CB1 (partial agonist), CB2, TRPV1", mechanism: "Retrograde messenger. Synthesized on demand from membrane phospholipids (not stored in vesicles). Released postsynaptically, acts on presynaptic CB1 to inhibit transmitter release (DSI/DSE). Also activates TRPV1 intracellularly.", citation: "Devane WA et al. Science 258:1946-1949, 1992 (discovery). Kandel 6th ed Ch 14" } }
    if name == "2-AG" { return Endocannabinoid { name: "2-AG (2-arachidonoylglycerol)", full_name: "2-arachidonoylglycerol", synthesis_enzyme: "DAGL-alpha (diacylglycerol lipase alpha)", synthesis_accession: "Q9Y4D2", degradation_enzyme: "MAGL (monoacylglycerol lipase)", degradation_accession: "Q99884", primary_receptor: "CB1 (full agonist), CB2 (full agonist)", mechanism: "Major endocannabinoid in brain (levels ~170x higher than anandamide). Full agonist at CB1 and CB2. Retrograde signaling: postsynaptic Gq activation (mGluR5, M1) -> PLC -> DAG -> DAGL -> 2-AG -> crosses synapse -> presynaptic CB1 -> Gi -> inhibits Ca2+ channels -> reduces transmitter release.", citation: "Sugiura T et al. Biochem Biophys Res Commun 215:89-97, 1995. Kandel 6th ed Ch 14" } }
    return Endocannabinoid { name: "", full_name: "", synthesis_enzyme: "", synthesis_accession: "", degradation_enzyme: "", degradation_accession: "", primary_receptor: "", mechanism: "", citation: "" }
}

fn cannabinoid_receptor(name: String) -> Receptor {
    if name == "CB1" { return recep("Cannabinoid CB1 receptor", "CNR1", "P21554", "GPCR", "Gi/Go", "", "CNS (cortex, hippocampus, basal ganglia, cerebellum, hypothalamus, amygdala, PAG, spinal cord). Most abundant GPCR in the brain.", "Presynaptic: inhibits voltage-gated Ca2+ channels -> reduces neurotransmitter release (retrograde signaling). Inhibits both glutamate (DSE) and GABA (DSI) release depending on synapse. THC (partial agonist). Rimonabant (inverse agonist, withdrawn: psychiatric side effects).", "Kandel 6th ed Ch 14. Mackie K. Annu Rev Pharmacol Toxicol 46:101-122, 2006") }
    if name == "CB2" { return recep("Cannabinoid CB2 receptor", "CNR2", "P34972", "GPCR", "Gi/Go", "", "Immune cells (macrophages, B cells, T cells, microglia), spleen, tonsils. Low CNS expression (microglia upregulate in neuroinflammation).", "Anti-inflammatory. Inhibits cytokine release. Modulates immune cell migration. CB2 selective agonists pursued for pain and inflammation without psychoactive effects.", "Goodman & Gilman 14th ed Ch 20. Pertwee RG. Br J Pharmacol 153:199-215, 2008") }
    return recep("", "", "", "", "", "", "", "", "")
}


// ─── E. Nitric Oxide (NO) ───

struct NOSynthase {
    name: String,
    gene: String,
    accession: String,
    isoform_type: String,
    location: String,
    regulation: String,
    function_desc: String,
    citation: String,
}

fn nos_isoform(name: String) -> NOSynthase {
    if name == "nNOS" { return NOSynthase { name: "Neuronal nitric oxide synthase (nNOS, NOS1)", gene: "NOS1", accession: "P29475", isoform_type: "constitutive, Ca2+/calmodulin dependent", location: "CNS neurons (postsynaptic density, tethered to PSD-95/NMDA receptor complex), skeletal muscle, macula densa", regulation: "Activated by Ca2+ influx through NMDA receptors. Ca2+/CaM binding required. Physically coupled to NMDA receptor via PSD-95 scaffolding.", function_desc: "Retrograde messenger: NO diffuses from postsynaptic neuron BACK to presynaptic terminal -> activates soluble guanylyl cyclase (sGC) -> cGMP -> PKG -> enhances neurotransmitter release. Critical for LTP at some synapses. Also involved in NANC neurotransmission (penile erection, GI relaxation). Excitotoxicity: excessive nNOS activation during ischemia contributes to neuronal death (peroxynitrite formation from NO + superoxide).", citation: "Kandel 6th ed Ch 13. Bredt DS, Snyder SH. Neuron 8:3-11, 1992" } }
    if name == "eNOS" { return NOSynthase { name: "Endothelial nitric oxide synthase (eNOS, NOS3)", gene: "NOS3", accession: "P29474", isoform_type: "constitutive, Ca2+/calmodulin dependent", location: "Vascular endothelium, cardiomyocytes, platelets", regulation: "Activated by shear stress, ACh (M3 receptor -> Gq -> Ca2+), bradykinin, VEGF. Basal activity maintains vascular tone.", function_desc: "Produces NO that diffuses to vascular smooth muscle -> activates sGC -> cGMP -> PKG -> MLCP activation -> smooth muscle relaxation -> vasodilation. Also inhibits platelet aggregation and leukocyte adhesion. Sildenafil (Viagra) inhibits PDE5 (degrades cGMP), potentiating NO/cGMP vasodilation in corpus cavernosum.", citation: "Kandel 6th ed Ch 13. Furchgott RF, Zawadzki JV. Nature 288:373-376, 1980 (Nobel Prize 1998)" } }
    if name == "iNOS" { return NOSynthase { name: "Inducible nitric oxide synthase (iNOS, NOS2)", gene: "NOS2", accession: "P35228", isoform_type: "inducible, Ca2+-independent (calmodulin bound constitutively at low Ca2+)", location: "Macrophages, microglia, astrocytes, hepatocytes, smooth muscle (induced by cytokines)", regulation: "Transcriptionally induced by LPS, IFN-gamma, TNF-alpha, IL-1beta (NF-kB and JAK/STAT pathways). NOT calcium-regulated. Produces sustained, high-output NO (micromolar vs nanomolar from nNOS/eNOS).", function_desc: "Cytotoxic defense against intracellular pathogens (NO + superoxide -> peroxynitrite -> DNA damage, protein nitrosylation). Macrophage killing mechanism. Excessive iNOS in septic shock causes pathological vasodilation and hypotension. Neuroinflammation: iNOS in activated microglia contributes to neurodegeneration (MS, Alzheimer, PD).", citation: "Goodman & Gilman 14th ed Ch 45. Nathan C, Xie QW. Cell 78:915-918, 1994" } }
    return NOSynthase { name: "", gene: "", accession: "", isoform_type: "", location: "", regulation: "", function_desc: "", citation: "" }
}

fn nitric_oxide_properties() -> String {
    return "NO is a gaseous transmitter. Freely diffuses across membranes (no vesicular storage, no receptor binding in traditional sense). Half-life ~5 seconds in tissue (reacts with O2, superoxide, hemoglobin). Synthesized on demand from L-arginine + O2 by NOS -> L-citrulline + NO. Cofactors: NADPH, BH4, FAD, FMN, heme. Target: soluble guanylyl cyclase (sGC) Fe2+-heme -> cGMP second messenger."
}


// ═══════════════════════════════════════════════════════
// VESICULAR TRANSPORTERS
// ═══════════════════════════════════════════════════════
// Load cytoplasmic transmitter into synaptic vesicles.

fn vesicular_transporter(name: String) -> Transporter {
    if name == "VMAT2" { return transp("Vesicular monoamine transporter 2 (VMAT2)", "SLC18A2", "Q05940", "Dopamine, Serotonin, Norepinephrine, Epinephrine, Histamine", "H+ antiport (exchanges 2 luminal H+ for 1 cytoplasmic monoamine). V-ATPase maintains vesicular H+ gradient. Concentrates monoamines ~10000x inside vesicle.", "Reserpine (irreversible, depletes monoamines, historical antihypertensive, caused depression). Tetrabenazine, valbenazine, deutetrabenazine (reversible, for tardive dyskinesia). Amphetamine (weak base, collapses pH gradient, causes non-exocytotic DA release).", "Tetrabenazine/valbenazine for tardive dyskinesia (FDA approved). Reserpine-induced depression was early evidence for monoamine hypothesis.", "Goodman & Gilman 14th ed Ch 13. Eiden LE et al. Pflugers Arch 447:636-640, 2004") }
    if name == "VAChT" { return transp("Vesicular acetylcholine transporter (VAChT)", "SLC18A3", "Q16572", "Acetylcholine", "H+ antiport (similar to VMAT). Encoded within first intron of ChAT gene (cholinergic gene locus).", "Vesamicol (experimental, blocks ACh loading into vesicles)", "No clinical drugs target VAChT directly. Vesamicol used in research.", "Kandel 6th ed Ch 15. Erickson JD et al. J Biol Chem 269:21929-21932, 1994") }
    if name == "VGAT" { return transp("Vesicular GABA transporter (VGAT, also called VIAAT)", "SLC32A1", "Q9H598", "GABA, Glycine", "H+ antiport. Loads both GABA and glycine (at glycinergic terminals, glycine is loaded by the same transporter). Determines whether a synapse is GABAergic or glycinergic based on cytoplasmic transmitter availability.", "None in clinical use", "Shared vesicular transporter for GABA and glycine. SLC32A1 is essential for inhibitory neurotransmission.", "Goodman & Gilman 14th ed Ch 17. McIntire SL et al. Nature 389:870-876, 1997") }
    if name == "VGluT1" { return transp("Vesicular glutamate transporter 1 (VGluT1)", "SLC17A7", "Q9P2U7", "Glutamate", "Depends on vesicular membrane potential (delta-Psi) more than delta-pH. Cl- modulates activity. Defines a glutamatergic neuron (expression of VGluT is the marker).", "None in clinical use", "VGluT1 in cortex and hippocampus. VGluT2 (SLC17A6, Q9P2U8) in thalamus and brainstem. VGluT3 (SLC17A8, Q8NDX2) in serotonergic, cholinergic, and GABAergic neurons (co-transmission).", "Kandel 6th ed Ch 12. Takamori S et al. Nature 407:189-194, 2000") }
    return transp("", "", "", "", "", "", "", "")
}


// ═══════════════════════════════════════════════════════
// GLUTAMATE-GLUTAMINE CYCLE
// ═══════════════════════════════════════════════════════
// Astrocyte recycling of glutamate prevents excitotoxicity
// and is essential for sustained glutamatergic transmission.

struct GlutamineShuttleStep {
    step_number: Int,
    compartment: String,
    substrate: String,
    product: String,
    enzyme_or_transporter: String,
    accession: String,
    description: String,
}

fn glutamine_cycle_step(step: Int) -> GlutamineShuttleStep {
    if step == 1 { return GlutamineShuttleStep { step_number: 1, compartment: "synaptic cleft -> astrocyte", substrate: "Glutamate", product: "Glutamate (intracellular astrocytic)", enzyme_or_transporter: "EAAT2 (GLT-1) / EAAT1 (GLAST)", accession: "P43004 / P43003", description: "Astrocytic transporters clear glutamate from synapse (> 90% of clearance). Prevents excitotoxicity." } }
    if step == 2 { return GlutamineShuttleStep { step_number: 2, compartment: "astrocyte cytoplasm", substrate: "Glutamate + NH4+ + ATP", product: "Glutamine + ADP + Pi", enzyme_or_transporter: "Glutamine synthetase (GS)", accession: "P15104", description: "Astrocyte-specific enzyme. Converts toxic glutamate to non-toxic, non-neuroactive glutamine. Also detoxifies ammonia." } }
    if step == 3 { return GlutamineShuttleStep { step_number: 3, compartment: "astrocyte -> extracellular -> neuron", substrate: "Glutamine", product: "Glutamine (intracellular neuronal)", enzyme_or_transporter: "SN1/SNAT3 (astrocyte release, SLC38A3) and SAT1/SNAT1 (neuronal uptake, SLC38A1)", accession: "Q99624 (SLC38A3) / Q9H2H9 (SLC38A1)", description: "Glutamine shuttled from astrocyte to neuron. Non-excitatory so safe in extracellular space." } }
    if step == 4 { return GlutamineShuttleStep { step_number: 4, compartment: "neuronal mitochondria", substrate: "Glutamine", product: "Glutamate + NH4+", enzyme_or_transporter: "Glutaminase (PAG/GLS)", accession: "O94925", description: "Neuron converts glutamine back to glutamate. Glutamate loaded into vesicles by VGluT. Cycle complete." } }
    return GlutamineShuttleStep { step_number: 0, compartment: "", substrate: "", product: "", enzyme_or_transporter: "", accession: "", description: "" }
}


// ═══════════════════════════════════════════════════════
// SUMMARY LOOKUP: By transmitter name
// ═══════════════════════════════════════════════════════

fn transmitter_overview(name: String) -> String {
    if name == "dopamine" { return "Catecholamine. Synthesis: Tyr->L-DOPA(TH,P07101)->DA(AADC,P20711). Reuptake: DAT(SLC6A3,Q01959). Degradation: MAO-A(P21397), MAO-B(P27338), COMT(P21964). Receptors: D1(P21728,Gs), D2(P14416,Gi), D3(P35462,Gi), D4(P21917,Gi), D5(P21918,Gs). Pathways: mesolimbic, mesocortical, nigrostriatal, tuberoinfundibular. Clinical: Parkinson, schizophrenia, addiction, ADHD." }
    if name == "serotonin" { return "Indolamine. Synthesis: Trp->5-HTP(TPH1/2,P17752/Q8IWU9)->5-HT(AADC,P20711). Reuptake: SERT(SLC6A4,P31645). Degradation: MAO-A(P21397)->5-HIAA. Receptors: 5-HT1A-F(Gi), 5-HT2A-C(Gq), 5-HT3(ionotropic,P46098), 5-HT4(Gs), 5-HT5A(Gi), 5-HT6(Gs), 5-HT7(Gs). Clinical: depression(SSRIs), anxiety, migraine(triptans), carcinoid." }
    if name == "norepinephrine" { return "Catecholamine. Synthesis: DA->NE(DBH,P09172). Reuptake: NET(SLC6A2,P23975). Degradation: MAO-A(P21397), COMT(P21964). Receptors: alpha1A/B/D(Gq), alpha2A/B/C(Gi), beta1/2/3(Gs). Origin: locus coeruleus. Clinical: SNRIs, clonidine(alpha2A), prazosin(alpha1), ADHD." }
    if name == "acetylcholine" { return "Choline ester. Synthesis: choline+acetyl-CoA->ACh(ChAT,P28329). Degradation: AChE(P22303). Vesicular: VAChT(SLC18A3,Q16572). Receptors: nicotinic(ionotropic: muscle P02708, ganglionic P32297, CNS P43681), muscarinic(M1-M5 GPCR). Clinical: myasthenia gravis, Alzheimer(donepezil), OP poisoning, NMJ blockade." }
    if name == "gaba" { return "Amino acid. Synthesis: glutamate->GABA(GAD65/67, Q05329/Q99259). Degradation: GABA-T(ABAT,P80404)->succinate. Reuptake: GAT-1(SLC6A1,P30531). Vesicular: VGAT(SLC32A1,Q9H598). Receptors: GABA-A(ionotropic Cl-,P14867), GABA-B(GPCR Gi,Q9UBS5/O75899). Clinical: benzodiazepines, barbiturates, vigabatrin, epilepsy." }
    if name == "glutamate" { return "Amino acid. Synthesis: glutamine->glutamate(glutaminase GLS,O94925). Reuptake: EAAT1-5(astrocytic EAAT2 P43004 dominant). Vesicular: VGluT1(SLC17A7,Q9P2U7). Receptors: NMDA(Q05586), AMPA(P42261-P48058), kainate(P39086-Q16478), mGluR1-8(GPCR). Clinical: excitotoxicity, ketamine(TRD), memantine(AD), riluzole(ALS)." }
    if name == "glycine" { return "Amino acid. Inhibitory in spinal cord/brainstem via GlyR(P23415, Cl- channel). Strychnine is antagonist. Also obligatory co-agonist at NMDA receptor GluN1 glycine site. Reuptake: GlyT1(SLC6A9,P48067) at glutamatergic synapses, GlyT2(SLC6A5,Q9Y345) at glycinergic synapses." }
    if name == "histamine" { return "Biogenic amine. Synthesis: histidine->histamine(HDC,P19113). CNS source: tuberomammillary nucleus. Receptors: H1(P35367,Gq), H2(P25021,Gs), H3(Q9Y5N1,Gi,autoreceptor), H4(Q9H3N8,Gi,immune). Clinical: antihistamines(H1), ranitidine(H2), pitolisant(H3 inverse agonist,narcolepsy)." }
    if name == "endocannabinoid" { return "Lipid transmitters. Anandamide(AEA): NAPE-PLD(Q6NR60)->FAAH(O00519). 2-AG: DAGL(Q9Y4D2)->MAGL(Q99884). Retrograde messengers. Receptors: CB1(P21554,Gi,CNS), CB2(P34972,Gi,immune). THC is CB1 partial agonist. DSI/DSE (depolarization-induced suppression of inhibition/excitation)." }
    if name == "nitric_oxide" { return "Gaseous transmitter. Synthesis: L-arginine->NO+L-citrulline by NOS. Isoforms: nNOS(NOS1,P29475,constitutive,neuronal), eNOS(NOS3,P29474,constitutive,endothelial), iNOS(NOS2,P35228,inducible,immune). Target: sGC->cGMP. Retrograde messenger. Sildenafil potentiates NO/cGMP (PDE5 inhibitor). Half-life ~5 sec." }
    return "Unknown transmitter"
}


// ═══════════════════════════════════════════════════════
// COUNT FUNCTIONS
// ═══════════════════════════════════════════════════════

fn dopamine_receptor_count() -> Int {
    return 5
}

fn serotonin_receptor_count() -> Int {
    // 5-HT1A, 1B, 1D, 1E, 1F, 2A, 2B, 2C, 3, 4, 5A, 6, 7
    return 13
}

fn adrenergic_receptor_count() -> Int {
    // alpha1A, alpha1B, alpha1D, alpha2A, alpha2B, alpha2C, beta1, beta2, beta3
    return 9
}

fn acetylcholine_receptor_count() -> Int {
    // nAChR_muscle, nAChR_ganglionic, nAChR_CNS, M1, M2, M3, M4, M5
    return 8
}

fn gaba_receptor_count() -> Int {
    // GABA-A, GABA-B, GABA-A-rho
    return 3
}

fn glutamate_receptor_count() -> Int {
    // NMDA, AMPA, kainate, mGluR1-8
    return 11
}

fn histamine_receptor_count() -> Int {
    return 4
}

fn opioid_receptor_count() -> Int {
    // mu, delta, kappa, NOP
    return 4
}

fn cannabinoid_receptor_count() -> Int {
    return 2
}

fn nos_isoform_count() -> Int {
    return 3
}

fn total_receptor_count() -> Int {
    // All receptors catalogued in this module
    return dopamine_receptor_count()
        + serotonin_receptor_count()
        + adrenergic_receptor_count()
        + acetylcholine_receptor_count()
        + gaba_receptor_count()
        + glutamate_receptor_count()
        + histamine_receptor_count()
        + opioid_receptor_count()
        + cannabinoid_receptor_count()
}

fn total_transmitter_systems() -> Int {
    // dopamine, serotonin, norepinephrine, acetylcholine,
    // GABA, glutamate, glycine, histamine, endogenous opioids,
    // endocannabinoids, nitric oxide
    return 11
}

fn vesicular_transporter_count() -> Int {
    // VMAT2, VAChT, VGAT, VGluT1
    return 4
}

fn glutamine_cycle_step_count() -> Int {
    return 4
}

fn eaat_transporter_count() -> Int {
    // EAAT1 through EAAT5
    return 5
}
