/** 与 Laravel {@see AdminAuthorizationRegistry} 中 `prd.*` slug 对齐 */

export const PRD_ADMIN_USER_MANAGE = "prd.admin_user.manage" as const;
export const PRD_ADMIN_ROLE_MANAGE = "prd.admin_role.manage" as const;

export const PRD_USERS_MANAGE = "prd.users.manage" as const;
export const PRD_USERS_VIEW_FINANCE = "prd.users.view_finance" as const;
export const PRD_USERS_VIEW_CS = "prd.users.view_cs" as const;
export const PRD_PLAYER_FREEZE_MANAGE = "prd.player_freeze.manage" as const;

export const PRD_CURRENCY_MANAGE = "prd.currency.manage" as const;

/** 接入站点（与 {@link AdminPermissionLanguage} / config admin_permission_language 对齐） */
export const PRD_INTEGRATION_VIEW = "prd.integration.view" as const;
export const PRD_INTEGRATION_MANAGE = "prd.integration.manage" as const;

export const PRD_WALLET_RECONCILE_MANAGE = "prd.wallet_reconcile.manage" as const;
export const PRD_WALLET_RECONCILE_VIEW = "prd.wallet_reconcile.view" as const;
export const PRD_WALLET_RECONCILE_VIEW_CS = "prd.wallet_reconcile.view_cs" as const;
export const PRD_WALLET_ADJUST_MANAGE = "prd.wallet_adjust.manage" as const;

export const PRD_DRAW_RESULT_MANAGE = "prd.draw_result.manage" as const;
export const PRD_DRAW_RESULT_VIEW = "prd.draw_result.view" as const;
export const PRD_DRAW_REOPEN_MANAGE = "prd.draw_reopen.manage" as const;

export const PRD_PLAY_SWITCH_MANAGE = "prd.play_switch.manage" as const;
export const PRD_ODDS_MANAGE = "prd.odds.manage" as const;
export const PRD_REBATE_MANAGE = "prd.rebate.manage" as const;
export const PRD_REBATE_VIEW = "prd.rebate.view" as const;
export const PRD_RISK_CAP_MANAGE = "prd.risk_cap.manage" as const;
export const PRD_RISK_CAP_VIEW = "prd.risk_cap.view" as const;
export const PRD_JACKPOT_MANAGE = "prd.jackpot.manage" as const;
export const PRD_JACKPOT_VIEW = "prd.jackpot.view" as const;
/** 超管紧急手动爆池（产品文档 §5.13） */
export const PRD_JACKPOT_MANUAL_BURST = "prd.jackpot.manual_burst" as const;

export const PRD_PAYOUT_MANAGE = "prd.payout.manage" as const;
export const PRD_PAYOUT_REVIEW = "prd.payout.review" as const;
export const PRD_PAYOUT_VIEW = "prd.payout.view" as const;

export const PRD_AUDIT_VIEW = "prd.audit.view" as const;
export const PRD_DASHBOARD_VIEW = "prd.dashboard.view" as const;
export const PRD_REPORT_VIEW = "prd.report.view" as const;
export const PRD_REPORT_EXPORT = "prd.report.export" as const;
export const PRD_TICKETS_VIEW = "prd.tickets.view" as const;
export const PRD_RISK_VIEW = "prd.risk.view" as const;
export const PRD_RISK_MANAGE = "prd.risk.manage" as const;
export const PRD_ODDS_VIEW = "prd.odds.view" as const;

/** 钱包补单/冲正（冲正、补入账、手工结案等会影响资金状态的动作） */
export const PRD_WALLET_WRITE_ANY = [PRD_WALLET_ADJUST_MANAGE, PRD_WALLET_RECONCILE_MANAGE] as const;

/** 玩家列表页（与侧栏 requiredAny 一致） */
export const PRD_PLAYERS_ACCESS_ANY = [
  PRD_USERS_MANAGE,
  PRD_USERS_VIEW_FINANCE,
  PRD_USERS_VIEW_CS,
  PRD_PLAYER_FREEZE_MANAGE,
] as const;

