#pragma once
#include "helpers/4ms_elements.hh"
#include "CoreModules/elements/element_info.hh"

#include <array>

namespace MetaModule
{
struct VCAMInfo : ModuleInfoBase {
    static constexpr std::string_view slug{"VCAM"};
    static constexpr std::string_view description{"VCA Matrix"};
    static constexpr uint32_t width_hp = 26;
    static constexpr std::string_view svg_filename{"res/modules/VCAM_artwork.svg"};
    static constexpr std::string_view png_filename{"4ms/fp/VCAM.png"};

    using enum Coords;

    static constexpr std::array<Element, 56> Elements{{
		Knob9mm{{to_mm<72>(31.64), to_mm<72>(195.5), Center, "A1 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(84.56), to_mm<72>(195.5), Center, "A2 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(137.48), to_mm<72>(195.5), Center, "A3 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(190.4), to_mm<72>(195.5), Center, "A4 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(31.64), to_mm<72>(234.57), Center, "B1 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(84.56), to_mm<72>(234.57), Center, "B2 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(137.48), to_mm<72>(234.57), Center, "B3 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(190.4), to_mm<72>(234.57), Center, "B4 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(31.64), to_mm<72>(273.9), Center, "C1 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(84.56), to_mm<72>(273.9), Center, "C2 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(137.48), to_mm<72>(273.9), Center, "C3 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(190.4), to_mm<72>(273.9), Center, "C4 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(31.64), to_mm<72>(313.03), Center, "D1 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(84.56), to_mm<72>(313.03), Center, "D2 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(137.48), to_mm<72>(313.03), Center, "D3 Level", ""}, 1.0f},
		Knob9mm{{to_mm<72>(190.4), to_mm<72>(313.03), Center, "D4 Level", ""}, 1.0f},
		OrangeButton{{to_mm<72>(235.61), to_mm<72>(195.69), Center, "A1 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(274.49), to_mm<72>(195.69), Center, "A2 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(313.37), to_mm<72>(195.69), Center, "A3 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(352.25), to_mm<72>(195.69), Center, "A4 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(235.61), to_mm<72>(234.57), Center, "B1 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(274.49), to_mm<72>(234.57), Center, "B2 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(313.37), to_mm<72>(234.57), Center, "B3 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(352.25), to_mm<72>(234.57), Center, "B4 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(235.61), to_mm<72>(273.45), Center, "C1 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(274.49), to_mm<72>(273.45), Center, "C2 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(313.37), to_mm<72>(273.45), Center, "C3 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(352.25), to_mm<72>(273.45), Center, "C4 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(235.61), to_mm<72>(312.33), Center, "D1 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(274.49), to_mm<72>(312.33), Center, "D2 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(313.37), to_mm<72>(312.33), Center, "D3 Button", ""}, LatchingButton::State_t::DOWN},
		OrangeButton{{to_mm<72>(352.25), to_mm<72>(312.33), Center, "D4 Button", ""}, LatchingButton::State_t::DOWN},
		AnalogJackInput4ms{{to_mm<72>(55.57), to_mm<72>(37.91), Center, "In A", ""}},
		AnalogJackInput4ms{{to_mm<72>(55.57), to_mm<72>(74.29), Center, "In B", ""}},
		AnalogJackInput4ms{{to_mm<72>(55.57), to_mm<72>(110.46), Center, "In C", ""}},
		AnalogJackInput4ms{{to_mm<72>(55.57), to_mm<72>(145.77), Center, "In D", ""}},
		AnalogJackOutput4ms{{to_mm<72>(99.08), to_mm<72>(37.9), Center, "Out 1", ""}},
		AnalogJackOutput4ms{{to_mm<72>(169.64), to_mm<72>(37.9), Center, "Out 2", ""}},
		AnalogJackOutput4ms{{to_mm<72>(240.2), to_mm<72>(37.9), Center, "Out 3", ""}},
		AnalogJackOutput4ms{{to_mm<72>(310.76), to_mm<72>(37.9), Center, "Out 4", ""}},
		AnalogJackInput4ms{{to_mm<72>(134.24), to_mm<72>(67.6), Center, "A1 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(204.9), to_mm<72>(67.6), Center, "A2 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(275.43), to_mm<72>(67.6), Center, "A3 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(345.99), to_mm<72>(67.6), Center, "A4 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(99.08), to_mm<72>(97.62), Center, "B1 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(169.75), to_mm<72>(97.62), Center, "B2 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(240.27), to_mm<72>(97.62), Center, "B3 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(310.84), to_mm<72>(97.62), Center, "B4 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(134.24), to_mm<72>(127.73), Center, "C1 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(204.9), to_mm<72>(127.73), Center, "C2 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(275.43), to_mm<72>(127.73), Center, "C3 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(345.99), to_mm<72>(127.73), Center, "C4 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(99.08), to_mm<72>(157.41), Center, "D1 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(169.75), to_mm<72>(157.41), Center, "D2 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(240.27), to_mm<72>(157.41), Center, "D3 CV", ""}},
		AnalogJackInput4ms{{to_mm<72>(310.84), to_mm<72>(157.41), Center, "D4 CV", ""}},
}};

