<?php

namespace Planaday\Entities\Course;

use ArrayAccess;
use Countable;
use Planaday\Entities\Course\DTO\Course;
use Planaday\Entities\Course\DTO\CourseSearch;
use Traversable;

interface CourseDatabase {
	public function setCourse(Course $course):void;
	public function getCourseById(int $id): ?Course;

	/**
	 * @param CourseSearch $search
	 *
	 * @return ArrayAccess<int, Course>&Traversable<int, Course>&Countable
	 */
	public function getCoursesBySearch(CourseSearch $search): ArrayAccess&Traversable&Countable;

	/**
	 * @param int $startDate
	 * @param int $endDate
	 *
	 * @return ArrayAccess<int, Course>&Traversable<int, Course>&Countable
	 */
	public function getCoursesByTimeSlot(int $startDate, int $endDate): ArrayAccess&Traversable&Countable;

	/**
	 * @return ArrayAccess<int|string, string>&Traversable<int|string, string>&Countable
	 */
	public function getUniqueLabelsCourse(): ArrayAccess&Traversable&Countable;

	/**
	 * @param ArrayAccess<int|string, Course>&Traversable<int|string, Course>&Countable $courses
	 * @param bool $wipeDB wipe the database before inserting new courses
	 *
	 * @return void
	 */
	public function setAll(ArrayAccess&Traversable&Countable $courses, bool $wipeDB = false):void;

	/**
	 * @return ArrayAccess<int|string, Course>&Traversable<int|string, Course>&Countable
	 */
	public function getAll():ArrayAccess&Traversable&Countable;

	public function getAllRaw():ArrayAccess&Traversable&Countable;
	public function getCountAll(): int;
}