const Sequelize = require('sequelize');

/**
 * 职位类型表模型
 * 存储不同职位类型的技能关键词和排除关键词配置
 */
module.exports = (db) => {
  const job_types = db.define("job_types", {
    name: {
      comment: '职位类型名称（如：前端开发、后端开发、全栈开发等）',
      type: Sequelize.STRING(100),
      allowNull: false,
      defaultValue: ''
    },
    description: {
      comment: '职位类型描述',
      type: Sequelize.TEXT,
      allowNull: true,
      defaultValue: ''
    },
    commonSkills: {
      comment: '常见技能关键词（JSON数组）',
      type: Sequelize.TEXT,
      allowNull: true,
      defaultValue: '[]'
    },
    excludeKeywords: {
      comment: '排除关键词（JSON数组）',
      type: Sequelize.TEXT,
      allowNull: true,
      defaultValue: '[]'
    },
    is_enabled: {
      comment: '是否启用（1=启用，0=禁用）',
      type: Sequelize.TINYINT(1),
      allowNull: false,
      defaultValue: 1
    },
    sort_order: {
      comment: '排序顺序',
      type: Sequelize.INTEGER,
      allowNull: false,
      defaultValue: 0
    }
  }, {
    timestamps: false,
    indexes: [
      {
        unique: false,
        fields: ['is_enabled']
      },
      {
        unique: false,
        fields: ['name']
      }
    ]
  });

  return job_types;
}

