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

module.exports = (sequelize) => {
    const PatientPhysicalExamination = sequelize.define('patientphysicalexamination', {
        id: {
            type: DataTypes.INTEGER,
            autoIncrement: true,
            primaryKey: true
        },
        creation: { type: DataTypes.DATE, allowNull: false },
        modified: { type: DataTypes.DATE, allowNull: false },
        modified_by: { type: DataTypes.INTEGER, allowNull: false },
        owner: { type: DataTypes.INTEGER, allowNull: false },

        // main
        temperature: { type: DataTypes.FLOAT, allowNull: true },
        pulse: { type: DataTypes.FLOAT, allowNull: true },
        respiratory_rate: { type: DataTypes.FLOAT, allowNull: true },
        blood_pressure: { type: DataTypes.STRING(50), allowNull: true },
        height: { type: DataTypes.FLOAT, allowNull: true },
        weight: { type: DataTypes.FLOAT, allowNull: true },

        // fk
        patient_id: {
            type: DataTypes.INTEGER,
            allowNull: true,
            references: {
                model: 'patients',
                key: 'id'
            }
        },
        nurse_id: {
            type: DataTypes.INTEGER,
            allowNull: true,
            references: {
                model: 'nurses',
                key: 'id'
            }
        },
    }, {
        tableName: 'patientphysicalexaminations',
        freezeTableName: true
    });

    /**
     * Associates the PatientPhysicalExamination model with other models.
     * @param {object} models - The models to associate with.
     * @description
     */
    PatientPhysicalExamination.associate = (models) => {

    };

    return PatientPhysicalExamination;
};
