/*
  ==============================================================================

   This file is part of the JUCE framework examples.
   Copyright (c) Raw Material Software Limited

   The code included in this file is provided under the terms of the ISC license
   http://www.isc.org/downloads/software-support-policy/isc-license. Permission
   to use, copy, modify, and/or distribute this software for any purpose with or
   without fee is hereby granted provided that the above copyright notice and
   this permission notice appear in all copies.

   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
   REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
   AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
   INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
   LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
   PERFORMANCE OF THIS SOFTWARE.

  ==============================================================================
*/

import "@fontsource/roboto/300.css";
import "@fontsource/roboto/400.css";
import "@fontsource/roboto/500.css";
import "@fontsource/roboto/700.css";

import Container from "@mui/material/Container";
import * as Juce from "juce-framework-frontend";
import JuceSlider from "./Components/JuceSlider.js";
import JuceCheckbox from "./Components/JuceCheckbox.js";
import MidiNoteInfo from "./Components/MidiNoteInfo.js";
import AutoTuneInfo from "./Components/AutoTuneInfo.js";
import { controlParameterIndexAnnotation } from "./types/JuceTypes.js";

import { React } from "react";

import "./App.css";

function App() {
  const controlParameterIndexUpdater = new Juce.ControlParameterIndexUpdater(
    controlParameterIndexAnnotation
  );

  document.addEventListener("mousemove", (event) => {
    controlParameterIndexUpdater.handleMouseMove(event);
  });

  return (
    <div className="min-h-screen bg-[#0f0f0f] p-4 relative overflow-hidden">
      {/* Controls Grid */}
      <div className="grid grid-cols-3 gap-2 items-start">
        {/* Left Column */}
        <div className="border border-[#2a2a2a] rounded-lg p-4">
          <div className="grid grid-cols-2 grid-rows-2 gap-4 items-end">
            <div>
              <JuceSlider identifier="harmonyMix" title="Mix" />
            </div>
            <div>
              <JuceSlider identifier="formantPreserve" title="Formant" />
            </div>
            <div>
              <JuceSlider identifier="portTime" title="Portamento Speed" />
            </div>
            <div>
              <JuceSlider identifier="panWidth" title="Pan Width" />
            </div>
          </div>
        </div>

        <div className="border border-[#2a2a2a] rounded-lg p-4">
          <div className="grid grid-cols-2 grid-rows-2 gap-4 items-end ">
            <div className="col-span-2">
              <div className="grid grid-rows-2 self-center flex justify-center items-start">
                <div className="self-center justify-center items-center flex">
                  <JuceCheckbox identifier="autoTuneEnabled" />
                </div>
                <div className="mt-1">
                  <AutoTuneInfo />
                </div>
              </div>
            </div>
            <div>
              <JuceSlider identifier="autoTuneSpeed" title="Auto Tune Speed" />
            </div>
            <div>
              <JuceSlider identifier="autoTuneDepth" title="Auto Tune Depth" />
            </div>
          </div>
        </div>

        <div className="border border-[#2a2a2a] rounded-lg p-4">
          <div className="grid grid-cols-2 grid-rows-2 gap-4 items-end">
            <div className="mt-0 pt-0 col-span-2 self-start flex justify-center ">
              <JuceCheckbox identifier="freezeEnabled" />
            </div>
            <div>
              <JuceSlider identifier="freezePitch" title="Freeze Pitch" />
            </div>
            <div>
              <JuceSlider identifier="freezeVolume" title="Freeze Volume" />
            </div>
          </div>
        </div>
      </div>
      <Container></Container>
      <div className="rounded-lg">
        <MidiNoteInfo />
      </div>
    </div>
  );
}

export default App;
