<?php

namespace App\Http\Controllers\Overlays;

use App\Http\Controllers\Controller;
use App\Support\OldenEra;
use App\Support\RigData;

class GameController extends Controller
{
    public function show(RigData $rig, OldenEra $olden)
    {
        $manifest = $rig->loading();
        $isOlden  = ($manifest['gameId'] ?? null) === OldenEra::GAME_ID;
        $oldenManifest = $isOlden ? $olden->manifest() : [];

        return view('overlays.game', [
            'manifest'       => $manifest,
            'olden'          => !empty($oldenManifest) ? $oldenManifest : null,
            'oldenAssetBase' => OldenEra::URL,
            'rigName'        => (string) (config('rig.streamer_nick') ?: 'OPHI118'),
        ]);
    }
}
