<?php

require_once 'core/Middleware.php';
require_once 'models/Order.php';

class OrderController {
    // POST /orders
    public function createOutgoing($input) {

        // Validar autenticación
        $Auth = Middleware::requireAuth();
        require_once ($Auth->path.'/configOPFGlobal.php');
        error_log(json_encode($input) , 3, "createOutgoing.log");
        return Order::createOutgoing($input);

    }
    // GET /orders
    public function listOutgoing() {}
    // POST /inbound-orders
    public function createIncoming($input) {
        // Validar autenticación
        $Auth = Middleware::requireAuth();
        require_once ($Auth->path.'/configOPFGlobal.php');
        error_log(json_encode($input) , 3, "logs/createIncoming.log");
        return Order::createIncoming($input);
    }
    // GET /inbound-orders
    public function listIncoming() {}
    
    // BORRAR ORDEN DE ENTTRADA
    public function deleteOE($input) {

        // Validar autenticación
        $Auth = Middleware::requireAuth();
        require_once ($Auth->path.'/configOPFGlobal.php');
        error_log(json_encode($input) , 3, "deleteOE.log");
        return Order::delete_Entrada($input);

    }
    
    // BORRAR ORDEN DE SALIDA
    public function deleteOT($input) {

        // Validar autenticación
        $Auth = Middleware::requireAuth();
        require_once ($Auth->path.'/configOPFGlobal.php');
        error_log(json_encode($input) , 3, "deleteOT.log");
        return Order::delete_Salida($input);

    }
}
