<?php

namespace Planaday\Html\NodeTags\Course\Details\Shortcode;

use Planaday\Config\FeatureToggles\FeatureToggleSettings;
use Planaday\Config\General\Price\PriceSettings;
use Planaday\Html\NodeTags\Feature;
use Planaday\Html\NodeTags\Tag;
use Planaday\Html\NodeTags\TemplateOnlyTag;
use Planaday\Utility\DependencyInjection\Attributes\Transient;

#[Transient]
class Shortcode implements Tag, Feature {
	use TemplateOnlyTag;

	public function __construct(
		protected PriceSettings $priceSettings
	) {
		$this->config = [
			"withTax" => $this->priceSettings->isIncludingTax(...),
		];
	}

	public function getTagDir(): string {
		return __DIR__;
	}

	public static function getAllowedTemplates(FeatureToggleSettings $featureToggles): array {
		return [
			'Titel' => 'title',
			'Alle Details' => 'styledDetailPage',
			'Detail Knop' => 'button',
			'Dagdelen' => 'dayparts',
			'Prijs' => 'price',
			'Prijs Opmerking' => 'priceRemark',
			'Id' => 'id',
			...($featureToggles->showShortcodeSettings() ? ['Alle Details (legacy shortcode)' => 'detailPage'] : []),
		];
	}
}