4
0
mirror of https://github.com/AzuraCast/AzuraCast.git synced 2024-06-18 06:57:05 +00:00
AzuraCast/src/Enums/StationFeatures.php
Buster "Silver Eagle" Neece 2f19f94005
Expand StationFeatures.
2022-06-30 01:21:27 -05:00

37 lines
1.0 KiB
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;
case Requests;
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::Requests => $backendEnabled && $station->getEnableRequests(),
self::Webhooks, self::Podcasts => true,
};
}
}