import { createI18n } from "vue-i18n";

const messages = {
  zh: {
    common: {
      loading: "正在加载",
      processing: "处理中…",
      refresh: "刷新",
      loadMore: "加载更多",
      copy: "复制",
      copied: "已复制",
      copyFailed: "复制失败",
      requestFailed: "请求失败，请稍后重试",
    },
    header: {
      productLabel: "临时邮箱工作台",
      navigation: "主导航",
      settings: "设置",
    },
    auth: {
      kicker: "私密、限时、可控",
      description:
        "创建真实存在的临时邮箱，实时收取邮件，并由独立访问令牌保护每个收件箱。",
      featureMailbox: "邮箱地址必须由您主动创建",
      featureRealtime: "新邮件通过 WebSocket 实时到达",
      featurePrivacy: "正文净化显示，默认阻止远程追踪图片",
      login: "登录",
      register: "注册",
      logout: "退出登录",
      welcomeBack: "继续管理您的邮箱",
      createAccount: "创建用户账户",
      loginHint: "登录后可恢复邮箱列表与积分记录。",
      registerHint: "注册成功会自动登录并获得初始积分。",
      email: "邮箱",
      password: "密码",
      inviteCode: "邀请码",
      emailPlaceholder: "you{'@'}example.com",
      passwordPlaceholder: "至少 8 个字符",
      invitePlaceholder: "未启用时可留空",
      loginSuccess: "登录成功",
      registerSuccess: "注册成功",
    },
    workspace: {
      account: "用户工作台",
      title: "邮箱与收件箱",
    },
    mailbox: {
      label: "邮箱",
      yours: "我的邮箱",
      none: "未选择邮箱",
      empty: "还没有临时邮箱",
      create: "创建邮箱",
      createFirst: "创建第一个邮箱",
      created: "邮箱创建成功",
      createFailed: "邮箱创建失败",
      selectPrompt: "选择一个有效邮箱查看邮件",
      localPart: "邮箱前缀",
      randomPlaceholder: "留空则随机生成",
      note: "用途备注",
      notePlaceholder: "例如：注册测试账号",
      ttl: "有效期（小时）",
      costNotice: "本次创建将消耗 {cost} 积分，并计入今日创建额度。",
      revoke: "吊销邮箱",
      revokeConfirm:
        "确定吊销 {address}？吊销后将停止收信，且原 token 立即失效。",
      revoked: "邮箱已吊销",
      revokeFailed: "邮箱吊销失败",
      status: {
        active: "使用中",
        expired: "邮箱已过期",
        revoked: "邮箱已吊销",
      },
    },
    mail: {
      inbox: "收件箱",
      empty: "尚未收到邮件",
      selectPrompt: "选择一封邮件查看正文",
      noSubject: "无主题",
      noBody: "这封邮件没有可显示的正文。",
      fetchFailed: "获取邮件列表失败",
      fetchDetailFailed: "获取邮件详情失败",
      delete: "删除邮件",
      deleteConfirm: "确定永久删除这封邮件？邮箱占用容量会同步释放。",
      deleted: "邮件已删除",
      deleteFailed: "删除邮件失败",
      attachments: "附件",
      unnamedAttachment: "未命名附件",
      downloadFailed: "附件下载失败",
      newMail: "收到一封新邮件",
      enableNotifications: "启用浏览器通知",
      notificationsEnabled: "浏览器通知已启用",
      notificationsDenied: "未获得通知权限",
      notificationsUnsupported: "当前浏览器不支持通知",
      remoteImagesBlocked: "为保护隐私，邮件中的远程图片和嵌入内容已被阻止。",
    },
    credits: {
      balance: "积分余额",
      mailboxesToday: "今日邮箱",
      emailsToday: "今日收信",
      history: "积分流水",
      empty: "暂无积分流水",
      summary: "累计获得 {granted}，累计消费 {consumed}",
      balanceAfter: "余额 {balance}",
      checkIn: "签到 +{reward}",
      checkedIn: "今日已签到",
      checkInSuccess: "签到成功，获得 {reward} 积分",
      checkInFailed: "签到失败",
      receiveCost: "每封邮件消耗 {cost} 积分，今日还可接收 {remaining} 封。",
      reasons: {
        register_bonus: "注册赠送",
        daily_check_in: "每日签到",
        create_mailbox: "创建邮箱",
        receive_email: "接收邮件",
        admin_adjust: "管理员调整",
        migration_bonus: "存量账户初始化",
      },
    },
    settings: {
      kicker: "偏好与安全",
      title: "设置",
      language: "界面语言",
      languageHint: "语言设置会保存在当前浏览器。",
      serviceStatus: "服务能力",
      serviceHint: "显示当前后端实际启用的依赖能力。",
      database: "数据库",
      outboundEmail: "外发邮件",
      deleteAccount: "删除账户",
      deleteHint: "账户删除后，全部临时邮箱会立即吊销且无法继续收信。",
      deleteConfirm: "此操作不可恢复。确认删除账户？",
      confirmDelete: "永久删除",
      deleted: "账户已删除",
      deleteFailed: "账户删除失败",
    },
  },
  en: {
    common: {
      loading: "Loading",
      processing: "Processing…",
      refresh: "Refresh",
      loadMore: "Load more",
      copy: "Copy",
      copied: "Copied",
      copyFailed: "Copy failed",
      requestFailed: "Request failed. Please try again.",
    },
    header: {
      productLabel: "Temporary mail workspace",
      navigation: "Main navigation",
      settings: "Settings",
    },
    auth: {
      kicker: "Private, temporary, controlled",
      description:
        "Create real temporary addresses, receive mail live, and protect every inbox with its own access token.",
      featureMailbox: "Every address must be explicitly created by you",
      featureRealtime: "New mail arrives live over WebSocket",
      featurePrivacy: "Sanitized content with remote tracking images blocked",
      login: "Sign in",
      register: "Register",
      logout: "Sign out",
      welcomeBack: "Continue managing your mailboxes",
      createAccount: "Create your account",
      loginHint: "Sign in to restore mailboxes and credit history.",
      registerHint: "Registration signs you in and grants starting credits.",
      email: "Email",
      password: "Password",
      inviteCode: "Invite code",
      emailPlaceholder: "you{'@'}example.com",
      passwordPlaceholder: "At least 8 characters",
      invitePlaceholder: "Leave blank when not required",
      loginSuccess: "Signed in",
      registerSuccess: "Account created",
    },
    workspace: {
      account: "User workspace",
      title: "Mailboxes and inbox",
    },
    mailbox: {
      label: "Mailboxes",
      yours: "My mailboxes",
      none: "No mailbox selected",
      empty: "No temporary mailboxes yet",
      create: "Create mailbox",
      createFirst: "Create your first mailbox",
      created: "Mailbox created",
      createFailed: "Could not create mailbox",
      selectPrompt: "Select an active mailbox to view its mail",
      localPart: "Address prefix",
      randomPlaceholder: "Leave blank for a random address",
      note: "Purpose note",
      notePlaceholder: "For example: test account",
      ttl: "Lifetime (hours)",
      costNotice:
        "Creating this mailbox costs {cost} credits and uses today’s creation quota.",
      revoke: "Revoke mailbox",
      revokeConfirm:
        "Revoke {address}? It will stop receiving mail and its current token will become invalid.",
      revoked: "Mailbox revoked",
      revokeFailed: "Could not revoke mailbox",
      status: {
        active: "Active",
        expired: "Mailbox expired",
        revoked: "Mailbox revoked",
      },
    },
    mail: {
      inbox: "Inbox",
      empty: "No mail yet",
      selectPrompt: "Select a message to inspect it",
      noSubject: "No subject",
      noBody: "This message has no displayable body.",
      fetchFailed: "Could not load messages",
      fetchDetailFailed: "Could not load message details",
      delete: "Delete message",
      deleteConfirm:
        "Permanently delete this message? Its storage usage will be released.",
      deleted: "Message deleted",
      deleteFailed: "Could not delete message",
      attachments: "Attachments",
      unnamedAttachment: "Unnamed attachment",
      downloadFailed: "Attachment download failed",
      newMail: "New message received",
      enableNotifications: "Enable browser notifications",
      notificationsEnabled: "Browser notifications enabled",
      notificationsDenied: "Notification permission was not granted",
      notificationsUnsupported:
        "Notifications are not supported by this browser",
      remoteImagesBlocked:
        "Remote images and embedded content were blocked to protect your privacy.",
    },
    credits: {
      balance: "Credit balance",
      mailboxesToday: "Mailboxes today",
      emailsToday: "Mail today",
      history: "Credit history",
      empty: "No credit activity yet",
      summary: "{granted} granted, {consumed} consumed",
      balanceAfter: "Balance {balance}",
      checkIn: "Check in +{reward}",
      checkedIn: "Checked in today",
      checkInSuccess: "Checked in. {reward} credits granted",
      checkInFailed: "Check-in failed",
      receiveCost:
        "Each message costs {cost} credit(s). {remaining} remaining today.",
      reasons: {
        register_bonus: "Registration bonus",
        daily_check_in: "Daily check-in",
        create_mailbox: "Mailbox created",
        receive_email: "Message received",
        admin_adjust: "Admin adjustment",
        migration_bonus: "Existing account initialization",
      },
    },
    settings: {
      kicker: "Preferences and security",
      title: "Settings",
      language: "Interface language",
      languageHint: "Your language choice is saved in this browser.",
      serviceStatus: "Service capabilities",
      serviceHint: "Capabilities currently enabled by the backend.",
      database: "Database",
      outboundEmail: "Outbound email",
      deleteAccount: "Delete account",
      deleteHint:
        "Deleting your account immediately revokes every temporary mailbox.",
      deleteConfirm: "This cannot be undone. Delete your account?",
      confirmDelete: "Delete permanently",
      deleted: "Account deleted",
      deleteFailed: "Could not delete account",
    },
  },
};

export default createI18n({
  legacy: false,
  locale: "zh",
  fallbackLocale: "en",
  messages,
});
