
import { View } from "@tarojs/components";

import IconVoiceColor from "@/components/icon/icon-voice-color";
import CardList from "@/components/list/card-list";
import CardListItem from "@/components/list/card-list-item";
import IconPeopleColor from "@/components/icon/icon-people-color";
import IconConversationColor from "@/components/icon/icon-conversation-color";
import IconIdeaColor from "@/components/icon/icon-idea-color";

import IconArrow from "@/components/icon/icon-arrow";
import Taro from "@tarojs/taro";
import { useVoiceStore } from "@/store/voiceStore";
import { useAgentStore } from "@/store/agentStore";

export default function Index() {
  
  const agent = useAgentStore((state)=>  state.agent)
  const {setEntId} = useVoiceStore()
  const handleEditVoice = ()=> {
    // 提前设置当前智能体 entId
    setEntId(agent?.entId ?? 0);
    Taro.navigateTo({url: '/pages/voice/index'})
  }
  
  const IconArrowRight = () => {
    return (
      <View className="flex items-center">
        <IconArrow />
      </View>
    );
  };

  return (
    <CardList>
          <CardListItem
            className="pl-16 pr-8"
            underline
            rightRenderer={IconArrowRight}
            leftRenderer={IconVoiceColor}
            onClick={handleEditVoice}
          >
            <View className="text-14 py-18 font-medium leading-22">声音</View>
          </CardListItem>
          <CardListItem
            className="pl-16 pr-8"
            underline
            rightRenderer={IconArrowRight}
            leftRenderer={IconPeopleColor}
            onClick={()=> {
              Taro.navigateTo({url: '/pages/editor-pages/editor-personality/index'})
            }}
          >
            <View className="text-14 py-18 font-medium leading-22">人设</View>
          </CardListItem>
          <CardListItem
            className="pl-16 pr-8"
            underline
            rightRenderer={IconArrowRight}
            leftRenderer={IconConversationColor}
            onClick={()=> {
              Taro.navigateTo({url: '/pages/editor-pages/editor-greeting/index'})
            }}
          >
            <View className="text-14 py-18 font-medium leading-22">开场白</View>
          </CardListItem>
          <CardListItem
            className="pl-16 pr-8"
            rightRenderer={IconArrowRight}
            leftRenderer={IconIdeaColor}
            onClick={()=> {
              Taro.navigateTo({url: '/pages/editor-pages/editor-greeting-questions/index'})
            }}
          >
            <View className="text-14 py-18 font-medium leading-22">
              开场提问引导
            </View>
          </CardListItem>
        </CardList>
  );
}