    enum class Elem {
        A1LevelKnob,
        A2LevelKnob,
        A3LevelKnob,
        A4LevelKnob,
        B1LevelKnob,
        B2LevelKnob,
        B3LevelKnob,
        B4LevelKnob,
        C1LevelKnob,
        C2LevelKnob,
        C3LevelKnob,
        C4LevelKnob,
        D1LevelKnob,
        D2LevelKnob,
        D3LevelKnob,
        D4LevelKnob,
        A1Button,
        A2Button,
        A3Button,
        A4Button,
        B1Button,
        B2Button,
        B3Button,
        B4Button,
        C1Button,
        C2Button,
        C3Button,
        C4Button,
        D1Button,
        D2Button,
        D3Button,
        D4Button,
        InAIn,
        InBIn,
        InCIn,
        InDIn,
        Out1Out,
        Out2Out,
        Out3Out,
        Out4Out,
        A1JackIn,
        A2JackIn,
        A3JackIn,
        A4JackIn,
        B1JackIn,
        B2JackIn,
        B3JackIn,
        B4JackIn,
        C1JackIn,
        C2JackIn,
        C3JackIn,
        C4JackIn,
        D1JackIn,
        D2JackIn,
        D3JackIn,
        D4JackIn,
    };

    // Legacy naming
    
    enum {
        KnobA1_Level, 
        KnobA2_Level, 
        KnobA3_Level, 
        KnobA4_Level, 
        KnobB1_Level, 
        KnobB2_Level, 
        KnobB3_Level, 
        KnobB4_Level, 
        KnobC1_Level, 
        KnobC2_Level, 
        KnobC3_Level, 
        KnobC4_Level, 
        KnobD1_Level, 
        KnobD2_Level, 
        KnobD3_Level, 
        KnobD4_Level, 
        NumKnobs,
    };
    
    enum {
        SwitchA1_Button, 
        SwitchA2_Button, 
        SwitchA3_Button, 
        SwitchA4_Button, 
        SwitchB1_Button, 
        SwitchB2_Button, 
        SwitchB3_Button, 
        SwitchB4_Button, 
        SwitchC1_Button, 
        SwitchC2_Button, 
        SwitchC3_Button, 
        SwitchC4_Button, 
        SwitchD1_Button, 
        SwitchD2_Button, 
        SwitchD3_Button, 
        SwitchD4_Button, 
        NumSwitches,
    };
    
    enum {
        InputIn_A, 
        InputIn_B, 
        InputIn_C, 
        InputIn_D, 
        InputA1_Jack, 
        InputA2_Jack, 
        InputA3_Jack, 
        InputA4_Jack, 
        InputB1_Jack, 
        InputB2_Jack, 
        InputB3_Jack, 
        InputB4_Jack, 
        InputC1_Jack, 
        InputC2_Jack, 
        InputC3_Jack, 
        InputC4_Jack, 
        InputD1_Jack, 
        InputD2_Jack, 
        InputD3_Jack, 
        InputD4_Jack, 
        NumInJacks,
    };
    
    enum {
        OutputOut_1, 
        OutputOut_2, 
        OutputOut_3, 
        OutputOut_4, 
        NumOutJacks,
    };
    
    

};
} // namespace MetaModule
