<?php
require_once 'core/Middleware.php';
require_once 'models/Product.php';

class ProductController {

    // POST /products
    public function create($input) {

        // Validar autenticación
        $Auth = Middleware::requireAuth();
        require_once ($Auth->path.'/configOPFGlobal.php');
        return Product::create($input);

    }

    // PUT /products/{code}
    public function update($input) {

        // Validar autenticación
        $Auth = Middleware::requireAuth();
        require_once ($Auth->path.'/configOPFGlobal.php');
        return Product::update($input);


    }


    // GET /products/stock
    public function getStock() {

        // Validar autenticación
        $Auth = Middleware::requireAuth();
        require_once ($Auth->path.'/configOPFGlobal.php');
        return Product::getStock();


    }

}
