// const mongoose = require('mongoose')
// const timestamp = require('mongoose-timestamp')

// const subExpertiseSchema = new mongoose.Schema({
//   id: {
//     type: mongoose.Schema.Types.ObjectId,
//     ref: 'ExpertiseModel'
//   },
//   name: {
//     type: String 
//   }
// })

// const expertiseSchema = new mongoose.Schema({
//   expertise: {
//     type: String,
//     unique: true
//   },
//   sub_expertise: [subExpertiseSchema]
// })

// expertiseSchema.plugin(timestamp)

// const ExpertiseModel = mongoose.model('Expertise', expertiseSchema)
// module.exports = ExpertiseModel

const mongoose = require('mongoose')
const timestamp = require('mongoose-timestamp')

const subExpertiseSchema = new mongoose.Schema({
  name: {
    type: String
  }
})

const expertiseSchema = new mongoose.Schema({
  expertise: {
    type: String,
    unique: true
  },
  sub_expertise: [subExpertiseSchema]
})

expertiseSchema.plugin(timestamp)

const ExpertiseModel = mongoose.model('Expertise', expertiseSchema)
module.exports = ExpertiseModel
