const BaseController = require('./base.controller');
const { ItemLaboratorio, Laboratorio } = require('../models');

class ItemLaboratorioController extends BaseController {
  constructor() {
    super(ItemLaboratorio, 'ItemLaboratorio', ['Name', 'Method']);
  }

  // Obtener por laboratorio
  getByLaboratorio = async (req, res, next) => {
    try {
      const { laboratorioId } = req.params;
      
      const data = await ItemLaboratorio.findAll({
        where: { LaboratorioId: laboratorioId }
      });

      res.json({
        success: true,
        message: 'Items de laboratorio obtenidos exitosamente',
        data
      });
    } catch (error) {
      next(error);
    }
  };
}

module.exports = new ItemLaboratorioController();