<?php

namespace Modules\HospitalPortal\Helpers;

class ApiResponse
{
    public static function apiResponse(string $status, array|object $data = null, string|array|object $message = null, int $statusCode)
    {
        if ($message instanceof \Illuminate\Support\MessageBag) {
            $message = $message->first();
        }
        return response()->json([
                'meta'          => [
                    'status' => $status,
                    'code' => $statusCode,
                    'message' => $message
                ],
                'data' => $data,
            ], $statusCode);
    }
}