<?php

namespace App\Http\Controllers\api\v1\User;

use App\Http\Controllers\Controller;
use App\Service\User\UserPackageService;
use App\Traits\JsonResponseTrait;
use Illuminate\Http\Request;

class UserPackageController extends Controller
{
    use JsonResponseTrait;
    public function __construct(protected UserPackageService $userPackageService) {}

    /**
     * Get the authenticated user's profile details.
     *
     * @return JsonResponseTrait
     */
    public function createPackage(Request $request)
    {

        // Get all order data from the request
        $packageData = $request->all();
        unset($packageData['auth_user']);
        // Pass the cleaned data to the service
        $this->userPackageService->createPackage($packageData);

        // Return JSON response
        return response()->json([
            'status' => true,
            'message' => 'Package created successfully',
            'data' => $packageData,
        ]);
    }
}
