import {
  AudienceSegmentEntity,
  SegmentUsageType,
} from '../entities/audience-segment.entity';

export const AUDIENCE_SEGMENT_REPOSITORY = Symbol('AUDIENCE_SEGMENT_REPOSITORY');

/**
 * 人群包仓储接口
 */
export interface AudienceSegmentRepository {
  /**
   * 保存人群包
   */
  save(segment: AudienceSegmentEntity): Promise<AudienceSegmentEntity>;

  /**
   * 根据 ID 查找
   */
  findById(id: string): Promise<AudienceSegmentEntity | null>;

  /**
   * 查找所有人群包
   */
  findAll(params?: {
    usageType?: SegmentUsageType;
    isEnabled?: boolean;
    limit?: number;
    offset?: number;
  }): Promise<AudienceSegmentEntity[]>;

  /**
   * 根据用途类型查找
   */
  findByUsageType(usageType: SegmentUsageType): Promise<AudienceSegmentEntity[]>;

  /**
   * 统计人群包数量
   */
  count(params?: {
    usageType?: SegmentUsageType;
    isEnabled?: boolean;
  }): Promise<number>;

  /**
   * 删除人群包
   */
  delete(id: string): Promise<void>;

  /**
   * 更新预估用户数
   */
  updateEstimatedUsers(id: string, count: number): Promise<void>;
}
