const os = require('os');

const fs = require('fs');

const path = require('path');

require('../config/config');

require('../models/subscribers');

const {ObjectID} = require('mongodb');

const {User} = require('../models/user');
const {MyGroup} = require('../models/mygroup');
const {Booking} = require('../models/booking');
const {Operator} = require('../models/operator');
const {Where} = require('../models/where');
const {MyEvent} = require('../models/myevent');
const {Contribtype} = require('../models/contribtype');
const {PaymentType} = require('../models/paymenttype');
const {Discipline} = require('../models/discipline');
const {Skill} = require('../models/skill');
const {SubSkill} = require('../models/subskill');
const {MySkill} = require('../models/myskill');
const {StatusSkill} = require('../models/statusSkill');
const {City} = require('../models/city');
const {Province} = require('../models/province');
const {Sector} = require('../models/sector');
const {CatGrp} = require('../models/catgrp');
const {Level} = require('../models/level');
const {AdType} = require('../models/adtype');
const Pickup = require('../models/pickup');
const {Newstosent} = require('../models/newstosent');
const {MyPage} = require('../models/mypage');
const {MyBot} = require('../models/bot');
const {CalZoom} = require('../models/calzoom');
const {Gallery} = require('../models/gallery');
const {TemplEmail} = require('../models/templemail');
const {OpzEmail} = require('../models/opzemail');
const {MailingList} = require('../models/mailinglist');
const {Settings} = require('../models/settings');
const {SendMsg} = require('../models/sendmsg');
const {Permission} = require('../models/permission');
const {MsgTemplate} = require('../models/msg_template');
const Product = require('../models/product');
const Producer = require('../models/producer');
const Cart = require('../models/cart');
const OrdersCart = require('../models/orderscart');
const Storehouse = require('../models/storehouse');
const Department = require('../models/department');
const ShareWithUs = require('../models/sharewithus');
const Site = require('../models/site');
const IscrittiConacreis = require('../models/iscrittiConacreis');
const Group = require('../models/group');
const {Todo} = require('../models/todo');
const Hours = require('../models/hours');
const Order = require('../models/order');
const Cash = require('../models/cash');
const CashCategory = require('../models/cashCategory');
const CashSubCategory = require('../models/cashSubCategory');

const tools = require('./general');

module.exports = {

  getTableByTableName(tablename) {

    let mytable = '';
    if (tablename === 'users')
      mytable = User;
    else if (tablename === 'mygroups')
      mytable = MyGroup;
    else if (tablename === 'tessitura')
      mytable = Tessitura;
        // else if (tablename === 'extralist')
    //   mytable = ExtraList;
    else if (tablename === 'bookings')
      mytable = Booking;
    else if (tablename === 'operators')
      mytable = Operator;
    else if (tablename === 'products')
      mytable = Product;
    else if (tablename === 'storehouses')
      mytable = Storehouse;
    else if (tablename === 'departments')
      mytable = Department;
    else if (tablename === 'sharewithus')
      mytable = ShareWithUs;
    else if (tablename === 'sites')
      mytable = Site;
    else if (tablename === 'iscritticonacreis')
      mytable = IscrittiConacreis;
    else if (tablename === 'groups')
      mytable = Group;
    else if (tablename === 'todos')
      mytable = Todo;
    else if (tablename === 'hours')
      mytable = Hours;
    else if (tablename === 'orders')
      mytable = Order;
    else if (tablename === 'cashs')
      mytable = Cash;
    else if (tablename === 'cashCategorys')
      mytable = CashCategory;
    else if (tablename === 'cashSubCategorys')
      mytable = CashSubCategory;
    else if (tablename === 'producers')
      mytable = Producer;
    else if (tablename === 'carts')
      mytable = Cart;
    else if (tablename === 'orderscart')
      mytable = OrdersCart;
    else if (tablename === 'sendmsgs')
      mytable = SendMsg;
    else if (tablename === 'wheres')
      mytable = Where;
    else if (tablename === 'myevents')
      mytable = MyEvent;
    else if (tablename === 'contribtypes')
      mytable = Contribtype;
    else if (tablename === 'paymenttypes')
      mytable = PaymentType;
    else if (tablename === 'disciplines')
      mytable = Discipline;
    else if (tablename === 'newstosent')
      mytable = Newstosent;
    else if (tablename === 'gallery')
      mytable = Gallery;
    else if (tablename === 'mypage')
      mytable = MyPage;
    else if (tablename === 'mybots')
      mytable = MyBot;
    else if (tablename === 'calzoom')
      mytable = CalZoom;
    else if (tablename === 'templemail')
      mytable = TemplEmail;
    else if (tablename === 'opzemail')
      mytable = OpzEmail;
    else if (tablename === 'settings')
      mytable = Settings;
    else if (tablename === 'permissions')
      mytable = Permission;
    else if (tablename === 'mailinglist')
      mytable = MailingList;
    else if (tablename === 'msg_templates')
      mytable = MsgTemplate;
    else if (tablename === 'navepersistente')
      mytable = NavePersistente;
        // else if (tablename === 'listaingressos')
    //   mytable = ListaIngresso;
    else if (tablename === 'graduatorias')
      mytable = Graduatoria;
    else if (tablename === 'skills')
      mytable = Skill;
    else if (tablename === 'subskills')
      mytable = SubSkill;
    else if (tablename === 'myskills')
      mytable = MySkill;
    else if (tablename === 'statusSkills')
      mytable = StatusSkill;
    else if (tablename === 'cities')
      mytable = City;
    else if (tablename === 'provinces')
      mytable = Province;
    else if (tablename === 'sectors')
      mytable = Sector;
    else if (tablename === 'catgrps')
      mytable = CatGrp;
    else if (tablename === 'levels')
      mytable = Level;
    else if (shared_consts.TablePickup.includes(tablename))
      mytable = Pickup;
    //else if (shared_consts.TableCities.includes(tablename))
    // mytable = City;

    return mytable;
  },
};
