const { DataTypes } = require('sequelize');
const bcrypt = require('bcryptjs');
const db = require('../config/db.config');
const EmployeeDevice = db.define('EmployeeDevice', {
    id: {
        type: DataTypes.INTEGER,
        allowNull: false,
        autoIncrement: true,
        primaryKey: true
    },
    employeeId: {
        type: DataTypes.INTEGER,
        allowNull: false
    },
    deviceId: {
        type: DataTypes.INTEGER,
        allowNull: false
    },
    syncedAt: {
        type: DataTypes.DATE,
        allowNull: true
    },
    syncStatus: {
        type: DataTypes.ENUM("pending", "synced", "failed"),
        allowNull: false,
        defaultValue: "pending"
    },
    syncError: {
        type: DataTypes.STRING(500),
        allowNull: true
    },
}, {
    tableName: 'employee_devices',
    timestamps: true,
    createdAt: 'createdAt',
    updatedAt: 'updatedAt'
});

module.exports = EmployeeDevice;