diff --git a/src/Dto/InstalledModule.php b/src/Dto/InstalledModule.php deleted file mode 100644 index c38378a..0000000 --- a/src/Dto/InstalledModule.php +++ /dev/null @@ -1,15 +0,0 @@ - + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Novosga\Service; + +use Novosga\Settings\AppearanceSettings; +use Novosga\Settings\ApplicationSettings; +use Novosga\Settings\BehaviorSettings; +use Novosga\Settings\QueueSettings; + +/** + * ApplicationSettingsServiceInterface + * + * @author Rogerio Lino + */ +interface ApplicationSettingsServiceInterface +{ + public function loadSettings(): ApplicationSettings; + + public function loadAppearanceSettings(): AppearanceSettings; + + public function loadQueueSettings(): QueueSettings; + + public function loadBehaviorSettings(): BehaviorSettings; + + public function saveSettings(ApplicationSettings $settings): void; + + public function saveAppearanceSettings(AppearanceSettings $settings): void; + + public function saveBehaviorSettings(BehaviorSettings $settings): void; + + public function saveQueueSettings(QueueSettings $settings): void; +} diff --git a/src/Service/ModuleServiceInterface.php b/src/Service/ModuleServiceInterface.php index dbe9318..54059af 100644 --- a/src/Service/ModuleServiceInterface.php +++ b/src/Service/ModuleServiceInterface.php @@ -13,7 +13,7 @@ namespace Novosga\Service; -use Novosga\Dto\InstalledModule; +use Novosga\Settings\InstalledModule; interface ModuleServiceInterface { diff --git a/src/Settings/AppearanceSettings.php b/src/Settings/AppearanceSettings.php new file mode 100644 index 0000000..6a54e52 --- /dev/null +++ b/src/Settings/AppearanceSettings.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Novosga\Settings; + +/** + * AppearanceSettings + * + * @author Rogerio Lino + */ +class AppearanceSettings +{ + public function __construct( + public string $logoNavbar = '', + public string $logoLogin = '', + public string $theme = '', + public string $navbarColor = '', + public string $customCSS = '', + public string $customJS = '', + ) { + } +} diff --git a/src/Service/ConfigurationInterface.php b/src/Settings/ApplicationSettings.php similarity index 56% rename from src/Service/ConfigurationInterface.php rename to src/Settings/ApplicationSettings.php index 9131cd1..ab4b2dc 100644 --- a/src/Service/ConfigurationInterface.php +++ b/src/Settings/ApplicationSettings.php @@ -11,14 +11,19 @@ * file that was distributed with this source code. */ -namespace Novosga\Service; +namespace Novosga\Settings; /** - * ConfigurationInterface + * ApplicationSettings * * @author Rogerio Lino */ -interface ConfigurationInterface +class ApplicationSettings { - public function get(string $key): mixed; + public function __construct( + public AppearanceSettings $appearance, + public BehaviorSettings $behavior, + public QueueSettings $queue, + ) { + } } diff --git a/src/Settings/BehaviorSettings.php b/src/Settings/BehaviorSettings.php new file mode 100644 index 0000000..96dfe8b --- /dev/null +++ b/src/Settings/BehaviorSettings.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Novosga\Settings; + +/** + * BehaviorSettings + * + * @author Rogerio Lino + */ +class BehaviorSettings +{ + public function __construct( + public bool $prioritySwap = false, + public string $prioritySwapMethod = 'unity', + public int $prioritySwapCount = 1, + public bool $callTicketByService = false, + public bool $callTicketOutOfOrder = false, + ) { + } +} diff --git a/src/Settings/InstalledModule.php b/src/Settings/InstalledModule.php new file mode 100644 index 0000000..d7e25c4 --- /dev/null +++ b/src/Settings/InstalledModule.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Novosga\Settings; + +/** + * InstalledModule + * + * @author Rogerio Lino + */ +final class InstalledModule +{ + public function __construct( + public readonly bool $active, + public readonly string $key, + public readonly string $displayName, + public readonly string $iconName, + public readonly string $homeRoute, + ) { + } +} diff --git a/src/Settings/QueueSettings.php b/src/Settings/QueueSettings.php new file mode 100644 index 0000000..88712c9 --- /dev/null +++ b/src/Settings/QueueSettings.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Novosga\Settings; + +/** + * QueueSettings + * + * @author Rogerio Lino + */ +class QueueSettings +{ + /** @param array> $ordering */ + public function __construct( + public array $ordering = [], + ) { + if (!count($this->ordering)) { + $this->ordering = [ + [ + 'field' => 'dataAgendamento', + 'order' => 'ASC', + ], + [ + 'field' => 'servicoUsuario', + 'order' => 'ASC', + ], + [ + 'field' => 'prioridade', + 'order' => 'DESC', + ], + [ + 'field' => 'servicoUnidade', + 'order' => 'DESC', + ], + [ + 'field' => 'dataChegada', + 'order' => 'ASC', + ], + ]; + } + } +}