'use strict';
const { DataTypes } = require('sequelize');

module.exports = (sequelize) => {
  return sequelize.define('CoinNetwork', {
    id: {
      type: DataTypes.BIGINT.UNSIGNED,
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
    },
    coinId: { type: DataTypes.BIGINT.UNSIGNED, allowNull: false, field: 'coin_id',references: {
          model: 'coins',
          key: 'id',
        }, },
    networkId: { type: DataTypes.BIGINT.UNSIGNED, allowNull: false, field: 'network_id', references: {
          model: 'networks',
          key: 'id',
        }, },
    withdrawalFee: { 
      type: DataTypes.DECIMAL(20,16), 
      defaultValue: 0.00,
      field: 'withdrawal_fee',
        },
    status: { type: DataTypes.BOOLEAN, defaultValue: true },
  }, {
    tableName: 'coin_networks',
    underscored: true,
    timestamps: true,
    paranoid: true,
  });
};
