const mongoose = require('./mongoose');
const dailySchema = require('./schema-daily')

class DailyFactory {
  static models = {};

  constructor() {
  }

  static async getModel(epgId) {
    if (!epgId) return null;

    let model = DailyFactory.models[epgId];
    if (!model) {
      model = mongoose.model(`Daily-${epgId}`, dailySchema);
      DailyFactory.models[epgId] = model;
    }
    return model;
  }

}

module.exports = DailyFactory;
