<?php

namespace Planaday\Database\MySQL;

use Planaday\Database\Abstraction\DatabaseConnector;
use Planaday\Database\Abstraction\DatabaseHandler;
use Planaday\Database\Abstraction\SQLQuery\ColumnTypeMap;
use Planaday\Database\Abstraction\SQLQuery\SQLFactory;
use Planaday\Database\SQLDatabaseControllers\Booking\SQLBookingDatabase;
use Planaday\Database\SQLDatabaseControllers\Course\SQLCourseDatabase;
use Planaday\Database\SQLDatabaseControllers\DayPart\SQLDayPartDatabase;
use Planaday\Database\SQLDatabaseControllers\Location\SQLLocationDatabase;
use Planaday\Database\SQLDatabaseControllers\SQLDatabaseHandler;
use Planaday\Entities\Booking\BookingDatabase;
use Planaday\Entities\Course\CourseDatabase;
use Planaday\Entities\DayPart\DayPartDatabase;
use Planaday\Entities\Location\LocationDatabase;
use Planaday\Utility\DependencyInjection\Container;

class MySQLConnector implements DatabaseConnector {
	public function __construct(
		protected Container $registry
	) {}

	public function getDatabaseName(): string {
		return "MySQL";
	}

	public function connect(): void {
		$this->registry->setImplementation(SQLFactory::class, MySQLFactory::class)
		               ->setImplementation(ColumnTypeMap::class, MySQLColumnTypeMap::class)
		               ->setImplementation(LocationDatabase::class, SQLLocationDatabase::class)
		               ->setImplementation(CourseDatabase::class, SQLCourseDatabase::class)
		               ->setImplementation(DayPartDatabase::class, SQLDayPartDatabase::class)
		               ->setImplementation(BookingDatabase::class, SQLBookingDatabase::class)
		               ->setImplementation(DatabaseHandler::class, SQLDatabaseHandler::class);
	}
}