<?php
namespace Planaday\Platform\WordpressConfig;

use Planaday\Payment\Interfaces\PaymentHandler;
use Planaday\Payment\Mollie\Mollie;
use Planaday\Platform\PlatformAbstraction\PlatformConnector;
use Planaday\Platform\PlatformAbstraction\DatabaseInterface;
use Planaday\Platform\PlatformAbstraction\DataHandler;
use Planaday\Platform\PlatformAbstraction\EmailService;
use Planaday\Platform\PlatformAbstraction\HtmlService;
use Planaday\Platform\PlatformAbstraction\LocalizationController;
use Planaday\Platform\PlatformAbstraction\PlatformService;
use Planaday\Platform\PlatformAbstraction\UrlHandler;
use Planaday\Platform\PlatformAbstraction\UserService;
use Planaday\Utility\DependencyInjection\Container;

class WPPlatformConnector implements PlatformConnector {
	function __construct(
		protected Container $registry
	) {}

	public function getPlatformName(): string {
		return "WordPress";
	}

	public function connect(): void {
		$this->registry->setImplementation(DataHandler::class, WPDataHandler::class)
		               ->setImplementation(DatabaseInterface::class, WPDatabaseInterface::class)
		               ->setImplementation(LocalizationController::class, WPLocalizationController::class)
		               ->setImplementation(EmailService::class, WPEmailService::class)
		               ->setImplementation(PlatformService::class, WPPlatformService::class)
		               ->setImplementation(UrlHandler::class, WPUrlHandler::class)
		               ->setImplementation(UserService::class, WPUserService::class)
		               ->setImplementation(HtmlService::class, WPHtmlService::class)
		               ->setImplementation(PaymentHandler::class, Mollie::class);
	}
}