<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

/**
 * RadiusBooking API Route Registrar
 *
 * This class is responsible for registering API routes dynamically with the WordPress REST API.
 * It supports CRUD operations and allows for middleware to be applied globally or per route.
 *
 * @package RadiusTheme\RadiusBooking\Core\Api\Routes
 */

use RadiusTheme\RadiusBooking\Repositories\AppointmentIntegrationRepository;
use RadiusTheme\RadiusBooking\Repositories\BookingRepository;
use RadiusTheme\RadiusBooking\Repositories\DashboardRepository;
use RadiusTheme\RadiusBooking\Repositories\EmployeeRepository;
use RadiusTheme\RadiusBooking\Repositories\PaymentRepository;
use RadiusTheme\RadiusBooking\Repositories\SettingsRepository;
use RadiusTheme\RadiusBooking\Repositories\UserProfileRepository;
use RadiusTheme\RadiusBooking\Repositories\AppointmentRepository;
use RadiusTheme\RadiusBooking\Repositories\ServiceRepository;
use RadiusTheme\RadiusBooking\Repositories\UserRepository;
use RadiusTheme\RadiusBooking\Services\AppointmentIntegrationService;
use RadiusTheme\RadiusBooking\Services\AppointmentService;
use RadiusTheme\RadiusBooking\Services\SetupWizardService;
use RadiusTheme\RadiusBooking\Core\Container\Container;
use RadiusTheme\RadiusBooking\Services\BookingService;
use RadiusTheme\RadiusBooking\Services\CustomerService;
use RadiusTheme\RadiusBooking\Services\DashboardService;
use RadiusTheme\RadiusBooking\Services\EmployeePanelService;
use RadiusTheme\RadiusBooking\Services\EmployeeServices\BreakTimeSyncService;
use RadiusTheme\RadiusBooking\Services\EmployeeServices\DaysOffSyncService;
use RadiusTheme\RadiusBooking\Services\EmployeeServices\ServiceSyncService;
use RadiusTheme\RadiusBooking\Services\EmployeeServices\SpecialDaySyncService;
use RadiusTheme\RadiusBooking\Services\EmployeeServices\TimePeriodLocationSyncService;
use RadiusTheme\RadiusBooking\Services\EmployeeServices\TimePeriodServiceSyncService;
use RadiusTheme\RadiusBooking\Services\EmployeeServices\TimePeriodSyncService;
use RadiusTheme\RadiusBooking\Services\EmployeeServices\WeekdayRelationSyncService;
use RadiusTheme\RadiusBooking\Services\EmployeeServices\WeekdaySyncService;
use RadiusTheme\RadiusBooking\Services\UserService;
use RadiusTheme\RadiusBooking\ExportImport\ExportImportService;
use RadiusTheme\RadiusBooking\Repositories\MeetingTypeRepository;
use RadiusTheme\RadiusBooking\Services\MeetingTypeService;
use RadiusTheme\RadiusBooking\Services\MeetingAvailabilityService;
use RadiusTheme\RadiusBooking\Services\MeetingBookingService;
use RadiusTheme\RadiusBooking\Repositories\EventRepository;
use RadiusTheme\RadiusBooking\Repositories\EventTicketTypeRepository;
use RadiusTheme\RadiusBooking\Repositories\EventRegistrationRepository;
use RadiusTheme\RadiusBooking\Services\EventService;
use RadiusTheme\RadiusBooking\Services\EventCapacityService;
use RadiusTheme\RadiusBooking\Services\EventRegistrationService;

