import { View, Text, Image } from "@tarojs/components";
import DigitalCardBasic from "@/components/DigitalCard/DigitalCardBasic";
import { TVisitorAgent } from "@/types/visitor";
import TagCertificated from "@/components/tag-certificated";
import Taro from "@tarojs/taro";
import { AvatarMedia } from '@/components/AvatarMedia';
export interface IndexProps {
  data: TVisitorAgent;
}

const VisitorSummary = ({ data }: IndexProps) => {
  return (
    <View className="w-full p-12">
      <View className="flex items-center gap-12">
        <View className="flex items-center rounded-full overflow-hidden" onClick={() => {
          Taro.navigateTo({
            url: `/pages/profile/index?agentId=${data.agentId}`,
          })
        }}>
          <View className="w-60 h-60 bg-gray-3 rounded-full">
            <AvatarMedia source={data.avatarUrl || ''} mode="aspectFill"
                className="w-60 h-60 bg-gray-3 rounded-full"></AvatarMedia>
          </View>
        </View>
        <View className="flex flex-col gap-8">
          <View className="flex items-start">
            <View className="flex flex-col flex-1">
              <View className="flex items-end gap-8">
                <View className="text-24 font-medium leading-32">{data.name}</View>
                <View className="text-12 leading-20">{data.position ?? ""}</View>
              </View>
              <View className="flex items-center gap-2">
                <View className="text-12 leading-20 truncate max-w-[188px]">{data?.entName || ''}</View>
                {data.isEnt && <TagCertificated />}
              </View>
            </View>
          </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 VisitorSummary;
