diff --git a/app/Data/PointOfInterest.php b/app/Data/PointOfInterest.php index 7e756e7..aab0271 100644 --- a/app/Data/PointOfInterest.php +++ b/app/Data/PointOfInterest.php @@ -4,6 +4,59 @@ namespace App\Data; use Carbon\Carbon; use Illuminate\Contracts\Support\Arrayable; +use Illuminate\Support\Collection; + +enum AttractionTypeTag: string +{ + case Children = 'ATTRACTION_TYPE_CHILDREN'; + case MindTheSizeChart = 'ATTRACTION_TYPE_MIND_THE_SIZE_CHART'; + case Family = 'ATTRACTION_TYPE_FAMILY'; + case Roofed = 'ATTRACTION_TYPE_ROOFED'; + case Pictures = 'ATTRACTION_TYPE_PICTURES'; + case QuickPass = 'ATTRACTION_TYPE_QUICK_PASS'; + case Action = 'ATTRACTION_TYPE_ACTION'; + case QuickPassPlus = 'ATTRACTION_TYPE_QUICK_PASS_PLUS'; + case SingleRiderLine = 'ATTRACTION_TYPE_SINGLE_RIDER_LINE'; + case Water = 'ATTRACTION_TYPE_WATER'; + case NoOperationSubNegative5 = 'ATTRACTION_NO_OPERATION_SUB_NEGATIVE_5'; + case NoOperationSubZero = 'ATTRACTION_NO_OPERATION_SUB_ZERO'; + case ChildrenMayScare = 'ATTRACTION_TYPE_CHILDREN_MAY_SCARE'; +} + +enum AttractionTypeEmote: string +{ + case Children = '👶'; + case MindTheSizeChart = '📏'; + case Family = '👨‍👩‍👧‍👦'; + case Roofed = '🏠'; + case Pictures = '📸'; + case QuickPass = '🎟️'; + case Action = '🔥'; + case QuickPassPlus = '🎟️+'; + case SingleRiderLine = '🚶‍♂️'; + case Water = '💧'; + case NoOperationSubNegative5 = '🚫 -5'; + case NoOperationSubZero = '🚫 0'; + case ChildrenMayScare = '👻'; +} + +enum AttractionTypeTagDescription: string +{ + case Children = 'Attraktion für Kinder'; + case MindTheSizeChart = 'Achtung Größenbeschränkung'; + case Family = 'Attraktion für die ganze Familie'; + case Roofed = 'Überdachte Attraktion'; + case Pictures = 'Attraktion mit Fotomöglichkeit'; + case QuickPass = 'Attraktion mit Quick Pass'; + case Action = 'Actionreiche Attraktion'; + case QuickPassPlus = 'Attraktion mit Quick Pass Plus'; + case SingleRiderLine = 'Attraktion mit Single Rider Line'; + case Water = 'Wasserattraktion'; + case NoOperationSubNegative5 = 'Attraktion hat bei -5°C oder kälter geschlossen'; + case NoOperationSubZero = 'Attraktion hat bei 0°C oder kälter geschlossen'; + case ChildrenMayScare = 'Attraktion könnte Kinder erschrecken'; + +} readonly class PointOfInterest implements Arrayable { @@ -60,6 +113,32 @@ readonly class PointOfInterest implements Arrayable return Carbon::parse($this->info['opening'], 'Europe/Berlin'); } + public function hasTag(AttractionTypeTag $tag): bool + { + return in_array($tag, $this->tags); + } + + public function getTagEmote(AttractionTypeTag $tag): AttractionTypeEmote + { + $emotes = collect(AttractionTypeEmote::cases()); + $emote = $emotes->first(fn($emote) => $emote->name === $tag->name); + return $emote; + } + + public function getTags(): Collection + { + return collect($this->tags)->map(function ($tag) { + return AttractionTypeTag::from($tag); + }); + } + + public function getTagDescription(AttractionTypeTag $tag): string + { + $descriptions = collect(AttractionTypeTagDescription::cases()); + $description = $descriptions->first(fn($description) => $description->name === $tag->name); + return $description->value; + } + public function toArray() { return [ diff --git a/app/Http/Services/CaptianCosterApi.php b/app/Http/Services/CaptianCosterApi.php new file mode 100644 index 0000000..c93dccd --- /dev/null +++ b/app/Http/Services/CaptianCosterApi.php @@ -0,0 +1,24 @@ +uri = 'https://captaincoaster.com/api/'; + $this->client = Http::baseUrl($this->uri)->withHeaders([ + 'Authorization' => $apiKey + ]); + } +} diff --git a/app/Http/Services/PhantasialandApi.php b/app/Http/Services/PhantasialandApi.php index e5b5cd5..eebb96c 100644 --- a/app/Http/Services/PhantasialandApi.php +++ b/app/Http/Services/PhantasialandApi.php @@ -7,7 +7,6 @@ use App\Models\ThemeParkUser; use Illuminate\Http\Client\PendingRequest; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Http; -use Psr\Http\Message\RequestInterface; class PhantasialandApi { @@ -33,7 +32,9 @@ class PhantasialandApi // NOTE: we filter everything out that is adminOnly = true $pois = $pois->filter(function ($poi) { return $poi['category'] === 'ATTRACTIONS' && $poi['adminOnly'] === false && - $poi['poiNumber'] !== null; + $poi['poiNumber'] !== null && + $poi["parkMonitorReferenceName"] !== null && + in_array('SUMMER', $poi['seasons']); }); // sort by parkMonitorReferenceName diff --git a/resources/views/app.blade.php b/resources/views/app.blade.php index 1544b6c..789b300 100644 --- a/resources/views/app.blade.php +++ b/resources/views/app.blade.php @@ -3,7 +3,7 @@ - PhantaApp lul 3000 + PhantaApp @vite('resources/css/app.css') diff --git a/resources/views/theme-park.blade.php b/resources/views/theme-park.blade.php index ba3cdd3..ff02bb5 100644 --- a/resources/views/theme-park.blade.php +++ b/resources/views/theme-park.blade.php @@ -27,12 +27,15 @@ {{ $poi->description }}

-
- +
+ @foreach($poi->getTags() as $tag) + + {{ $poi->getTagEmote($tag) }} + + + @endforeach
@endforeach