const { DataTypes } = require('sequelize');
const Coin = require('./Coin');

module.exports = (sequelize) => {
    const SymbolStats = sequelize.define('SymbolStats', {
        id: {
            type: DataTypes.BIGINT,
            autoIncrement: true,
            allowNull: false,
            primaryKey: true,
        },
        asset_id: {
            type: DataTypes.BIGINT,
            unique: true,
            references:{
                model: 'market_pairs',
                key: 'id'
            }
        },
        current_price: {
            type: DataTypes.DECIMAL(20, 10),
            allowNull: false,
        },
        high24h: {
            type: DataTypes.DECIMAL(20, 10),
            allowNull: false,
        },
        low24h: {
            type: DataTypes.DECIMAL(20, 10),
            allowNull: false,
        },
        open24h: {
            type: DataTypes.DECIMAL(20, 10),
            allowNull: false,
        },
        volume24h: {
            type: DataTypes.DECIMAL(28, 10),
            allowNull: false,
        },
        change24h: {
            type: DataTypes.DECIMAL(20, 10),
            allowNull: false,
        },
        change_percent24h: {
            type: DataTypes.DECIMAL(10, 4),
            allowNull: false,
        }
    }, {
        tableName: 'symbol_stats',
        timestamps: true,
        createdAt: false,
        updatedAt: 'updated_at',
    });
    return SymbolStats
}