<?php

namespace App\Media;

use Illuminate\Support\Arr;

class Factory {
	private const LOGKEY = 'MF-';

	/**
	 * @var array event type to event class mapping
	 */
	public const map = [
		'video/quicktime' => QuickTime::class,
	];

	/**
	 * Returns new event instance
	 *
	 * @param string $file
	 * @return Base
	 */
	public static function create(string $file): Base
	{
		$type = mime_content_type($file);
		$class = Arr::get(self::map,$type,Unknown::class);

		return new $class($file,$type);
	}
}