2026-02-23 12:58:19 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MintyPHP\Service\User;
|
|
|
|
|
|
2026-03-06 00:44:52 +01:00
|
|
|
use MintyPHP\Service\Settings\SettingsAppGateway;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingsDefaultsGateway;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingsUserLifecycleGateway;
|
2026-02-23 12:58:19 +01:00
|
|
|
|
|
|
|
|
class UserSettingsGateway
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
public function __construct(
|
|
|
|
|
private readonly SettingsDefaultsGateway $settingsDefaultsGateway,
|
|
|
|
|
private readonly SettingsAppGateway $settingsAppGateway,
|
|
|
|
|
private readonly SettingsUserLifecycleGateway $settingsUserLifecycleGateway
|
|
|
|
|
) {
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDefaultTenantId(): ?int
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return $this->settingsDefaultsGateway->getDefaultTenantId();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDefaultRoleId(): ?int
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return $this->settingsDefaultsGateway->getDefaultRoleId();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDefaultDepartmentId(): ?int
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return $this->settingsDefaultsGateway->getDefaultDepartmentId();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-19 08:23:14 +01:00
|
|
|
/**
|
|
|
|
|
* @return array<string, string>
|
|
|
|
|
*/
|
|
|
|
|
public function appThemes(): array
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsAppGateway->listThemes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function defaultTheme(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsAppGateway->resolveDefaultTheme();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function normalizeTheme(?string $theme): string
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsAppGateway->normalizeTheme($theme);
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-23 12:58:19 +01:00
|
|
|
public function getUserInactivityDeactivateDays(): int
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return $this->settingsUserLifecycleGateway->getUserInactivityDeactivateDays();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getUserInactivityDeleteDays(): int
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return $this->settingsUserLifecycleGateway->getUserInactivityDeleteDays();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
2026-04-26 21:07:57 +02:00
|
|
|
|
|
|
|
|
public function recordLifecycleLastRun(string $createdAtUtc, string $status): bool
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsUserLifecycleGateway->recordLastRun($createdAtUtc, $status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return array{created_at: string, status: string}|null
|
|
|
|
|
*/
|
|
|
|
|
public function getLifecycleLastRun(): ?array
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsUserLifecycleGateway->getLastRun();
|
|
|
|
|
}
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|