import { Injectable } from '@nestjs/common';
import type { FeatureExtractor } from './feature.interface';
import { DoNotContactStatusFeatureExtractor } from './do-not-contact-status.feature';
import { EntitlementStatusFeatureExtractor } from './entitlement-status.feature';
import { RfmFeatureExtractor } from './rfm.feature';
import { AgeBracketFeatureExtractor } from './age-bracket.feature';
import { GenderFeatureExtractor } from './gender.feature';
import { AcquisitionChannelFeatureExtractor } from './acquisition-channel.feature';
import { FamilyStructureFeatureExtractor } from './family-structure.feature';
import { ReferralChampionFeatureExtractor } from './referral-champion.feature';
import { LifecycleStageFeatureExtractor } from './lifecycle-stage.feature';
import { TreatmentHistoryFeatureExtractor } from './treatment-history.feature';
import { TimePreferenceFeatureExtractor } from './time-preference.feature';
import { DiscountAnchorFeatureExtractor } from './discount-anchor.feature';
import { SpecialAttentionFeatureExtractor } from './special-attention.feature';
import { TreatmentSensitivityFeatureExtractor } from './treatment-sensitivity.feature';
import { ContraindicationFeatureExtractor } from './contraindication.feature';

/**
 * FeatureRegistry — 收集所有 PersonaFeature 提取器。
 *
 * W7 重构:统计层 rfm(RFM 8 分群)统一了旧 value(=M)+ recall_risk(=R+缺口)+
 *   treatment_chain_status(降级为详情页 episode 视图,不进画像)→ 三个旧 extractor 已摘除。
 * 现役:rfm(统计层)/ do_not_contact_status(合规)/ entitlement_status(权益,事实投影)。
 * 单个 extractor 抛错不影响其余 — PersonaService 整体记 partial。
 */
@Injectable()
export class FeatureRegistry {
  readonly extractors: FeatureExtractor[];

  constructor(
    rfm: RfmFeatureExtractor,
    age: AgeBracketFeatureExtractor,
    gender: GenderFeatureExtractor,
    acquisition: AcquisitionChannelFeatureExtractor,
    family: FamilyStructureFeatureExtractor,
    referral: ReferralChampionFeatureExtractor,
    lifecycle: LifecycleStageFeatureExtractor,
    treatmentHistory: TreatmentHistoryFeatureExtractor,
    timePref: TimePreferenceFeatureExtractor,
    discountAnchor: DiscountAnchorFeatureExtractor,
    specialAttention: SpecialAttentionFeatureExtractor,
    treatmentSensitivity: TreatmentSensitivityFeatureExtractor,
    contraindication: ContraindicationFeatureExtractor,
    dnc: DoNotContactStatusFeatureExtractor,
    entitlement: EntitlementStatusFeatureExtractor,
  ) {
    this.extractors = [rfm, age, gender, acquisition, family, referral, lifecycle, treatmentHistory, timePref, discountAnchor, specialAttention, treatmentSensitivity, contraindication, dnc, entitlement];
  }
}
