<?php

use Illuminate\Http\JsonResponse;
use Illuminate\Http\Response;

if (!function_exists('successResponse')) {
    function successResponse($data, $message = 'عملیات با موفقیت انجام شد'): JsonResponse
    {
        return response()->json([
            'success' => true,
            'data' => $data,
            'message' => $message
        ]);
    }
}

if (!function_exists('failedResponse')) {
    function failedResponse($message, $code, $status = Response::HTTP_OK): JsonResponse
    {
        return response()->json([
            'success' => false,
            'message' => $message,
            'code' => $code
        ], $status);
    }
}
