<?php

namespace App\Http\Controllers\buildable;

use Fivable\Buildable\Controllers\UserController as BaseUserController;

class UserController extends BaseUserController
{

//    /**
//     * Get all Users
//     * @return JsonResponse
//     */
//    public function index() : JsonResponse
//    {
//        $this->authorizeForUser($this->user(), 'viewIndex', User::class);
//
//        $users = User::indexFor($this->user());
//
//        return response()->json([
//            'users' => $users,
//        ]);
//    }

//    /**
//     * Create a new User
//     * @param Request $request
//     * @return JsonResponse
//     */
//    public function store(Request $request) : JsonResponse
//    {
//        $this->authorizeForUser($this->user(), 'create', User::class, $request->role_mask);
//
//        $newUser = User::create($request->all());
//
//        return response()->json([
//            'new_user' => $newUser,
//        ]);
//    }

//    /**
//     * Retrieve a specific User
//     * @param  User  $user
//     * @return JsonResponse
//     */
//    public function show(User $user) : JsonResponse
//    {
//        $this->authorizeForUser($this->user(), 'view', $user);
//
//        return response()->json([
//            'user' => $user,
//        ]);
//    }

//    /**
//     * Update a specific User
//     * @param  Request  $request
//     * @param  User  $user
//     * @return JsonResponse
//     */
//    public function update(Request $request, User $user) : JsonResponse
//    {
//        // If the role_mask not present in request, pass current mask to skip evaluation in policy
//        $roleMaskToEvaluate = $request->role_mask ?? $user->role_mask;
//
//        $this->authorizeForUser($this->user(), 'update', $user, $roleMaskToEvaluate);
//
//        $user->update($request->all());
//
//        return response()->json([
//            'updated_user' => $user->fresh(),
//        ]);
//    }

//    /**
//     * Delete a specific User
//     * @param  User  $user
//     * @return JsonResponse
//     * @throws \Exception
//     */
//    public function destroy(User $user) : JsonResponse
//    {
//        $this->authorizeForUser($this->user(), 'delete', $user);
//
//        $user->delete();
//
//        return response()->json([
//            'deleted_user' => $user,
//        ]);
//    }
}
