<?php

namespace App\Model;

use Nette;

class CourseThemeManager
{
	use Nette\SmartObject;

	private Nette\Database\Explorer $database;

	public function __construct(Nette\Database\Explorer $database)
	{
		$this->database = $database;
	}

	public function getThemeById($id)
	{
		return $this->database->table('temata_kurzu')->get($id);
	}

	public function getAllThemes()
	{
		return $this->database->table('temata_kurzu');
	}

	public function createTheme($themeData)
	{
		return $this->database->table('temata_kurzu')->insert($themeData);
	}

	public function updateTheme($themeData)
	{
		$id = $themeData['ID'];
		return $this->database->table('temata_kurzu')->where('id', $id)->update($themeData);
	}
}