b2in/app/Support/DisplayModuleSettings.php

61 lines
1.9 KiB
PHP

<?php
namespace App\Support;
use App\Enums\DisplayVersionType;
class DisplayModuleSettings
{
/**
* @return array<string, mixed>
*/
public static function defaults(DisplayVersionType|string $type): array
{
$typeValue = $type instanceof DisplayVersionType ? $type->value : $type;
return match ($typeValue) {
DisplayVersionType::VideoDisplay->value => [
'qr_label' => 'Website',
],
DisplayVersionType::B2in->value => [
'theme' => 'dark',
'header_logo_url' => '../assets/b2in-logo-positive.svg',
'header_claim' => 'Connecting Design & Property',
'footer_url' => 'B2in.eu',
'footer_name' => '',
'footer_prefix' => 'by',
'qr_url' => '',
'transition' => [
'type' => 'crossfade',
'duration_ms' => 800,
],
'default_image_duration' => 10,
'rotation_weights' => ['immobilien' => 70, 'moebel' => 30],
'display_active' => true,
],
DisplayVersionType::Offers->value => [
'loop' => true,
'logo_url' => '../logo-cabinet-300.png',
'brand_text' => 'Bielefeld',
'footer_claim' => '',
'footer_url' => '',
'qr_default_title' => 'Kontakt',
'qr_subtitle' => 'QR scannen',
'transition' => [
'type' => 'fade',
'duration' => 600,
],
],
default => [],
};
}
/**
* @param array<string, mixed>|null $settings
* @return array<string, mixed>
*/
public static function merge(DisplayVersionType|string $type, ?array $settings): array
{
return array_replace_recursive(self::defaults($type), $settings ?? []);
}
}