export default (sequelize, DataTypes) => {
    return sequelize.define('Salary', {
        id: {
            type: DataTypes.INTEGER,
            primaryKey: true,
            autoIncrement: true
        },
        employee_name: {
            type: DataTypes.STRING,
            allowNull: false
        },
        employee_email: {
            type: DataTypes.STRING,
            allowNull: true,
            validate: {
                isEmail: true
            }
        },
        employee_id: {
            type: DataTypes.STRING,
            allowNull: true
        },
        designation: {
            type: DataTypes.STRING,
            allowNull: true
        },
        salary_month: {
            type: DataTypes.STRING,
            allowNull: false
        },
        joining_date: {
            type: DataTypes.DATEONLY,
            allowNull: true
        },
        amount: {
            type: DataTypes.DECIMAL(10, 2),
            allowNull: false,
            defaultValue: 0
        },
        status: {
            type: DataTypes.STRING,
            allowNull: false,
            defaultValue: 'pending'
        },
        salary_year: {
            type: DataTypes.INTEGER,
            allowNull: false
        },
        payment_date: {
            type: DataTypes.DATEONLY,
            allowNull: true
        },
        created_at: {
            type: DataTypes.DATE,
            allowNull: false,
            defaultValue: DataTypes.NOW
        }
    }, {
        tableName: 'salaries',
        timestamps: false
    });
};
