<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Http\Response as HttpResponse;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Models\Note_Examen;
use App\Metier\GestNotes;

class ExamenNoteController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    protected $gestNotes;
    public function __construct(GestNotes $gestNotes){
        $this->gestNotes=$gestNotes;
    }
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($sessionId = null,$examenId = null,$examenNoteId = null)
    {
        if(is_null($examenNoteId)){
            $note_Examens= $this->gestNotes->getExamenNotes($sessionId,$examenId);
            return view('noteExamenView')
                ->with('note_Examens',$note_Examens)
                ->with('sessionId',$sessionId)
                ->with('examenId',$examenId);
        } else {
            $note_Examens=$this->gestNotes->getExamenNote($examenNoteId);
            return is_null($note_Examens) ? 
            response()->json(['error' => 'Student Note Exams not found'], HttpResponse::HTTP_NOT_FOUND) : $note_Examens;
        }
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
