<?php

namespace Libs;

use React\Http\Message\Response;

class ResponseLib
{
    public static function sendOk($data, $code = "S_OK")
    {
        $reply = [
            'status' => 'ok',
            'msg' => '[100] Request ok.',
            'code' => $code,
            'data' => $data
        ];
        return Response::json($reply);
    }

    public static function sendFail($message, $data = [], $code = "E_GENERIC")
    {
        $reply = [
            'status' => 'failed',
            'msg' => $message,
            'code' => $code,
            'data' => $data
        ];
        return Response::json($reply);
    }
}

