<?php

namespace App\Domain\AssetLog\Repository;

use PDO;
use Illuminate\Database\Connection;
use Exception;

/**
 * Repository.
 */
class AssetLogRepository {

    /**
     * @var PDO The database connection
     */
    private $connection;

    /**
     * Constructor.
     *
     * @param PDO $connection The database connection
     */

    public function __construct(Connection $connection) {
        $this->connection = $connection;
    }

    /**
     * Insert user row.
     *
     * @param array $datos de los usuarios
     *
     * @return int The new ID
     */
    
    public function InsertRecord(array $data):array{
       return null;
    }

    /*

    @Params

        int id;
        String assetId;
        String date;
        String type;
        String observation;
        String pdfName;
        string urlFile
    */

    public function SearchRecords():string {
        $payload = $this->connection->table('log_activos as l')
        ->select(

                'l.id_log_act as id',
                'l.fk_id_activo as assetId',
                'l.fecha_hora as date',
                'l.tipo as type',
                'l.observacion as observation',
                'nom_pdf as pdfName',
                'l.url_file as urlFile'

              )->get();
        return $payload;  
    }

    public function DeleteRecord(int $locationId):array {
        return null;
    }

    public function UpdateRecord(array $data):array {
       return null;
    }

}