<?php

namespace App\Controllers;

use CodeIgniter\API\ResponseTrait;

class WrenchUser extends BaseController
{
    use ResponseTrait;

    public function UsersFiles(){
        $raw_json = file_get_contents('php://input');
        $in = json_decode($raw_json, true);
        $in["action"] =  WRENCHBOARD_MYFILES_LIST;
        $out=[];
        $endpoint = "UPLOADS-USER-". str_replace("-", "_", $in["uid"]);;

        $out = $this->getCache($endpoint);
        if ( count($out)==0 ){
            $ret = $this->wrenchboard->wrenchboard_api($in, $out);
            $this->saveCache($endpoint,$out,15000);
            $out['internal_return'] = $ret;
            log_message('critical', "***** ***** WrenchUser::UsersFiles Cache Done:::Ret ". $ret);
        }
        log_message('critical', "***** ***** WrenchUser::UsersFiles Ret ");
        return $this->respond( $this->summaryReturnData($in,$out), 200);
    }
}

