/**
 * 业务模型关联配置（模板默认为空实现，按需取消注释或补充）
 * @param {Object} models - 所有模型对象
 */
module.exports = (models) => {
 

  // ========== 订阅模块（biz_*）==========
  const m = models;
  if (m.biz_user && m.biz_subscription) {
    m.biz_user.hasMany(m.biz_subscription, { foreignKey: "user_id", as: "subscriptions" });
    m.biz_subscription.belongsTo(m.biz_user, { foreignKey: "user_id", as: "biz_user" });
  }
  if (m.biz_plan && m.biz_subscription) {
    m.biz_plan.hasMany(m.biz_subscription, { foreignKey: "plan_id", as: "subscriptions" });
    m.biz_subscription.belongsTo(m.biz_plan, { foreignKey: "plan_id", as: "biz_plan" });
  }
  if (m.biz_user && m.biz_api_token) {
    m.biz_user.hasMany(m.biz_api_token, { foreignKey: "user_id", as: "api_tokens" });
    m.biz_api_token.belongsTo(m.biz_user, { foreignKey: "user_id", as: "biz_user" });
  }
  if (m.biz_plan && m.biz_api_token) {
    m.biz_plan.hasMany(m.biz_api_token, { foreignKey: "plan_id", as: "api_tokens" });
    m.biz_api_token.belongsTo(m.biz_plan, { foreignKey: "plan_id", as: "biz_plan" });
  }
  if (m.biz_user && m.biz_usage_monthly) {
    m.biz_user.hasMany(m.biz_usage_monthly, { foreignKey: "user_id", as: "usage_records" });
    m.biz_usage_monthly.belongsTo(m.biz_user, { foreignKey: "user_id", as: "biz_user" });
  }
  if (m.biz_plan && m.biz_usage_monthly) {
    m.biz_plan.hasMany(m.biz_usage_monthly, { foreignKey: "plan_id", as: "usage_records" });
    m.biz_usage_monthly.belongsTo(m.biz_plan, { foreignKey: "plan_id", as: "biz_plan" });
  }
};

