text: "use strict";
  
  const mongoose = require("mongoose"),
    Schema = mongoose.Schema;
  
  /**
   * Quote WEIGHT SCHEMA
   */
  const QuoteWeightSchema = new Schema(
    {
      quote: { type: String, index: true },
      quoteMetadata: { type: Schema.Types.Mixed },
      weight: { type: Number },
    },
    { collection: "recommendations.quoteWeights" }
  );
  
  const QuoteWeightModel = mongoose.model("QuoteWeight", QuoteWeightSchema);
  
  /**
   * USER ACTIVITY SCHEMA
   */
  const UserActivitySchema = new Schema(
    {
      user: { type: String },
      quote: { type: String },
      quoteMetadata: { type: Schema.Types.Mixed },
      action: { type: String },
      dateCreated: { type: Date, default: Date.now },
      lastUpdated: { type: Date, default: Date.now },
    },
    { collection: "recommendations.userActivity" }
  );
  
  UserActivitySchema.index({ user: 1, quote: 1 });
  
  // Set created/updated time
  UserActivitySchema.pre("save", (next) => {
    const now = new Date();
    this.dateCreated = now;
    this.lastUpdated = now;
    next();
  });
  
  /**
   * USER to Quote WEIGHT SCHEMA
   */
  const UserQuoteWeightsSchema = new Schema(
    {
      user: { type: String },
      quoteWeights: { type: [QuoteWeightModel.schema] },
      rowWeight: { type: Number },
    },
    { collection: "recommendations.userQuoteWeights" }
  );
  UserQuoteWeightsSchema.index({ user: 1 });
  
  /**
   * USER SIMILARITY SCHEMA
   */
  const UserSimilaritySchema = new Schema(
    {
      users: { type: [String] },
      similarity: { type: Number },
    },
    { collection: "recommendations.userSimilarities" }
  );
  UserSimilaritySchema.index({ users: 1 });
  
  /**
   * USER RECOMMENDATION SCHEMA
   */
  const UserRecommendationSchema = new Schema(
    {
      user: { type: String },
      recommendations: { type: [QuoteWeightModel.schema] },
    },
    { collection: "recommendations.userRecommendations" }
  );
  UserRecommendationSchema.index({ user: 1 });
  
  /**
   * USER DO NOT RECOMMEND SCHEMA
   */
  const UserDoNotRecommendSchema = new Schema(
    {
      user: { type: String },
      doNotRecommend: [
        {
          quote: { type: String },
          quoteMetadata: { type: Schema.Types.Mixed },
        },
      ],
    },
    { collection: "recommendations.userDoNotRecommend" }
  );
  UserDoNotRecommendSchema.index({ user: 1 });
  
  /**
   * USER ACTIVITY TO IGNORE SCHEMA
   */
  const UserActivityIgnoredSchema = new Schema(
    {
      user: { type: String, index: { unique: true } },
    },
    { collection: "recommendations.userActivityIgnored" }
  );
  
  mongoose.model("UserActivity", UserActivitySchema);
  mongoose.model("UserQuoteWeights", UserQuoteWeightsSchema);
  mongoose.model("UserSimilarity", UserSimilaritySchema);
  mongoose.model("UserRecommendation", UserRecommendationSchema);
  mongoose.model("UserDoNotRecommend", UserDoNotRecommendSchema);
  mongoose.model("UserActivityIgnored", UserActivityIgnoredSchema);
  