<?php

namespace App\Http\Controllers\Api\V1;

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

class TenantFieldSettingController extends Controller
{
    public function index(Request $request)
    {
        return ApiResponse::handle(function () use ($request) {
            return TenantFieldSettingService::index($request->all());
        }, '테넌트 필드 효과값 목록 조회');
    }

    public function bulkUpsert(Request $request)
    {
        return ApiResponse::handle(function () use ($request) {
            return TenantFieldSettingService::bulkUpsert($request->all());
        }, '테넌트 필드 설정 대량 저장');
    }

    public function updateOne(Request $request, string $key)
    {
        return ApiResponse::handle(function () use ($request, $key) {
            return TenantFieldSettingService::updateOne($key, $request->all());
        }, '테넌트 필드 설정 단건 수정');
    }
}
