// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2026 Andrea De Murtas

#pragma once

#include <juce_audio_processors/juce_audio_processors.h>
#include <vector>
#include <utility>
#include "Params.h"

namespace gjalla::presets
{

// Factory presets, in the siblings' format: plain denormalised values keyed by
// parameter ID. A C++ table rather than embedded XML on purpose: it needs no
// binary assets, diffs cleanly, and cannot drift out of sync with the parameter
// ranges. Anything a preset does not mention is left at its default, so
// applying one always starts from a known state.
struct Preset
{
    const char* name;
    std::vector<std::pair<const char*, double>> values;
};

inline const std::vector<Preset>& all()
{
    static const std::vector<Preset> list = {

        // Second-wave default: a distortion pedal slamming the front end, the
        // low mids pulled out and the treble up, so the riff reads as texture
        // rather than as notes.
        { "Frostbitten", {
            { pid::gateThresh, -46 },
            { pid::pedalMode, (double) choices::PedalMode::dist },
            { pid::pedalDrive, 7.0 }, { pid::pedalTone, 6.0 },
            { pid::ampGain, 7.5 }, { pid::tight, 120 },
            { pid::bass, -2 }, { pid::mid, -3 }, { pid::treble, 4 },
            { pid::presence, 4 }, { pid::master, 3.0 },
            { pid::cabMode, (double) choices::CabMode::w412 },
            { pid::frost, 3 } } },

        // The amp everyone actually had. Pedal off, moderate gain, a small
        // speaker in a concrete room: boxy mids and no bottom octave at all.
        { "Rehearsal Cellar", {
            { pid::gateThresh, -52 },
            { pid::pedalOn, 0 },
            { pid::ampGain, 6.0 }, { pid::tight, 70 },
            { pid::bass, 2 }, { pid::mid, 3 }, { pid::treble, 1 },
            { pid::presence, 0 }, { pid::master, 4.0 },
            { pid::cabMode, (double) choices::CabMode::practice },
            { pid::frost, 0 } } },

        // HM-2 with everything on ten, into a comparatively clean amp: the
        // pedal does the distorting and the amp just carries it.
        { "Chainsaw Winter", {
            { pid::gateThresh, -44 },
            { pid::pedalMode, (double) choices::PedalMode::chainsaw },
            { pid::pedalDrive, 9.0 }, { pid::pedalTone, 6.0 }, { pid::pedalLevel, 2 },
            { pid::ampGain, 5.0 }, { pid::tight, 150 },
            { pid::bass, -1 }, { pid::mid, -2 }, { pid::treble, 3 },
            { pid::presence, 3 }, { pid::master, 3.0 },
            { pid::cabMode, (double) choices::CabMode::w412 },
            { pid::frost, 2 } } },

        // Everything below the third string removed on purpose. Tight high,
        // bass and mid scooped, frost at the top of its range.
        { "Thin Air", {
            { pid::gateThresh, -48 },
            { pid::pedalMode, (double) choices::PedalMode::dist },
            { pid::pedalDrive, 6.0 }, { pid::pedalTone, 8.0 },
            { pid::ampGain, 8.0 }, { pid::tight, 220 },
            { pid::bass, -6 }, { pid::mid, -4 }, { pid::treble, 6 },
            { pid::presence, 6 }, { pid::master, 2.5 },
            { pid::cabMode, (double) choices::CabMode::w412 },
            { pid::frost, 6 } } },

        // A fuzz through a portable stereo. Dark, mid-heavy, slightly crushed
        // by the boombox voicing's own saturation.
        { "Boombox Demo", {
            { pid::gateThresh, -40 },
            { pid::pedalMode, (double) choices::PedalMode::fuzz },
            { pid::pedalDrive, 7.0 }, { pid::pedalTone, 4.0 },
            { pid::ampGain, 6.0 }, { pid::tight, 110 },
            { pid::bass, 0 }, { pid::mid, 3 }, { pid::treble, 0 },
            { pid::presence, -2 }, { pid::master, 5.0 },
            { pid::cabMode, (double) choices::CabMode::boombox },
            { pid::frost, -2 }, { pid::outTrim, 2 } } },

        // Maximum density: fuzz into maximum preamp gain with the tight filter
        // wide open, so nothing is left of the transient.
        { "Wall of Ice", {
            { pid::gateThresh, -42 },
            { pid::pedalMode, (double) choices::PedalMode::fuzz },
            { pid::pedalDrive, 9.0 }, { pid::pedalTone, 6.0 },
            { pid::ampGain, 9.0 }, { pid::tight, 60 },
            { pid::bass, 3 }, { pid::mid, -2 }, { pid::treble, 5 },
            { pid::presence, 5 }, { pid::master, 4.0 },
            { pid::cabMode, (double) choices::CabMode::w412 },
            { pid::frost, 4 } } },
    };

    return list;
}

} // namespace gjalla::presets
