import { InjectQueue } from "@nestjs/bullmq";
import { Injectable } from "@nestjs/common";
import EventBus from "@server/utils/event-bus";
import { Queue } from "bullmq";
import { ObjectType } from "@nice/common";
import { QueueJobType } from "../types";
@Injectable()
export class PostProcessService {
    constructor(
        @InjectQueue('general') private generalQueue: Queue
    ) {
        
    }

    private generateJobId(type: ObjectType, data: any): string {
        // 根据类型和相关ID生成唯一的job标识
        switch (type) {
            case ObjectType.ENROLLMENT:
                return `stats_${type}_${data.courseId}`;
            case ObjectType.LECTURE:
                return `stats_${type}_${data.courseId}_${data.sectionId}`;
            case ObjectType.POST:
                return `stats_${type}_${data.courseId}`;
            default:
                return `stats_${type}_${Date.now()}`;
        }
    }
}