<?php

namespace App\Http\Controllers;

use App\Helpers\FirstParty\Credits\CreditsService;
use Illuminate\Support\Facades\Auth;

class UserAccountController extends Controller
{
    public function index()
    {

        $user = Auth::user();
        $user->load('user_usage');
        $user->load('plan');

        return response()->json([
            'success' => [
                'data' => [
                    'user' => $user,
                    'billing' => [
                        'provider' => 'stripe',
                    ],
                    'credits' => CreditsService::balance(Auth::id()),
                ],
            ],
        ]);
    }
}
