import type { UserPortrait, UserCategory, UserTag, UserSegment } from "@/types/user-portrait"

// 模拟用户数据
export const getUsers = (): UserPortrait[] => {
  return [
    {
      id: "1",
      name: "张三",
      nickname: "小张",
      phone: "13812345678",
      imei: "123456789012345",
      idNumber: "310************123",
      source: "微信",
      sourceDetail: "朋友圈广告",
      registerDate: "2023-05-15",
      lastActive: "2023-07-20",
      value: "high",
      spendingCapacity: "高",
      spendingLevel: "A",
      spendingAmount: "¥15,000",
      address: "上海市浦东新区张江高科技园区",
      tags: ["潜在客户", "对产品感兴趣", "高消费", "科技爱好者"],
      status: "active",
      entryPoint: "首页Banner",
      behavior: ["浏览产品", "加入购物车", "咨询客服", "分享商品"],
    },
    {
      id: "2",
      name: "李四",
      nickname: "阿四",
      phone: "13987654321",
      imei: "987654321098765",
      idNumber: "440************456",
      source: "抖音",
      sourceDetail: "短视频推广",
      registerDate: "2023-04-10",
      lastActive: "2023-07-18",
      value: "medium",
      spendingCapacity: "中",
      spendingLevel: "B",
      spendingAmount: "¥8,500",
      address: "广州市天河区珠江新城",
      tags: ["新用户", "已咨询", "中等消费", "时尚爱好者"],
      status: "active",
      entryPoint: "推荐页",
      behavior: ["浏览产品", "收藏商品", "比较价格"],
    },
    {
      id: "3",
      name: "王五",
      nickname: "老王",
      phone: "13765432198",
      imei: "456789012345678",
      idNumber: "110************789",
      source: "小红书",
      sourceDetail: "博主推荐",
      registerDate: "2023-03-05",
      lastActive: "2023-05-25",
      value: "low",
      spendingCapacity: "低",
      spendingLevel: "C",
      spendingAmount: "¥3,200",
      address: "北京市朝阳区三里屯",
      tags: ["已购买", "需要跟进", "低消费", "美妆爱好者"],
      status: "inactive",
      entryPoint: "搜索结果",
      behavior: ["浏览产品", "查看评价", "放弃购买"],
    },
    {
      id: "4",
      name: "赵六",
      nickname: "六子",
      phone: "13654321987",
      imei: "789012345678901",
      idNumber: "510************012",
      source: "官网",
      sourceDetail: "搜索引擎",
      registerDate: "2023-02-20",
      lastActive: "2023-07-19",
      value: "high",
      spendingCapacity: "高",
      spendingLevel: "A+",
      spendingAmount: "¥25,000",
      address: "成都市高新区天府大道",
      tags: ["VIP客户", "高频购买", "高消费", "数码爱好者"],
      status: "active",
      entryPoint: "直接访问",
      behavior: ["浏览产品", "购买商品", "评价商品", "推荐给朋友"],
    },
    {
      id: "5",
      name: "钱七",
      nickname: "钱多多",
      phone: "13543219876",
      imei: "890123456789012",
      idNumber: "330************345",
      source: "微信",
      sourceDetail: "公众号推文",
      registerDate: "2023-01-15",
      lastActive: "2023-04-10",
      value: "medium",
      spendingCapacity: "中",
      spendingLevel: "B+",
      spendingAmount: "¥12,000",
      address: "杭州市西湖区文三路",
      tags: ["已流失", "需要挽回", "中等消费", "旅游爱好者"],
      status: "lost",
      entryPoint: "活动页面",
      behavior: ["浏览产品", "加入购物车", "放弃购买"],
    },
  ]
}

// 获取用户分类
export const getUserCategories = (): UserCategory[] => {
  return [
    {
      id: "1",
      name: "高价值用户",
      description: "消费能力强，购买频率高的用户",
      count: 32456,
      criteria: [{ field: "value", operator: "equals", value: "high" }],
    },
    {
      id: "2",
      name: "活跃用户",
      description: "近30天内有活动的用户",
      count: 78452,
      criteria: [{ field: "status", operator: "equals", value: "active" }],
    },
    {
      id: "3",
      name: "流失风险用户",
      description: "30-90天未活动的用户",
      count: 15689,
      criteria: [{ field: "status", operator: "equals", value: "inactive" }],
    },
    {
      id: "4",
      name: "已流失用户",
      description: "90天以上未活动的用户",
      count: 8765,
      criteria: [{ field: "status", operator: "equals", value: "lost" }],
    },
  ]
}

// 获取用户标签
export const getUserTags = (): UserTag[] => {
  return [
    {
      id: "1",
      name: "高消费",
      category: "消费能力",
      count: 32456,
      description: "月均消费金额超过10000元的用户",
    },
    {
      id: "2",
      name: "科技爱好者",
      category: "兴趣爱好",
      count: 45678,
      description: "对科技产品有浓厚兴趣的用户",
    },
    {
      id: "3",
      name: "时尚爱好者",
      category: "兴趣爱好",
      count: 38765,
      description: "对时尚产品有浓厚兴趣的用户",
    },
    {
      id: "4",
      name: "美妆爱好者",
      category: "兴趣爱好",
      count: 42345,
      description: "对美妆产品有浓厚兴趣的用户",
    },
    {
      id: "5",
      name: "数码爱好者",
      category: "兴趣爱好",
      count: 36789,
      description: "对数码产品有浓厚兴趣的用户",
    },
    {
      id: "6",
      name: "旅游爱好者",
      category: "兴趣爱好",
      count: 28976,
      description: "对旅游产品有浓厚兴趣的用户",
    },
  ]
}

// 获取用户分群
export const getUserSegments = (): UserSegment[] => {
  return [
    {
      id: "1",
      name: "高价值潜在客户",
      description: "高消费能力但尚未购买的用户",
      count: 12456,
      criteria: [
        { field: "value", operator: "equals", value: "high" },
        { field: "tags", operator: "contains", value: "潜在客户" },
      ],
    },
    {
      id: "2",
      name: "高频购买VIP",
      description: "高频次购买的VIP用户",
      count: 8765,
      criteria: [
        { field: "value", operator: "equals", value: "high" },
        { field: "tags", operator: "contains", value: "VIP客户" },
      ],
    },
    {
      id: "3",
      name: "流失风险高价值",
      description: "有流失风险的高价值用户",
      count: 3456,
      criteria: [
        { field: "value", operator: "equals", value: "high" },
        { field: "status", operator: "equals", value: "inactive" },
      ],
    },
    {
      id: "4",
      name: "待挽回用户",
      description: "已流失但有挽回价值的用户",
      count: 5678,
      criteria: [
        { field: "status", operator: "equals", value: "lost" },
        { field: "tags", operator: "contains", value: "需要挽回" },
      ],
    },
  ]
}
