<?php

namespace KupShop\LLMBundle\SystemPrompts;

use KupShop\LLMBundle\Entity\TextPrompt;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;

#[AutoconfigureTag('kupshop.llm.systemPrompt')]
abstract class AbstractSystemPrompt
{
    public const LABEL = '_override';
    protected string $title;
    protected string $user_text;

    protected array|bool $textObjects = true;

    public function getTitle(): string
    {
        return $this->title;
    }

    public function getUserText(): string
    {
        return $this->user_text;
    }

    public static function getLabel(): string
    {
        return static::LABEL;
    }

    public function getEntity(): TextPrompt
    {
        return new TextPrompt($this->title, $this->user_text);
    }

    public function getTextObjects(): bool|array
    {
        return $this->textObjects;
    }

    public function isTextObjectAllowedByDefault(string $textObjectLabel): bool
    {
        if (is_bool($this->textObjects)) {
            return $this->textObjects;
        }

        return in_array($textObjectLabel, $this->textObjects);
    }
}
