import { defineStore } from 'pinia'
import { ref, computed } from 'vue'

export const useAgentStore = defineStore('agent', () => {
  // 智能体列表
  const agents = ref([
    {
      id: 'default',
      name: '泰豪AI助手',
      description: '通用AI智能助手，可以回答各类问题',
      icon: '🤖',
      color: '#7c3aed',
      category: 'office',
      usage: 25000
    },
    {
      id: 'xiaohongshu',
      name: '小红书文案生成',
      description: '一键生成爆款小红书文案，支持多种风格，自动添加热门话题标签',
      icon: '📕',
      color: '#ff2442',
      category: 'content',
      usage: 12580
    },
    {
      id: 'contract',
      name: '泰豪合同助手',
      description: '智能合同审核、条款分析、风险提示，提高合同处理效率',
      icon: '📄',
      color: '#7c3aed',
      category: 'business',
      usage: 8320
    },
    {
      id: 'video',
      name: '泰豪短视频助手',
      description: '短视频脚本创作、文案优化、热门话题推荐',
      icon: '🎬',
      color: '#10b981',
      category: 'content',
      usage: 5640
    },
    {
      id: 'email',
      name: '邮件写作助手',
      description: '商务邮件、会议邀请、工作汇报等各类邮件智能生成',
      icon: '✉️',
      color: '#6366f1',
      category: 'office',
      usage: 7230
    },
    {
      id: 'translate',
      name: '多语言翻译',
      description: '支持中英日韩等多语言互译，专业术语精准翻译',
      icon: '🌐',
      color: '#14b8a6',
      category: 'office',
      usage: 11200
    }
  ])

  // 当前选中的智能体ID
  const currentAgentId = ref('default')

  // 当前智能体
  const currentAgent = computed(() => {
    return agents.value.find(a => a.id === currentAgentId.value) || agents.value[0]
  })

  // 设置当前智能体
  const setCurrentAgent = (agentId) => {
    const agent = agents.value.find(a => a.id === agentId)
    if (agent) {
      currentAgentId.value = agentId
    }
  }

  // 添加新智能体
  const addAgent = (agent) => {
    agents.value.push(agent)
  }

  return {
    agents,
    currentAgentId,
    currentAgent,
    setCurrentAgent,
    addAgent
  }
})
