/**
 * BullMQ job payload 类型定义 — 跨 producer / consumer 的契约。
 *
 * 设计约束:
 *   1. 所有 job 必带 (hostId, tenantId) — worker 不读 token,要从 payload 自取 scope
 *   2. 所有 job 必带 triggeredBy — 进 log 表(persona_recompute_logs / plan_generation_logs)
 *   3. payload 只放 id(轻 + 跨进程序列化稳),业务对象由 worker 自己查 DB
 */

export interface PersonaRecomputeJob {
  hostId: string;
  tenantId: string;
  patientId: string;
  /** `txn:<id>` / `manual:<userId>` / `scheduled:<cronId>` */
  triggeredBy: string;
}

export interface PlanRecomputeJob {
  hostId: string;
  tenantId: string;
  patientId: string;
  /** 用于 scenario engine 默认 clinic;空 = 集团统一池路径 */
  clinicId?: string;
  triggeredBy: string;
}

export interface PlanAssetGenerateJob {
  hostId: string;
  tenantId: string;
  planId: string;
  /** 要生成哪些资产;不传 = script + summary 都生成 */
  assets?: Array<'script' | 'summary'>;
  triggeredBy: string;
}

export interface ExecutionCallbackJob {
  hostId: string;
  tenantId: string;
  /** 回执数据由 worker 按此 id 现查(execution → plan → patient);id 也是 eventId / 幂等键 */
  executionId: string;
  triggeredBy: string;
}
