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

class FalukantUser extends Model { }

FalukantUser.init({
    userId: {
        type: DataTypes.INTEGER,
        allowNull: false,
        unique: true},
    money: {
        type: DataTypes.DECIMAL(10, 2),
        allowNull: false,
        defaultValue: 0.00},
    creditAmount: {
        type: DataTypes.DECIMAL(10, 2),
        allowNull: false,
        defaultValue: 0.00},
    todayCreditTaken: {
        type: DataTypes.DECIMAL(10, 2),
        allowNull: false,
        defaultValue: 0.00},
    creditInterestRate: {
        type: DataTypes.DECIMAL(5, 2),
        allowNull: false,
        defaultValue: 0.00},
    certificate: {
        type: DataTypes.INTEGER,
        allowNull: false,
        defaultValue: 1},
    mainBranchRegionId: {
        type: DataTypes.INTEGER,
        allowNull: true
    },
    lastNobilityAdvanceAt: {
        type: DataTypes.DATE,
        allowNull: true
    }
}, {
    sequelize,
    modelName: 'FalukantUser',
    tableName: 'falukant_user',
    schema: 'falukant_data',
    timestamps: true,
    underscored: true});

export default FalukantUser;
