const mongoose = require('mongoose');
const Permission = require('./Permission'); // Import Permission model

const RoleSchema = new mongoose.Schema({
  name: { type: String, required: true, unique: true }, // e.g., 'admin', 'manager'
  permission: [
    {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Permission', // Reference the Permission collection
    },
  ],
});

module.exports = mongoose.model('Role', RoleSchema);
