<?php

namespace App\Http\Controllers\Api;

use App\Http\Services\AuthService;
use App\Http\Resources\UserResource;
use App\Http\Requests\Profile\UpdateProfileRequest;

class ProfileController
{
    public function __construct(
        protected AuthService $authServices
    ) {
    }

    public function me()
    {
        return respond()->success(new UserResource(auth()->user()));
    }

    public function update(UpdateProfileRequest $request)
    {
        $user = $this->authServices->updateUserById($request->user()->id, $request->validated());

        return respond()->success(
            new UserResource($user),
            __('Update profile done')
        );
    }
}
