35 lines
966 B
PHP
35 lines
966 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Enums;
|
|
|
|
use App\Entity\Station;
|
|
|
|
enum StationFeatures
|
|
{
|
|
case CustomLiquidsoapConfig;
|
|
case Media;
|
|
case Sftp;
|
|
case MountPoints;
|
|
case RemoteRelays;
|
|
case HlsStreams;
|
|
case Streamers;
|
|
case Webhooks;
|
|
case Podcasts;
|
|
|
|
public function supportedForStation(Station $station): bool
|
|
{
|
|
$backendEnabled = $station->getBackendTypeEnum()->isEnabled();
|
|
|
|
return match ($this) {
|
|
self::Media, self::RemoteRelays, self::CustomLiquidsoapConfig => $backendEnabled,
|
|
self::Streamers => $backendEnabled && $station->getEnableStreamers(),
|
|
self::Sftp => $backendEnabled && $station->getMediaStorageLocation()->isLocal(),
|
|
self::MountPoints => $station->getFrontendTypeEnum()->supportsMounts(),
|
|
self::HlsStreams => $backendEnabled && $station->getEnableHls(),
|
|
self::Webhooks, self::Podcasts => true,
|
|
};
|
|
}
|
|
}
|