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

const Cart = sequelize.define('Cart', {
  id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
  userId: { type: DataTypes.INTEGER, field: 'user_id' },
  sessionId: { type: DataTypes.STRING(100), field: 'session_id' },
  couponId: { type: DataTypes.INTEGER, field: 'coupon_id' },
  discountAmount: { type: DataTypes.DECIMAL(10, 2), defaultValue: 0, field: 'discount_amount' },
}, {
  tableName: 'carts',
  timestamps: true,
  underscored: true,
});

module.exports = Cart;
