<?php

namespace App\Http\Controllers;

use App\Enum\UserType;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class ProfileController extends Controller
{
    public function __construct()
    {

    }

    /**
     * Display the specified resource.
     *
     * @param int $id
     * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\never|Response|Responsе
     * @throws \Exception
     */
    public function show($username)
    {
        $user = User::where('username', $username)->firstOrFail();

        return match ($user->type) {
            UserType::ARTIST->value => (new ArtistController())->show($username),
            UserType::MANAGER->value => (new ManagerController())->show($username),
            UserType::ORGANIZER->value => (new OrganizerController())->show($username),
            default => throw new \Exception('Unexpected value'),
        };
    }
}
