<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Http\Request;
use App\Http\Controllers\ContentTypes\Password;
use App\Http\Controllers\ContentTypes\Text;
use App\Http\Controllers\ContentTypes\Image as ContentImage;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function getContentBasedOnType(Request $request, $slug, $row, $options = null)
    {
        switch ($row->type) {
            case 'password':
                return (new Password($request, $slug, $row, $options))->handle();
            case 'image':
                    return (new ContentImage($request, $slug, $row, $options))->handle();
            default:
                return (new Text($request, $slug, $row, $options))->handle();
        }
    }
}
