#include "model/HelixVariant.h"

namespace MC {

static const std::vector<HelixVariant> kHelixVariants = {
    {
        "proses_2_5_r1r2",
        "Proses 2.5 R1&R2 26cm/10.2\"",
        2.5,        // turns
        260.0,      // totalRise mm (spec total height; rail climb)
        360.0,      // R1
        437.5,      // R2
        "24188",    // stub straight
        "24130",    // R1 30 deg curve
        "24230"     // R2 30 deg curve
    },
    {
        "proses_3_5_r1r2",
        "Proses 3.5 R1&R2 34cm/13.4\"",
        3.5,        // turns
        340.0,      // totalRise mm (spec: 34 cm total height)
        360.0,
        437.5,
        "24188",
        "24130",
        "24230"
    },
    {
        "proses_4_5_r1r2",
        "Proses 4.5 R1&R2 42cm/16.5\"",
        4.5,        // turns
        420.0,      // totalRise mm (spec: 42 cm)
        360.0,
        437.5,
        "24188",
        "24130",
        "24230"
    },
    {
        // Märklin "R2" (437.5) and "R3" (515). The struct's radiusR1 field
        // is "inner radius" by code convention, not the Märklin track name —
        // so radiusR1=437.5 here is Märklin's R2.
        "proses_2_5_r2r3",
        "Proses 2.5 R2&R3 26cm/10.2\"",
        2.5,        // turns
        260.0,      // totalRise mm (spec: 26 cm)
        437.5,      // inner = Märklin R2
        515.0,      // outer = Märklin R3
        "24188",
        "24230",    // R2 30 deg curve
        "24330"     // R3 30 deg curve
    },
    {
        "proses_3_5_r2r3",
        "Proses 3.5 R2&R3 34cm/13.4\"",
        3.5,        // turns
        340.0,      // totalRise mm (spec: 34 cm)
        437.5,      // inner = Märklin R2
        515.0,      // outer = Märklin R3
        "24188",
        "24230",
        "24330"
    },
    {
        // Märklin R3 (515) and R4 (579.3) — 2.5-turn variant.
        "proses_2_5_r3r4",
        "Proses 2.5 R3&R4 26cm/10.2\"",
        2.5,        // turns
        260.0,      // totalRise mm (spec: 26 cm)
        515.0,      // inner = Märklin R3
        579.3,      // outer = Märklin R4
        "24188",
        "24330",
        "24430"
    },
    {
        // Märklin R3 (515) and R4 (579.3) — 4.5-turn variant.
        "proses_4_5_r3r4",
        "Proses 4.5 R3&R4 42cm/16.5\"",
        4.5,        // turns
        420.0,      // totalRise mm (spec: 42 cm)
        515.0,      // inner = Märklin R3
        579.3,      // outer = Märklin R4
        "24188",
        "24330",    // R3 30 deg curve
        "24430"     // R4 30 deg curve
    },
    {
        // Märklin R4 (579.3) and R5 (643.6) — 2.5-turn variant.
        "proses_2_5_r4r5",
        "Proses 2.5 R4&R5 26cm/10.2\"",
        2.5,        // turns
        260.0,      // totalRise mm (spec: 26 cm)
        579.3,      // inner = Märklin R4
        643.6,      // outer = Märklin R5
        "24188",
        "24430",    // R4 30 deg curve
        "24530"     // R5 30 deg curve
    },
    {
        // Märklin R4 (579.3) and R5 (643.6) — 3.5-turn variant.
        "proses_3_5_r4r5",
        "Proses 3.5 R4&R5 34cm/13.4\"",
        3.5,        // turns
        340.0,      // totalRise mm (spec: 34 cm)
        579.3,
        643.6,
        "24188",
        "24430",
        "24530"
    },
    {
        // Märklin R4 (579.3) and R5 (643.6) — 4.5-turn variant.
        "proses_4_5_r4r5",
        "Proses 4.5 R4&R5 42cm/16.5\"",
        4.5,        // turns
        420.0,      // totalRise mm (spec: 42 cm)
        579.3,
        643.6,
        "24188",
        "24430",
        "24530"
    },
};

static const std::string kDefaultId = "proses_2_5_r1r2";

const std::vector<HelixVariant>& GetHelixVariants() {
    return kHelixVariants;
}

const HelixVariant* FindHelixVariant(const std::string& id) {
    for (const auto& v : kHelixVariants) {
        if (v.id == id) return &v;
    }
    return nullptr;
}

const std::string& DefaultHelixVariantId() {
    return kDefaultId;
}

} // namespace MC
