const mongoose = require('mongoose')

function catalog(pdf) {
  if (pdf) return '/uploads/pdf/' + pdf
}

const MainCatalogSchema = mongoose.Schema({
  file: {
    fa: {type: String, get: catalog},
    en: {type: String, get: catalog}
  },
  created_at: String,
  updated_at: String
}, {
  toObject: {getters: true},
  toJSON: {getters: true}
})

module.exports = mongoose.model('MainCatalog', MainCatalogSchema)