/** 注单列表页 */
export const PRD_TICKETS_ACCESS_ANY = [PRD_TICKETS_VIEW] as const;

/** 仪表盘 */
export const PRD_DASHBOARD_ACCESS_ANY = [PRD_DASHBOARD_VIEW] as const;

/** 风控中心（含期号内风控页） */
export const PRD_RISK_ACCESS_ANY = [
  PRD_RISK_VIEW,
  PRD_RISK_MANAGE,
  PRD_DRAW_RESULT_VIEW,
  PRD_DRAW_RESULT_MANAGE,
] as const;

/** 报表查看 / 导出 */
export const PRD_REPORTS_VIEW_ACCESS_ANY = [PRD_REPORT_VIEW] as const;
export const PRD_REPORTS_EXPORT_ACCESS_ANY = [PRD_REPORT_EXPORT] as const;

/** 仪表盘趋势/排行（后端 analytics 需 dashboard.view；站点另有 report.view） */
export const PRD_DASHBOARD_ANALYTICS_ACCESS_ANY = [
  PRD_DASHBOARD_VIEW,
  ...PRD_REPORTS_VIEW_ACCESS_ANY,
] as const;

/** 系统设置（与后端 admin.settings.* 资源口径一致） */
export const PRD_SETTINGS_ACCESS_ANY = [
  PRD_WALLET_RECONCILE_MANAGE,
  PRD_REBATE_MANAGE,
  PRD_REBATE_VIEW,
  PRD_PAYOUT_MANAGE,
] as const;

/** 钱包流水 */
export const PRD_WALLET_TX_ACCESS_ANY = [
  PRD_WALLET_RECONCILE_MANAGE,
  PRD_WALLET_RECONCILE_VIEW,
  PRD_WALLET_RECONCILE_VIEW_CS,
] as const;

/** 转账订单 */
export const PRD_WALLET_TRANSFER_ACCESS_ANY = [
  ...PRD_WALLET_TX_ACCESS_ANY,
  PRD_WALLET_ADJUST_MANAGE,
] as const;

/** 报表中心页（含资金/风控/审计类导出报表入口） */
export const PRD_REPORTS_PAGE_ACCESS_ANY = [
  PRD_REPORT_VIEW,
  PRD_REPORT_EXPORT,
  ...PRD_WALLET_TRANSFER_ACCESS_ANY,
  ...PRD_RISK_ACCESS_ANY,
  PRD_AUDIT_VIEW,
] as const;

/** 单玩家钱包查询 */
export const PRD_WALLET_PLAYER_ACCESS_ANY = [
  PRD_USERS_VIEW_FINANCE,
  ...PRD_WALLET_TX_ACCESS_ANY,
] as const;

/** 赔率与基础回水配置页 */
export const PRD_RULES_ODDS_ACCESS_ANY = [
  PRD_ODDS_MANAGE,
  PRD_ODDS_VIEW,
  PRD_REBATE_MANAGE,
  PRD_REBATE_VIEW,
] as const;

/** 投注规则配置页 */
export const PRD_RULES_PLAYS_ACCESS_ANY = [
  PRD_PLAY_SWITCH_MANAGE,
  PRD_ODDS_MANAGE,
  PRD_ODDS_VIEW,
] as const;

/** 开奖页面入口 */
export const PRD_DRAW_ACCESS_ANY = [
  PRD_DRAW_RESULT_VIEW,
  PRD_DRAW_RESULT_MANAGE,
  PRD_DRAW_REOPEN_MANAGE,
] as const;

/** 封顶配置页 */
export const PRD_RISK_CAP_ACCESS_ANY = [PRD_RISK_CAP_MANAGE, PRD_RISK_CAP_VIEW] as const;

/** Jackpot 配置页 */
export const PRD_JACKPOT_ACCESS_ANY = [PRD_JACKPOT_MANAGE, PRD_JACKPOT_VIEW] as const;

