import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';

class MoneyFlow extends Model { }

MoneyFlow.init({
    falukantUserId: {
        type: DataTypes.INTEGER,
        allowNull: false},
    activity: {
        type: DataTypes.STRING,
        allowNull: false},
    moneyBefore: {
        type: DataTypes.DOUBLE,
        allowNull: false},
    moneyAfter: {
        type: DataTypes.DOUBLE,
        allowNull: true},
    time: {
        type: DataTypes.DATE,
        allowNull: false,
        defaultValue: DataTypes.NOW
    },  
    changeValue: {
        type: DataTypes.DOUBLE,
        allowNull: false},
    changedBy: {
        type: DataTypes.INTEGER,
        allowNull: true}}, {
    sequelize,
    modelName: 'MoneyFlow',
    tableName: 'moneyflow',
    schema: 'falukant_log',
    timestamps: false,
    underscored: true});

export default MoneyFlow;
