<?php

namespace App\Http\Controllers\Web;

use App\Services\Response\ResponseService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
use App\Http\Controllers\Controller;
use Modules\Page\Models\Page;
use Modules\Page\Services\PageService;



class PageController extends Controller
{
    private $view = 'web.pages.pages.';
    private $pageService ;
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct(
        PageService $pageService,
    )
    {
        $this->pageService = $pageService;
    }

    /**
     * Show the application dashboard.
     * @return View
     */

    public function aboutus(Request $request): View
    {
        $title = __('web.aboutus');
        $page = Page::findOrFail(1);
        $aboutus = $this->pageService->getItem($page);
        $request->merge(['ids'=>[2,3,4],'paginate'=>null]);
        $cards = $this->pageService->get($request);
        return view($this->view.'aboutus', get_defined_vars());
    }

    public function terms(): View
    {
        $title = __('web.terms');
        $page = Page::findOrFail(5);
        $page = $this->pageService->getItem($page);
        return view($this->view . 'page', get_defined_vars());
    }

    public function policy(): View
    {
        $title = __('web.policy');
        $page = Page::findOrFail(6);
        $page = $this->pageService->getItem($page);
        return view($this->view.'page', get_defined_vars());
    }

    public function coming(): View
    {
        $title = __('web.coming');
        $page = Page::findOrFail(8);
        $page = $this->pageService->getItem($page);
        return view($this->view.'coming', get_defined_vars());
    }


}
