text: const mongoose = require('mongoose');
  const dbConfig = require('../config/dbConfig');
  const db = require('../models');
  
  const addNewConfig = () => {
  	const newConfig = {
  		name: 'default',
  		menuType: 'top',
  		menuOptions: [
  			{
  				title: 'Create',
  				type: 'create',
  				subOptions: [
  					{
  						optionText: 'Job',
  						title: 'Create Job',
  						type: 'create-job',
  						formData: [
  							{
  								name: 'Job Name',
  								type: 'input',
  								key: 'title'
  							},
  							{
  								name: 'Invoice Total',
  								type: 'input',
  								key: 'invoiceTotal'
  							},
  							{
  								name: 'Customer',
  								type: 'selection',
  								key: 'customer'
  							},
  							{
  								name: 'Complete',
  								type: 'radio',
  								key: 'complete'
  							},
  							{
  								name: 'Paid On',
  								type: 'input',
  								key: 'datePaid'
  							},
  							{
  								name: 'Notes',
  								type: 'text-box',
  								key: 'notes'
  							}
  						]
  					},
  					{
  						optionText: 'Customer',
  						title: 'Create Customer',
  						type: 'create-customer',
  						formData: [
  							{
  								name: 'Name',
  								type: 'input',
  								key: 'name'
  							},
  							{
  								name: 'Phone Number',
  								type: 'input',
  								key: 'phone'
  							},
  							{
  								name: 'Address',
  								type: 'input',
  								key: 'address'
  							}
  						]
  					},
  					{
  						optionText: 'Company',
  						title: 'Create Company',
  						type: 'create-company',
  						formData: [
  							{
  								name: 'Name',
  								type: 'input',
  								key: 'name'
  							}
  						]
  					}
  				]
  			},
  			{
  				title: 'Edit',
  				type: 'edit',
  				subOptions: [
  					{
  						optionText: 'Job',
  						title: 'Edit Job',
  						type: 'edit-job',
  						formData: [
  							{
  								name: 'Job Name',
  								type: 'input',
  								key: 'title'
  							},
  							{
  								name: 'Invoice Total',
  								type: 'input',
  								key: 'invoiceTotal'
  							},
  							{
  								name: 'Customer',
  								type: 'selection',
  								key: 'customer'
  							},
  							{
  								name: 'Complete',
  								type: 'radio',
  								key: 'complete'
  							},
  							{
  								name: 'Paid On',
  								type: 'input',
  								key: 'datePaid'
  							},
  							{
  								name: 'Notes',
  								type: 'text-box',
  								key: 'notes'
  							}
  						]
  					},
  					{
  						optionText: 'Customer',
  						title: 'Edit Customer',
  						type: 'edit-customer',
  						formData: [
  							{
  								name: 'Name',
  								type: 'input',
  								key: 'name'
  							},
  							{
  								name: 'Phone Number',
  								type: 'input',
  								key: 'phone'
  							},
  							{
  								name: 'Address',
  								type: 'input',
  								key: 'address'
  							}
  						]
  					},
  					{
  						optionText: 'Company',
  						title: 'Edit Company',
  						type: 'edit-company',
  						formData: [
  							{
  								name: 'Name',
  								type: 'input',
  								key: 'name'
  							}
  						]
  					}
  				]
  			},
  			{
  				title: 'Reports',
  				type: 'read',
  				subOptions: [
  					{
  						optionText: 'Customer',
  						title: 'Customer Report',
  						type: 'read-customer-report'
  					},
  					{
  						optionText: 'Sales Report',
  						title: 'Sales Report',
  						type: 'read-sales-report'
  					}
  				]
  			}
  		],
  		stats: true
  	};
  
  	db.Config.create(newConfig)
  		.then(res => console.log(res))
  		.catch(err => {
  			console.log(err);
  			process.exit(1);
  		});
  };
  
  mongoose
  	.connect(dbConfig.DB_URI, {
  		useNewUrlParser: true,
  		useUnifiedTopology: true,
  		useCreateIndex: true
  	})
  	.then(() => addNewConfig())
  	.catch(err => {
  		console.log('Unable to connect to DB. Exiting...', err);
  		process.exit(1);
  	});
  