<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Services\ConferenceService;

class ConferenceAboutController extends Controller
{
    protected $conferenceService;

    public function __construct(ConferenceService $conferenceService)
    {
        $this->conferenceService = $conferenceService;
    }

    private function getConferenceOrAbort($slug)
    {
        $conferences = collect($this->conferenceService->getAllConferences());
        $conference = $conferences->firstWhere('slug', $slug);

        if (!$conference) {
            abort(404, 'Conference not found');
        }

        return $conference;
    }

    public function schedule($slug)
    {
        return view('conference.about.schedule', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }

    public function abstractGuidelines($slug)
    {
        return view('conference.about.abstract-guidelines', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }

    public function fullPaperGuidelines($slug)
    {
        return view('conference.about.full-paper-guidelines', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }

    public function history($slug)
    {
        return view('conference.about.history', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }

    public function participationOpportunities($slug)
    {
        return view('conference.about.participation-opportunities', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }

    public function organizingTeam($slug)
    {
        return view('conference.about.organizing-team', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }

    public function coChairKeynote($slug)
    {
        return view('conference.about.co-chair-keynote', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }

    public function scientificCommittee($slug)
    {
        return view('conference.about.scientific-committee', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }

    public function academicPartners($slug)
    {
        return view('conference.about.academic-partners', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }

    public function presentationGuidelines($slug)
    {
        return view('conference.about.presentation-guidelines', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }

    public function sponsors($slug)
    {
        return view('conference.about.sponsors', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }

    public function researchLibrary($slug)
    {
        return view('conference.about.research-library', [
            'conference' => $this->getConferenceOrAbort($slug)
        ]);
    }
}
