<?php

namespace App\Controllers;

use CodeIgniter\API\ResponseTrait;

class PromoAdmin extends BaseController
{
    use ResponseTrait;
    public function promoList(){
        log_message('critical', "***** ***** PromoAdmin::promoList ****" );

        $raw_json = file_get_contents('php://input');
        $in = json_decode($raw_json, true);
        $out = [];
        $in["action"] = WRENCHBOARD_PROMOADMIN_GETLIST;
        $ret = $this->wrenchboard->wrenchboard_api($in, $out);

        return $this->respond( $this->summaryReturnData($in,$out), 200);
    }

    public function promoActionList(){
        //#define WRENCHBOARD_PROMOADMIN_ACTIONLIST 220016
        log_message('critical', "***** ***** PromoAdmin::promoActionList ****" );

        $raw_json = file_get_contents('php://input');
        $in = json_decode($raw_json, true);
        $out = [];
        $in["action"] = WRENCHBOARD_PROMOADMIN_ACTIONLIST;
        $ret = $this->wrenchboard->wrenchboard_api($in, $out);

        return $this->respond( $this->summaryReturnData($in,$out), 200);
    }

    public function promoAddRef(){
        log_message('critical', "***** ***** PromoAdmin::promoAddRef ****" );
        //  $in = $this->request->getPostGet();
        $raw_json = file_get_contents('php://input');
        $in = json_decode($raw_json, true);
        $out = [];
        $in["action"] = WRENCHBOARD_PROMOADMIN_ADDLIST;
        $ret = $this->wrenchboard->wrenchboard_api($in, $out);

        return $this->respond( $this->summaryReturnData($in,$out), 200);
    }
        public function promoGetMember(){
            log_message('critical', "***** ***** promoGetMember::promoAddRef ****" );
            $raw_json = file_get_contents('php://input');
            $in = json_decode($raw_json, true);
            $out = [];
            $in["action"] = WRENCHBOARD_PROMOADMIN_GETMEMBER;
            $ret = $this->wrenchboard->wrenchboard_api($in, $out);
            return $this->respond( $this->summaryReturnData($in,$out), 200);
    }

    public function promoAssignTask(){
        log_message('critical', "***** ***** promoGetMember::promoAssignTask ****" );
        $raw_json = file_get_contents('php://input');
        $in = json_decode($raw_json, true);
        $out = [];
        $in["action"] = WRENCHBOARD_PROMOADMIN_ASSIGNTASK;
        $ret = $this->wrenchboard->wrenchboard_api($in, $out);
        return $this->respond( $this->summaryReturnData($in,$out), 200);
    }
}
