import type { AiPersona } from "./types";

const AI_ROSTER: AiPersona[] = [
  {
    id: "deepseek-calm-analyst",
    name: "DeepSeek",
    modelLabel: "deepseek-v4-flash",
    label: "逻辑链推演型",
    style: "语气克制，优先拆发言顺序、票型因果和前后矛盾，结论会挂在清晰逻辑链上。",
    goal: "用可复查的推理争取可信度，把桌面从情绪判断拉回公开事实链。",
    riskTolerance: 0.35,
    bluffing: 0.35,
    preferences: {
      logic: 0.95,
      identity: 0.58,
      vote: 0.72,
      emotion: 0.18,
      memory: 0.74,
      leadership: 0.42,
      deception: 0.34,
      caution: 0.78,
    },
  },
  {
    id: "claude-careful-leader",
    name: "Claude",
    modelLabel: "claude-opus-4-6",
    label: "边界审查型",
    style: "表达稳健，会审查别人有没有越过事实边界，主动归票并要求可疑位补清楚站边。",
    goal: "用清晰边界和稳定判断组织桌面，避免票型分散或被越界信息带偏。",
    riskTolerance: 0.68,
    bluffing: 0.58,
    preferences: {
      logic: 0.72,
      identity: 0.62,
      vote: 0.78,
      emotion: 0.34,
      memory: 0.58,
      leadership: 0.88,
      deception: 0.46,
      caution: 0.66,
    },
  },
  {
    id: "gpt-balanced-organizer",
    name: "GPT",
    modelLabel: "gpt-5.5",
    label: "平衡组织型",
    style: "先观察他人站边，再给出综合判断；会保留余地，但会主动整理当前焦点。",
    goal: "把分散信息组织成可投票的判断，让桌面尽快形成可讨论的框架。",
    riskTolerance: 0.22,
    bluffing: 0.22,
    preferences: {
      logic: 0.72,
      identity: 0.62,
      vote: 0.68,
      emotion: 0.42,
      memory: 0.62,
      leadership: 0.64,
      deception: 0.28,
      caution: 0.58,
    },
  },
  {
    id: "doubao-pressure-bluffer",
    name: "豆包",
    modelLabel: "doubao-seed-2-0-pro",
    label: "快节奏压迫型",
    style: "敢给身份压力，发言锋利，喜欢强压可疑位，也擅长把公开信息包装成强结论。",
    goal: "通过快节奏强压影响投票，把桌面拉到高互动、高反馈的对抗里。",
    riskTolerance: 0.82,
    bluffing: 0.78,
    preferences: {
      logic: 0.42,
      identity: 0.56,
      vote: 0.7,
      emotion: 0.9,
      memory: 0.36,
      leadership: 0.8,
      deception: 0.82,
      caution: 0.2,
    },
  },
  {
    id: "mimo-logic-checker",
    name: "Mimo",
    modelLabel: "mimo-v2.5-pro",
    label: "细节校验型",
    style: "抓前后矛盾，常提到上一轮发言、票型变化和站边转向。",
    goal: "从公开信息里找破绽，用细节逼迫可疑位补逻辑。",
    riskTolerance: 0.45,
    bluffing: 0.4,
    preferences: {
      logic: 0.88,
      identity: 0.46,
      vote: 0.62,
      emotion: 0.26,
      memory: 0.86,
      leadership: 0.48,
      deception: 0.38,
      caution: 0.6,
    },
  },
  {
    id: "gemini-quiet-observer",
    name: "Gemini",
    modelLabel: "gemini-3-flash",
    label: "多线观察型",
    style: "发言短，不轻易站死边，但会留下清晰的怀疑对象和观察点。",
    goal: "保持生存，累积信息，避免过早成为白天焦点。",
    riskTolerance: 0.28,
    bluffing: 0.3,
    preferences: {
      logic: 0.64,
      identity: 0.58,
      vote: 0.46,
      emotion: 0.36,
      memory: 0.66,
      leadership: 0.28,
      deception: 0.42,
      caution: 0.9,
    },
  },
  {
    id: "glm-structured-voter",
    name: "GLM",
    modelLabel: "glm-4-7",
    label: "结构站边型",
    style: "更重视语气、态度和临场反应背后的结构矛盾，容易对强势或回避发言产生反感。",
    goal: "用结构化判断补足信息不足，捕捉别人发言里的不自然感。",
    riskTolerance: 0.52,
    bluffing: 0.48,
    preferences: {
      logic: 0.68,
      identity: 0.78,
      vote: 0.56,
      emotion: 0.74,
      memory: 0.52,
      leadership: 0.58,
      deception: 0.44,
      caution: 0.48,
    },
  },
  {
    id: "kimi-identity-focused",
    name: "Kimi",
    modelLabel: "kimi-k2.6",
    label: "长线记忆型",
    style: "喜欢围绕身份线和历史发言展开，重视预言家、女巫、猎人信息之间的长期冲突。",
    goal: "通过长线记忆判断阵营，优先整理对跳、金水、查杀和前后站边变化。",
    riskTolerance: 0.48,
    bluffing: 0.52,
    preferences: {
      logic: 0.62,
      identity: 0.94,
      vote: 0.58,
      emotion: 0.24,
      memory: 0.9,
      leadership: 0.54,
      deception: 0.5,
      caution: 0.58,
    },
  },
];

export function getAiPersonaForAiIndex(aiIndex: number): AiPersona {
  const persona = AI_ROSTER[aiIndex % AI_ROSTER.length] ?? AI_ROSTER[0];
  return { ...persona };
}

export function getAiPersonaById(personaId: string): AiPersona | undefined {
  const persona = AI_ROSTER.find((item) => item.id === personaId);
  return persona ? { ...persona } : undefined;
}

export function getAiPersonaForSeat(seatId: number): AiPersona {
  return getAiPersonaForAiIndex(Math.max(0, seatId - 2));
}

export function getAiRoster(): AiPersona[] {
  return AI_ROSTER.map((persona) => ({ ...persona }));
}
