<?php

namespace App\Http\Controllers\Web;

use App\Guc;
use App\Occasion;
use App\PhotoGallery;
use Illuminate\View\View;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class MediaCenterController extends Controller
{

    private $view = 'web.media_center.';

    public function gallery() :View
    {
        $title = __('main.photo_gallery');
        $galleries = PhotoGallery::withDescription();
        return view($this->view.'gallery.index', get_defined_vars());
    }

    public function showMoreGallery(Request $request)
    {
        $galleries = PhotoGallery::withDescription($request->skip);
        if (count($galleries)){
            return view($this->view.'gallery.show_more', get_defined_vars());
        }

        return false;
    }

    public function media() :View
    {
        $title = __('main.event_conference_exhibition');
        $occasions = Occasion::get();
        
        return view($this->view.'event_conference_exhibition.index', get_defined_vars());
    }

    public function showMoreMedia(Request $request)
    {
        $occasions = Occasion::withDescription(null, $request->skip);
        if (count($occasions)){
            return view($this->view.'event_conference_exhibition.show_more', get_defined_vars());
        }

        return false;
    }

    public function guc() :View
    {
        $title = 'GUC';
        $gucs = Guc::withDescription();
        return view($this->view.'guc.index', get_defined_vars());
    }

    public function showMoreGuc(Request $request)
    {
        $gucs = Guc::withDescription([], $request->skip);
        if (count($gucs)){
            return view($this->view.'guc.show_more', get_defined_vars());
        }

        return false;
    }

    public function gucShow(Guc $guc) :View
    {
        $guc = Guc::withDescription([$guc->id]);
        $title = $guc->title;
        return view($this->view.'guc.show', get_defined_vars());
    }
}
