package kz.cafe;

import kz.cafe.db.*;
import kz.cafe.db.model.*;
import kz.cafe.exceptions.*;

public class TestMassLoad_Dedicated{

   /**
    * @param args
    * @throws UserNotFoundException 
    */
   public static void main(String[] args) throws Exception{
      
      MCafe mCafe         = MongoService.get(MCafe.class, 1);
      MSale mSale         = MongoService.get(MSale.class, 1);
      MNews mNews         = MongoService.get(MNews.class, 1);
      MFeedback mFeedback = MongoService.get(MFeedback.class, 1);
      
      for(int f = 0; f < 300; f++){
         MCafe mCafeNew = new MCafe();
         mCafeNew.ID = MongoService.getUniqueID(MCafe.class);
         mCafeNew.city = mCafe.city;
         mCafeNew.coordinates = mCafe.coordinates;
         mCafeNew.description = mCafe.description;
         mCafeNew.image = mCafe.image;
         mCafeNew.name = mCafe.name;
         mCafeNew.ownerID = mCafe.ownerID;
         mCafeNew.phone = mCafe.phone;
         mCafeNew.price = mCafe.price;
         mCafeNew.rate = mCafe.rate;
         mCafeNew.service = mCafe.service;
         mCafeNew.timeClose = mCafe.timeClose;
         mCafeNew.timeOpen = mCafe.timeOpen;
         mCafeNew.types = mCafe.types;
         
         MongoService.save(mCafeNew);

         
         
         
         
         MSale mSaleNew = new MSale();
         mSaleNew.ID = MongoService.getUniqueID(MSale.class);
         mSaleNew.date_from = mSale.date_from;
         mSaleNew.date_to = mSale.date_to;
         mSaleNew.date_notification = mSale.date_notification;
         mSaleNew.image = mSale.image;
         mSaleNew.name = mSale.name;
         mSaleNew.description = mSale.description;
         mSaleNew.CID = mCafeNew.ID; 
         MongoService.save(mSaleNew);
         
         
         MNews mNewsNew = new MNews();
         mNewsNew.ID = MongoService.getUniqueID(MNews.class);
         mNewsNew.date_notification = mNews.date_notification;
         mNewsNew.image = mNews.image;
         mNewsNew.name = mNews.name;
         mNewsNew.description = mNews.description;
         mNewsNew.CID = mCafeNew.ID; 
         MongoService.save(mNewsNew);
         
         
         
         MFeedback mFeedbackNew = new MFeedback();
         mFeedbackNew.ID = MongoService.getUniqueID(MFeedback.class);
         mFeedbackNew.ownerID = mFeedback.ownerID;
         mFeedbackNew.rate = mFeedback.rate;
         mFeedbackNew.text = mFeedback.text;
         mFeedbackNew.UID = mFeedback.UID;
         mFeedbackNew.CID = mCafeNew.ID; 
         MongoService.save(mFeedbackNew);
      }
      
      
      
      
      
//      for(int f = 0; f < 20; f++){
//         MCafeType mCafeType = new MCafeType();
//         mCafeType.ID = MongoService.getUniqueID(MCafeType.class);
//         mCafeType.name.put(InterfaceConstants.LANGS.RU, "категория"  + f);
//         mCafeType.name.put(InterfaceConstants.LANGS.EN, "category "  + f);
//         mCafeType.name.put(InterfaceConstants.LANGS.UA, "хрю-хрю "   + f);
//         mCafeType.name.put(InterfaceConstants.LANGS.KZ, "фырк-фырк " + f);
//         MongoService.save(mCafeType);
//         
//         for(int i = 0; i < 50; i++){
//            MCafe mCafe = new MCafe();
//            mCafe.ID = MongoService.getUniqueID(MCafe.class);
//            mCafe.name.put(InterfaceConstants.LANGS.RU, "кафе"      + (f * 1000) + i);
//            mCafe.name.put(InterfaceConstants.LANGS.EN, "cafe "     + (f * 1000) + i);
//            mCafe.name.put(InterfaceConstants.LANGS.UA, "харчевня " + (f * 1000) + i);
//            mCafe.name.put(InterfaceConstants.LANGS.KZ, "чай-хана " + (f * 1000) + i);
//            
//            mCafe.type = mCafeType.ID;
//            mCafe.city = 4;
//            mCafe.image = "17.jpg";
//            MongoService.save(mCafe);
//         }
//      }
//      
//      
//      for(MCafe mCafe : MongoService.getList(MCafe.class)){
//         MSale mSale = new MSale();
//         mSale.ID = MongoService.getUniqueID(MSale.class);
//         mSale.CID = mCafe.ID;
//         mSale.name.put(InterfaceConstants.LANGS.RU, "акция"      + System.currentTimeMillis());
//         mSale.name.put(InterfaceConstants.LANGS.EN, "акция "     + System.currentTimeMillis());
//         mSale.name.put(InterfaceConstants.LANGS.UA, "акция " + System.currentTimeMillis());
//         mSale.name.put(InterfaceConstants.LANGS.KZ, "акция " + System.currentTimeMillis());
//         mSale.image = "41.jpg";
//         MongoService.save(mSale);
//         
//         MSale mSale2 = new MSale();
//         mSale2.ID = MongoService.getUniqueID(MSale.class);
//         mSale2.CID = mCafe.ID;
//         mSale2.name.put(InterfaceConstants.LANGS.RU, "акция"      + System.currentTimeMillis());
//         mSale2.name.put(InterfaceConstants.LANGS.EN, "акция "     + System.currentTimeMillis());
//         mSale2.name.put(InterfaceConstants.LANGS.UA, "акция " + System.currentTimeMillis());
//         mSale2.name.put(InterfaceConstants.LANGS.KZ, "акция " + System.currentTimeMillis());
//         mSale2.image = "44.jpg";
//         MongoService.save(mSale2);
//
//         
//         for(int i = 0; i < 50; i++) {
//            MFeedback mFeedback = new MFeedback();
//            mFeedback.ID = MongoService.getUniqueID(MFeedback.class);
//            
//            mFeedback.CID = mCafe.ID;
//            mFeedback.rate = new Double(Math.random() * 4).intValue();
//            
//            mFeedback.text .put(InterfaceConstants.LANGS.RU, "Отзыв"+ System.currentTimeMillis());
//            mFeedback.text.put(InterfaceConstants.LANGS.EN,  "Отзыв"+ System.currentTimeMillis());
//            mFeedback.text.put(InterfaceConstants.LANGS.UA,  "Отзыв"+ System.currentTimeMillis());
//            mFeedback.text.put(InterfaceConstants.LANGS.KZ,  "Отзыв"+ System.currentTimeMillis());
//
//            MongoService.save(mFeedback);
//         }
//      }
   }
}
