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

const Banner = sequelize.define('Banner', {
  id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
  title: { type: DataTypes.STRING(200) },
  subtitle: { type: DataTypes.STRING(200) },
  image: { type: DataTypes.STRING, allowNull: false },
  link: { type: DataTypes.STRING },
  btnText: { type: DataTypes.STRING(50), field: 'btn_text' },
  isActive: { type: DataTypes.BOOLEAN, defaultValue: true, field: 'is_active' },
  sortOrder: { type: DataTypes.INTEGER, defaultValue: 0, field: 'sort_order' },
}, {
  tableName: 'banners',
  timestamps: true,
  underscored: true,
});

module.exports = Banner;
