const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/database');

const SubscriptionPlanFeature = sequelize.define('SubscriptionPlanFeature', {
  id: {
    type: DataTypes.INTEGER.UNSIGNED,
    primaryKey: true,
    autoIncrement: true,
    comment: '구독-기능 연결 고유 식별자'
  },
  planId: {
    type: DataTypes.INTEGER.UNSIGNED,
    allowNull: false,
    references: {
      model: 'SubscriptionPlans',
      key: 'id'
    },
    comment: '구독 플랜 ID'
  },
  featureId: {
    type: DataTypes.INTEGER.UNSIGNED,
    allowNull: false,
    references: {
      model: 'Features',
      key: 'id'
    },
    comment: '기능 ID'
  },
  status: {
    type: DataTypes.ENUM('active', 'inactive'),
    defaultValue: 'active',
    allowNull: false,
    comment: '상태'
  }
}, {
  tableName: 'SubscriptionPlanFeatures',
  comment: '구독 플랜별 제공 기능 정보를 저장하는 테이블',
  timestamps: true
});

module.exports = SubscriptionPlanFeature;
