<?php

namespace App\Http\Controllers;
use App\Models\FooterBlock;
use App\Models\ConsultUs;
use Illuminate\Http\Request;
use App\Repositories\ResponseRepository;

class FooterBlockController extends Controller
{
    public function __construct(ResponseRepository $response) {
        $this->response = $response;
        $this->storeRules = [
            'email' => 'required',
            'whatsapp' => 'required',
            'phone' => 'required',
            'address' => 'required',
            // 'facebook_link' => 'required',
            // 'twitter_link' => 'required',
            // 'map_link' => 'required',
            // 'address' => 'required',
        ];
    }

    public function getFooterBlock() {
        return $this->response->jsonResponse(false, "Media Link Details Fetched Successfully", FooterBlock::all(), 200);
    }

    public function updateFooterBlock(Request $request) {
        $validate = $this->response->validate($request->all(), $this->storeRules);
        if($validate === true) {
            return $this->response->jsonResponse(false, $this->response->message('Media Link Details', 'update'), FooterBlock::first()->update($request->all()), 200);
        } else {
            return $validate;
        }
    }
}
