<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Admission;
use App\Repositories\ResponseRepository;
use Illuminate\Support\Facades\Log;

class AdmissionController extends Controller
{
    public function __construct(ResponseRepository $response) {
        $this->response = $response;
        $this->ruleOne = [
            'title' => 'required',
            'description' => 'required',
        ];
    }

    public function getAdmssionDetailsTitles() {
        return $this->response->jsonResponse(false, "Admission Details  Fetched Successfully", Admission::all(), 550);
    }

    public function updateAdmissionDetailsTitles(Request $request) {
        $validate = $this->response->validate($request->all(), $this->ruleOne);
        if($validate === true) {
            return $this->response->jsonResponse(false, $this->response->message('Admission Details', 'update'), Admission::first()->update($request->all()), 551);
        } else {
            return $this->response->jsonResponse(true, 'Admission Details Update Failed', $validate, 552);
        }
    }

    
}
