import { View, Text, Image } from "@tarojs/components";
import DigitalCardBasic from "@/components/DigitalCard/DigitalCardBasic";
import Taro from "@tarojs/taro";
import { TVisitorAgent } from "@/types/visitor";

export interface IndexProps {
  data: {
    certificated?: boolean
    name: string
    company: string
    agentName: string
    
  }&TVisitorAgent;
}

const Index = ({ data }: IndexProps) => {
  const handleClick = ()=> {
    Taro.navigateTo({
      url: `/pages/visiteor-detail/index?visitorId=${data.visitorId}`
    })
  }
  return (
    <View className="bg-white rounded-12 p-12" onClick={handleClick}>
      <View className="flex items-start gap-12">
        <View className="flex items-star rounded-full overflow-hidden">
          <View className="w-56 h-56 bg-gray-3 rounded-full">
            {!!data.avatarUrl && (
              <Image
                src={data.avatarUrl}
                mode="aspectFill"
                className="w-56 h-56 bg-gray-3 rounded-full"
              ></Image>
            )}
          </View>
        </View>
        <View className="flex flex-col gap-8">
          <DigitalCardBasic
            name={data.name}
            position={data.position ?? ""}
            company={data.company}
          />
          <View className="text-14 font-medium leading-22">
            第 <Text className="text-yellow">{data.visitTimes}</Text>{" "}
            次访问了你的智能体【{data.agentName}】
          </View>
          <View className="flex-center text-12 leading-20">
            <View className="flex-1">
              <Text className="text-primary">{data.chatRound}</Text> 轮对话
            </View>
            <View className="text-gray-45 leading-20">{data.lastChatTime}</View>
          </View>
        </View>
      </View>
    </View>
  );
};

export default Index;
