const { STRING, UUID, UUIDV4, INTEGER, DATE } = require('sequelize');

module.exports = (sequelize, DataTypes) => {
    const PasswordResetTokens = sequelize.define(
        'PasswordResetTokens',
        {
            id: {
                type: UUID,
                defaultValue: UUIDV4,
                allowNull: false,
                primaryKey: true,
            },
            email: {
                type: STRING,
                allowNull: false,
            },
            token: {
                type: STRING,
                allowNull: false,
            },
            expires_at: {
                type: DATE,
                allowNull: false,
            },
            createdAt: {
                type: DATE,
                allowNull: false,
                defaultValue: DataTypes.NOW,
            },
        },
        {
            tableName: 'password_reset_tokens',
            timestamps: false,
        },
    );
    return PasswordResetTokens;
};
