const { DataTypes } = require('sequelize');
const bcrypt = require('bcryptjs');
const db = require('../config/db.config');
const RcAccess = db.define('RcAccess', {
    id: {
        type: DataTypes.INTEGER,
        allowNull: false,
        autoIncrement: true,
        primaryKey: true
    },
    recordId: {
        type: DataTypes.STRING(50),
        allowNull: false,
        unique: true
    },
    deviceKey: { type: DataTypes.STRING(100) },
    personSn: { type: DataTypes.STRING(50) },
    personName: { type: DataTypes.STRING(100) },
    personType: { type: DataTypes.STRING(10) },
    strangerFlag: { type: DataTypes.STRING(5) },
    openDoorFlag: { type: DataTypes.STRING(5) },
    faceFlag: { type: DataTypes.STRING(5) },
    cardFlag: { type: DataTypes.STRING(5) },
    cardNo: { type: DataTypes.STRING(50) },
    fingerFlag: { type: DataTypes.STRING(5) },
    palmFlag: { type: DataTypes.STRING(5) },
    resultFlag: { type: DataTypes.STRING(5) },
    direction: { type: DataTypes.STRING(5) },
    temperature: { type: DataTypes.STRING(10) },
    maskFlag: { type: DataTypes.STRING(5) },
    verifyStyle: { type: DataTypes.STRING(10) },
    voucherCode: { type: DataTypes.STRING(50) },
    idCard: { type: DataTypes.STRING(50) },
    idCardFlag: { type: DataTypes.STRING(5) },
    pwdFlag: { type: DataTypes.STRING(5) },
    capFlag: { type: DataTypes.STRING(5) },
    attach: { type: DataTypes.TEXT },
    checkImgUrl: { type: DataTypes.STRING(500) },
    recordTime: { type: DataTypes.STRING(20) },
    recordTimeStr: { type: DataTypes.STRING(30) },
    personTypeLabel: { type: DataTypes.STRING(20) },
    accessGranted: { type: DataTypes.BOOLEAN },
    receivedAt: { type: DataTypes.DATE },

}, {
    tableName: 'rc_access',
    timestamps: true,
    createdAt: 'createdAt',
    updatedAt: 'updatedAt'
});



module.exports = RcAccess;