return array(

	// Repositories
	AppointmentRepository::class            => fn() => new AppointmentRepository(),
	UserRepository::class                   => fn() => new UserRepository(),
	ServiceRepository::class                => fn() => new ServiceRepository(),
	UserProfileRepository::class            => fn() => new UserProfileRepository(),
	EmployeeRepository::class               => fn() => new EmployeeRepository(),
	BookingRepository::class                => fn() => new BookingRepository(),
	PaymentRepository::class                => fn() => new PaymentRepository(),
	DashboardRepository::class              => fn() => new DashboardRepository(),
	SettingsRepository::class               => fn() => new SettingsRepository(),
	AppointmentIntegrationRepository::class => fn() => new AppointmentIntegrationRepository(),

	UserService::class                      => fn() => new UserService(
		Container::resolve( UserRepository::class ),
		Container::resolve( UserProfileRepository::class ),
		Container::resolve( ServiceSyncService::class ),
		Container::resolve( DaysOffSyncService::class ),
		Container::resolve( WeekdaySyncService::class ),
		Container::resolve( SpecialDaySyncService::class )
	),

	ServiceSyncService::class               => fn() => new ServiceSyncService(
		Container::resolve( UserRepository::class ),
	),

	DaysOffSyncService::class               => fn() => new DaysOffSyncService(
		Container::resolve( UserRepository::class ),
	),

	WeekdaySyncService::class               => fn() => new WeekdaySyncService(
		Container::resolve( UserRepository::class ),
		Container::resolve( WeekdayRelationSyncService::class ),
	),

	WeekdayRelationSyncService::class       => fn() => new WeekdayRelationSyncService(
		Container::resolve( UserRepository::class ),
		Container::resolve( BreakTimeSyncService::class ),
		Container::resolve( TimePeriodSyncService::class )
	),
	BreakTimeSyncService::class             => fn() => new BreakTimeSyncService(
		Container::resolve( UserRepository::class )
	),
	TimePeriodSyncService::class            => fn() => new TimePeriodSyncService(
		Container::resolve( UserRepository::class ),
		Container::resolve( TimePeriodServiceSyncService::class ),
		Container::resolve( TimePeriodLocationSyncService::class )
	),
	TimePeriodLocationSyncService::class    => fn() => new TimePeriodLocationSyncService(
		Container::resolve( UserRepository::class )
	),
	TimePeriodServiceSyncService::class     => fn() => new TimePeriodServiceSyncService(
		Container::resolve( UserRepository::class )
	),

	SpecialDaySyncService::class            => fn() => new SpecialDaySyncService(
		Container::resolve( UserRepository::class )
	),
	CustomerService::class                  => fn() => new \RadiusTheme\RadiusBooking\Services\CustomerService(
		Container::resolve( UserRepository::class ),
		Container::resolve( UserService::class ),
		Container::resolve( BookingRepository::class )
	),


	// Services
	AppointmentService::class               => fn() => new AppointmentService(
		Container::resolve( AppointmentRepository::class ),
		Container::resolve( UserRepository::class ),
		Container::resolve( ServiceRepository::class ),
		Container::resolve( BookingService::class ),
		Container::resolve( PaymentRepository::class )
	),

	BookingService::class                   => fn() => new BookingService(
		Container::resolve( BookingRepository::class ),
		Container::resolve( CustomerService::class ),
	),
	DashboardService::class                 => fn() => new DashboardService(
		Container::resolve( AppointmentRepository::class ),
		Container::resolve( DashboardRepository::class ),
	),
	AppointmentIntegrationService::class    => fn() => new AppointmentIntegrationService(
		Container::resolve( AppointmentIntegrationRepository::class )
	),

	EmployeePanelService::class => fn() => new EmployeePanelService(
		Container::resolve( UserRepository::class ),
		Container::resolve( EmployeeRepository::class ),
	),

	SetupWizardService::class   => fn() => new SetupWizardService(
		Container::resolve( SettingsRepository::class ),
	),

	// Meeting
	MeetingTypeRepository::class      => fn() => new MeetingTypeRepository(),
	MeetingTypeService::class         => fn() => new MeetingTypeService(
		Container::resolve( MeetingTypeRepository::class )
	),
	MeetingAvailabilityService::class => fn() => new MeetingAvailabilityService(
		Container::resolve( MeetingTypeRepository::class ),
		Container::resolve( AppointmentRepository::class )
	),
	MeetingBookingService::class      => fn() => new MeetingBookingService(
		Container::resolve( MeetingTypeRepository::class ),
		Container::resolve( MeetingAvailabilityService::class ),
		Container::resolve( BookingService::class ),
		Container::resolve( CustomerService::class ),
		Container::resolve( AppointmentRepository::class )
	),

	// Event
	EventRepository::class              => fn() => new EventRepository(),
	EventTicketTypeRepository::class    => fn() => new EventTicketTypeRepository(),
	EventRegistrationRepository::class  => fn() => new EventRegistrationRepository(),
	EventService::class                 => fn() => new EventService(
		Container::resolve( EventRepository::class ),
		Container::resolve( EventTicketTypeRepository::class )
	),
	EventCapacityService::class         => fn() => new EventCapacityService(
		Container::resolve( EventRepository::class ),
		Container::resolve( EventTicketTypeRepository::class ),
		Container::resolve( EventRegistrationRepository::class )
	),
	EventRegistrationService::class     => fn() => new EventRegistrationService(
		Container::resolve( EventRegistrationRepository::class ),
		Container::resolve( EventCapacityService::class ),
		Container::resolve( BookingService::class ),
		Container::resolve( CustomerService::class ),
		Container::resolve( AppointmentRepository::class ),
		Container::resolve( EventRepository::class )
	),

	// Export/Import
	ExportImportService::class     => fn() => new ExportImportService(),

);
