import { View, Text, StyleSheet, ScrollView } from "react-native";
import React, { useState } from "react";
import CreateLyricsHeader from "./components/CreateLyricsHeader";
import { BlurView } from "expo-blur";
import { Palette } from "../../styles";
import { FONT_FAMILY } from "../../styles/Fonts";
import ItemContainer from "../../components/ItemContainer/ItemContainer";
import { CUSTOM_SONG_STRUCTURE } from "../../data/data";
import DragDropTest from "../../components/DragDropTest";

const CustomizeSongStructure = () => {
  const [containerLayout, setContainerLayout] = useState(null);

  return (
    <View style={{ flex: 1, gap: 10, marginTop: 16 }}>
      <CreateLyricsHeader
        title="Personnalise la structure de ta chanson"
        subTitle="Intègre en Drag and drop"
      />
      {/* <View style={{ flex: 1, gap: 10 }}>
        <View
          style={{ flex: 1 }}
          onLayout={(e) => {
            setContainerLayout(e.nativeEvent.layout);
          }}
        >
          <ItemContainer height={containerLayout?.height}>
            <ScrollView contentContainerStyle={{ gap: 10, paddingBottom: 20 }}>
              {["Couplet", "Refrain", "Couplet", "Refrain"].map(
                (item, index) => (
                  <View key={index} style={styles.dropzoneContainer}>
                    <Text style={styles.dropzone}>{item}</Text>
                  </View>
                )
              )}
            </ScrollView>
          </ItemContainer>
        </View>
        <View style={{ flex: 1 }}>
          <ItemContainer height={containerLayout?.height}>
            <ScrollView contentContainerStyle={{ gap: 10, paddingBottom: 20 }}>
              {CUSTOM_SONG_STRUCTURE.map((item, index) => (
                <View key={index} style={styles.itemContainer}>
                  <BlurView
                    intensity={30}
                    style={{
                      flex: 1,
                      backgroundColor: Palette.glass,
                      justifyContent: "center",
                      paddingHorizontal: 12,
                    }}
                  >
                    <Text style={styles.dropzone}>{item}</Text>
                  </BlurView>
                </View>
              ))}
            </ScrollView>
          </ItemContainer>
        </View>
      </View> */}
      <View style={{ flex: 1 }}>
        <DragDropTest />
      </View>
    </View>
  );
};

export default CustomizeSongStructure;

const styles = StyleSheet.create({
  dropzoneContainer: {
    paddingVertical: 14,
    paddingHorizontal: 12,
    backgroundColor: "#00000080",
    borderRadius: 14,
  },
  dropzone: {
    fontSize: 16,
    color: Palette.white,
    fontFamily: FONT_FAMILY.InterRegular,
  },
  itemContainer: {
    height: 54,
    backgroundColor: Palette.glass,
    borderRadius: 14,
    overflow: "hidden",
    shadowColor: "#00000040",
    shadowOffset: {
      width: 0,
      height: 2,
    },
    shadowOpacity: 0.25,
    shadowRadius: 3.84,
    elevation: 5,
  },
});
