const express = require('express');
const router = express.Router();
const Helpers = require('../helpers');

router.post('/simulate', Helpers.wrapAsync(async (req, res) => {
  // Simulate processing time
  await new Promise(resolve => setTimeout(resolve, 1500));

  // Mock extracted data based on a "typical" Ethiopian receipt
  const mockData = {
    invoice_number: 'INV-' + Math.floor(Math.random() * 100000),
    date: new Date().toISOString().split('T')[0],
    total_amount: (Math.random() * 5000 + 100).toFixed(2),
    tax_amount: (Math.random() * 500 + 10).toFixed(2),
    vendor_name: 'Sample Vendor Ltd',
    vendor_tin: '00' + Math.floor(Math.random() * 10000000),
    items: [
      { description: 'General Goods', quantity: 1, unit_price: 100, total: 100 }
    ]
  };

  res.status(200).send(mockData);
}));

module.exports = router;
