<?php

namespace App\Http\Controllers\Api\V1;

use App\Helpers\ApiResponse;
use App\Http\Controllers\Controller;
use App\Services\TenantUserProfileService;
use Illuminate\Http\Request;

class TenantUserProfileController extends Controller
{
    // GET /v1/profiles
    public function index(Request $request)
    {
        return ApiResponse::handle(function () use ($request) {
            return TenantUserProfileService::index($request->all());
        }, '회원 프로필 목록 조회');
    }

    // GET /v1/profiles/{userId}
    public function show($userId)
    {
        return ApiResponse::handle(function () use ($userId) {
            return TenantUserProfileService::show($userId);
        }, '회원 프로필 단건 조회');
    }

    // PATCH /v1/profiles/{userId}
    public function update(Request $request, $userId)
    {
        return ApiResponse::handle(function () use ($request, $userId) {
            return TenantUserProfileService::update($userId, $request->all());
        }, '회원 프로필 수정(관리자)');
    }

    // GET /v1/profiles/me
    public function me(Request $request)
    {
        return ApiResponse::handle(function () use ($request) {
            return TenantUserProfileService::me($request->all());
        }, '내 프로필 조회');
    }

    // PATCH /v1/profiles/me
    public function updateMe(Request $request)
    {
        return ApiResponse::handle(function () use ($request) {
            return TenantUserProfileService::updateMe($request->all());
        }, '내 프로필 수정');
    }
}
