// /backend/models/PageView.js

const mongoose = require('mongoose');

const PageViewSchema = new mongoose.Schema({
  url: {
    type: String,
    required: true
  },
  idapp: String,
  ip: {
    type: String,
    default: 'unknown'
  },
  userId: String,
  username: String,
  userAgent: {
    type: String
  },
  referrer: String,
  timestamp: {
    type: Date,
    default: Date.now
  }
});

module.exports = mongoose.model('PageView', PageViewSchema);