// drugs_index.sy -- Master dispatcher for 3002 FDA drugs
// Source: kai_consciousness DB <- FDA/DailyMed SPL (public domain)
// Generated: 2026-04-12 | Marjorie McCubbins + Aether
// Patent pending: 64/034,536

use drugs_a
use drugs_b
use drugs_c
use drugs_d
use drugs_e
use drugs_f
use drugs_g
use drugs_h
use drugs_i
use drugs_j
use drugs_k
use drugs_l
use drugs_m
use drugs_n
use drugs_num
use drugs_o
use drugs_p
use drugs_q
use drugs_r
use drugs_s
use drugs_t
use drugs_u
use drugs_v
use drugs_w
use drugs_x
use drugs_y
use drugs_z

struct DrugRecord {
    brand_name: String,
    generic_name: String,
    route: String,
    dosage_form: String,
    product_type: String,
    app_number: String,
    spl_id: String,
    half_life: String,
    bioavailability: String,
    protein_binding: String,
    clearance: String,
    volume_distribution: String,
    tmax: String,
    cmax: String,
    pharmacologic_class: String,
    therapeutic_category: String,
    cyp_profile: String,
    interactions: String,
}

fn drug(bn: String, gn: String, rt: String, df: String, pt: String, an: String, si: String, hl: String, ba: String, pb: String, cl: String, vd: String, tm: String, cm: String, pc: String, tc: String, cyp: String, ia: String) -> DrugRecord {
    return DrugRecord { brand_name: bn, generic_name: gn, route: rt, dosage_form: df, product_type: pt, app_number: an, spl_id: si, half_life: hl, bioavailability: ba, protein_binding: pb, clearance: cl, volume_distribution: vd, tmax: tm, cmax: cm, pharmacologic_class: pc, therapeutic_category: tc, cyp_profile: cyp, interactions: ia }
}

fn unknown_drug() -> DrugRecord {
    return drug("", "UNKNOWN", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "")
}

fn lookup_drug(generic: String) -> DrugRecord {
    let first = str_substring(generic, 0, 1)
    if first == "A" { return lookup_drug_a(generic) }
    if first == "a" { return lookup_drug_a(generic) }
    if first == "B" { return lookup_drug_b(generic) }
    if first == "b" { return lookup_drug_b(generic) }
    if first == "C" { return lookup_drug_c(generic) }
    if first == "c" { return lookup_drug_c(generic) }
    if first == "D" { return lookup_drug_d(generic) }
    if first == "d" { return lookup_drug_d(generic) }
    if first == "E" { return lookup_drug_e(generic) }
    if first == "e" { return lookup_drug_e(generic) }
    if first == "F" { return lookup_drug_f(generic) }
    if first == "f" { return lookup_drug_f(generic) }
    if first == "G" { return lookup_drug_g(generic) }
    if first == "g" { return lookup_drug_g(generic) }
    if first == "H" { return lookup_drug_h(generic) }
    if first == "h" { return lookup_drug_h(generic) }
    if first == "I" { return lookup_drug_i(generic) }
    if first == "i" { return lookup_drug_i(generic) }
    if first == "J" { return lookup_drug_j(generic) }
    if first == "j" { return lookup_drug_j(generic) }
    if first == "K" { return lookup_drug_k(generic) }
    if first == "k" { return lookup_drug_k(generic) }
    if first == "L" { return lookup_drug_l(generic) }
    if first == "l" { return lookup_drug_l(generic) }
    if first == "M" { return lookup_drug_m(generic) }
    if first == "m" { return lookup_drug_m(generic) }
    if first == "N" { return lookup_drug_n(generic) }
    if first == "n" { return lookup_drug_n(generic) }
    if first == "NUM" { return lookup_drug_num(generic) }
    if first == "num" { return lookup_drug_num(generic) }
    if first == "O" { return lookup_drug_o(generic) }
    if first == "o" { return lookup_drug_o(generic) }
    if first == "P" { return lookup_drug_p(generic) }
    if first == "p" { return lookup_drug_p(generic) }
    if first == "Q" { return lookup_drug_q(generic) }
    if first == "q" { return lookup_drug_q(generic) }
    if first == "R" { return lookup_drug_r(generic) }
    if first == "r" { return lookup_drug_r(generic) }
    if first == "S" { return lookup_drug_s(generic) }
    if first == "s" { return lookup_drug_s(generic) }
    if first == "T" { return lookup_drug_t(generic) }
    if first == "t" { return lookup_drug_t(generic) }
    if first == "U" { return lookup_drug_u(generic) }
    if first == "u" { return lookup_drug_u(generic) }
    if first == "V" { return lookup_drug_v(generic) }
    if first == "v" { return lookup_drug_v(generic) }
    if first == "W" { return lookup_drug_w(generic) }
    if first == "w" { return lookup_drug_w(generic) }
    if first == "X" { return lookup_drug_x(generic) }
    if first == "x" { return lookup_drug_x(generic) }
    if first == "Y" { return lookup_drug_y(generic) }
    if first == "y" { return lookup_drug_y(generic) }
    if first == "Z" { return lookup_drug_z(generic) }
    if first == "z" { return lookup_drug_z(generic) }
    return unknown_drug()
}

fn total_drug_count() -> Int {
    return 3002
}