/** 派彩 / 结算页面入口 */
export const PRD_PAYOUT_ACCESS_ANY = [
  PRD_PAYOUT_VIEW,
  PRD_PAYOUT_REVIEW,
  PRD_PAYOUT_MANAGE,
] as const;

/** 期号内「资金」Tab（开奖管理或财务/报表视角） */
export const PRD_DRAW_FINANCE_ACCESS_ANY = [
  PRD_DRAW_RESULT_MANAGE,
  PRD_PAYOUT_VIEW,
  PRD_PAYOUT_MANAGE,
  PRD_PAYOUT_REVIEW,
  PRD_REPORT_VIEW,
  PRD_USERS_VIEW_FINANCE,
] as const;

/** 接入站点配置页 */
export const PRD_INTEGRATION_ACCESS_ANY = [PRD_INTEGRATION_VIEW, PRD_INTEGRATION_MANAGE] as const;

/** 运营配置首页 */
export const PRD_CONFIG_HUB_ACCESS_ANY = [
  ...PRD_RULES_PLAYS_ACCESS_ANY,
  ...PRD_RULES_ODDS_ACCESS_ANY,
  ...PRD_JACKPOT_ACCESS_ANY,
  ...PRD_RISK_CAP_ACCESS_ANY,
  ...PRD_INTEGRATION_ACCESS_ANY,
] as const;

/** 代理管理 */
export const PRD_AGENT_VIEW = "prd.agent.view" as const;
export const PRD_AGENT_MANAGE = "prd.agent.manage" as const;
export const PRD_AGENT_ROLE_VIEW = "prd.agent.role.view" as const;
export const PRD_AGENT_ROLE_MANAGE = "prd.agent.role.manage" as const;
export const PRD_AGENT_USER_VIEW = "prd.agent.user.view" as const;
export const PRD_AGENT_USER_MANAGE = "prd.agent.user.manage" as const;

export const PRD_AGENT_LINE_PROVISION = "prd.agent-line.provision" as const;
export const PRD_AGENT_PROFILE_MANAGE = "prd.agent.profile.manage" as const;

/**
 * 运营配置「接入站点」入口：仅平台侧技术配置。
 * 不含 prd.agent.view|manage，避免经营代理看到接入密钥。
 */
export const PRD_AGENT_SITES_ACCESS_ANY = [...PRD_INTEGRATION_ACCESS_ANY] as const;

export const PRD_AGENTS_ACCESS_ANY = [
  PRD_AGENT_VIEW,
  PRD_AGENT_MANAGE,
  PRD_AGENT_ROLE_VIEW,
  PRD_AGENT_ROLE_MANAGE,
  PRD_AGENT_USER_VIEW,
  PRD_AGENT_USER_MANAGE,
  PRD_AGENT_PROFILE_MANAGE,
] as const;

/** 仅平台开通新线路；经营代理的 prd.agent.manage 不含开通线路页。 */
export const PRD_AGENT_LINE_PROVISION_ACCESS_ANY = [PRD_AGENT_LINE_PROVISION] as const;

export const PRD_SETTLEMENT_AGENT_VIEW = "prd.settlement.agent.view" as const;
export const PRD_SETTLEMENT_AGENT_MANAGE = "prd.settlement.agent.manage" as const;

export const PRD_SETTLEMENT_AGENT_ACCESS_ANY = [
  PRD_SETTLEMENT_AGENT_VIEW,
  PRD_SETTLEMENT_AGENT_MANAGE,
] as const;

/** 侧栏「代理线路」分组：含经营、开通、接入配置、代理账单任一权限即可见入口 */
export const PRD_AGENT_HUB_ACCESS_ANY = [
  ...PRD_AGENTS_ACCESS_ANY,
  PRD_AGENT_LINE_PROVISION,
  ...PRD_INTEGRATION_ACCESS_ANY,
  PRD_SETTLEMENT_AGENT_VIEW,
  PRD_SETTLEMENT_AGENT_MANAGE,
] as const;
