export default (sequelize, DataTypes) => {
    return sequelize.define('Accountant', {
        id: {
            type: DataTypes.INTEGER,
            primaryKey: true,
            autoIncrement: true
        },
        name: {
            type: DataTypes.STRING,
            allowNull: false
        },
        email: {
            type: DataTypes.STRING,
            allowNull: false,
            unique: true,
            set(value) {
                this.setDataValue('email', value.trim().toLowerCase());
            },
            validate: {
                isEmail: true
            }
        },
       role: {
            type: DataTypes.STRING,
            allowNull: false,
        },
        clients: {
            type: DataTypes.INTEGER,
            allowNull: true,
            // defaultValue: 0
        },
        invoices: {
            type: DataTypes.INTEGER,
            allowNull: true,
            // defaultValue: 0
        },
        status: {
            type: DataTypes.STRING,
            allowNull: false,
            defaultValue: 'active'
        },
        created_at: {
            type: DataTypes.DATE,
            allowNull: false,
            defaultValue: DataTypes.NOW
        }
    }, {
        tableName: 'accountants',
        timestamps: false
    });
};
