<script lang="ts">
/**
 * ae_comp__journal_entry_ai_tools.svelte
 * Journal-specific wrapper for the generic AE_AITools.
 * Handles layout/positioning and specific save behavior for journal entries.
 */
import AE_AITools from '$lib/ae_elements/AE_AITools.svelte';
import { journals_loc } from '$lib/ae_journals/ae_journals_stores';

interface Props {
    content: string;
    summary: string | null | undefined; // Bindable
    on_save: () => void;
    log_lvl?: number;
}

let { content, summary = $bindable(), on_save, log_lvl = 0 }: Props = $props();
</script>

<div class="journal-entry-floating-actions absolute top-14 right-2 z-10">
    <div
        class="journal-entry-ai-tools inline-flex flex-wrap items-center justify-end gap-1">
        <AE_AITools
            {content}
            model={$journals_loc.llm__api_model}
            baseUrl={$journals_loc.llm__api_base_url}
            token={$journals_loc.llm__api_token}
            systemPrompt={$journals_loc.entry.llm__system_prompt}
            maxTokens={$journals_loc.entry.llm__max_tokens}
            temperature={$journals_loc.entry.llm__temperature}
            buttonClass="btn btn-sm preset-tonal-primary shadow-md transition-all duration-150 hover:scale-105"
            bind:summary
            onSave={(newSummary) => {
                summary = newSummary;
                on_save();
            }}
            {log_lvl} />
    </div>
</div>
