import { OnInit, ChangeDetectorRef, ElementRef, ViewContainerRef } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { AIPromptEntityExtended, TemplateEntity, TemplateContentEntity, TemplateParamEntity, AIPromptModelEntity, AIModelEntityExtended, AIVendorEntity, AIModelVendorEntity, AIPromptTypeEntity, AIPromptRunEntityExtended, AIConfigurationEntity } from '@memberjunction/core-entities';
import { SharedService } from '@memberjunction/ng-shared';
import { TemplateEditorConfig, TemplateEditorComponent } from '../../shared/components/template-editor.component';
import { AIPromptFormComponent } from '../../generated/Entities/AIPrompt/aiprompt.form.component';
import { AITestHarnessDialogService } from '@memberjunction/ng-ai-test-harness';
import { AIPromptManagementService } from './ai-prompt-management.service';
import * as i0 from "@angular/core";
export declare class AIPromptFormComponentExtended extends AIPromptFormComponent implements OnInit {
    cdr: ChangeDetectorRef;
    private testHarnessService;
    private viewContainerRef;
    private promptManagementService;
    record: AIPromptEntityExtended;
    template: TemplateEntity | null;
    templateContent: TemplateContentEntity | null;
    templateParams: TemplateParamEntity[];
    isLoadingTemplate: boolean;
    isLoadingTemplateParams: boolean;
    templateNotFoundInDatabase: boolean;
    showTestHarness: boolean;
    promptModels: AIPromptModelEntity[];
    availableModels: AIModelEntityExtended[];
    availableVendors: AIVendorEntity[];
    isLoadingModels: boolean;
    modelVendorsMap: Map<string, {
        vendors: AIVendorEntity[];
        modelVendors: AIModelVendorEntity[];
    }>;
    availablePromptTypes: AIPromptTypeEntity[];
    isLoadingPromptTypes: boolean;
    availableConfigurations: AIConfigurationEntity[];
    isLoadingConfigurations: boolean;
    resultSelectorTreeData: any[];
    isLoadingResultSelectorData: boolean;
    draggedIndex: number;
    executionHistory: AIPromptRunEntityExtended[];
    isLoadingHistory: boolean;
    historySortField: 'runAt' | 'executionTime' | 'cost' | 'tokens';
    historySortDirection: 'asc' | 'desc';
    hasUnsavedChanges: boolean;
    private originalTemplateID;
    /** Cache for permission checks to avoid repeated calculations */
    private _permissionCache;
    /** Check if user can create Templates */
    get UserCanCreateTemplates(): boolean;
    /** Check if user can update Templates */
    get UserCanUpdateTemplates(): boolean;
    /** Check if user can delete Templates */
    get UserCanDeleteTemplates(): boolean;
    /** Check if user can read Templates */
    get UserCanReadTemplates(): boolean;
    /** Check if user can create Template Contents */
    get UserCanCreateTemplateContents(): boolean;
    /** Check if user can update Template Contents */
    get UserCanUpdateTemplateContents(): boolean;
    /** Check if user can create AI Prompt Models */
    get UserCanCreatePromptModels(): boolean;
    /** Check if user can update AI Prompt Models */
    get UserCanUpdatePromptModels(): boolean;
    /** Check if user can delete AI Prompt Models */
    get UserCanDeletePromptModels(): boolean;
    /**
     * Helper method to check entity permissions with caching
     * @param entityName - The name of the entity to check permissions for
     * @param permissionType - The type of permission to check (Create, Read, Update, Delete)
     * @returns boolean indicating if user has the permission
     */
    private checkEntityPermission;
    /**
     * Clears the permission cache. Call this when user context changes or permissions are updated.
     */
    clearPermissionCache(): void;
    get templateEditorConfig(): TemplateEditorConfig;
    private _metadata;
    private __InferenceProvider_VendorTypeDefinitionID;
    templateEditor: TemplateEditorComponent | undefined;
    constructor(elementRef: ElementRef, sharedService: SharedService, router: Router, route: ActivatedRoute, cdr: ChangeDetectorRef, testHarnessService: AITestHarnessDialogService, viewContainerRef: ViewContainerRef, promptManagementService: AIPromptManagementService);
    ngOnInit(): Promise<void>;
    /**
     * Loads the template associated with this AI prompt
     */
    loadTemplate(): Promise<void>;
    /**
     * Handles template ID changes in the form
     */
    onTemplateIdChange(): Promise<void>;
    /**
     * Opens a dialog to link an existing template
     */
    linkExistingTemplate(): Promise<void>;
    /**
     * Opens the current template in a new window
     */
    openTemplateInNewWindow(): void;
    /**
     * Creates a new template for this AI prompt (deferred until save)
     */
    createNewTemplate(): Promise<void>;
    /**
     * Cleans up any pending records related to the old template when changing templates
     */
    private cleanupOldTemplateRecords;
    /**
     * Loads template content for the current template
     */
    private loadTemplateContent;
    /**
     * Loads template parameters for the current template
     */
    private loadTemplateParams;
    /**
     * Opens the AI prompt execution dialog
     */
    executeAIPrompt(): void;
    /**
     * Opens the test harness
     */
    openTestHarness(): void;
    /**
     * Handles when test harness is closed
     */
    onTestHarnessVisibilityChanged(isVisible: boolean): void;
    /**
     * Handles template content changes from the editor
     */
    onTemplateContentChange(content: TemplateContentEntity[]): void;
    /**
     * Handles template content record deletion
     * This method should be called by the template editor to properly manage deletions
     */
    handleTemplateContentDelete(templateContent: TemplateContentEntity): void;
    /**
     * Handles template content record creation/modification
     * This method should be called by the template editor to properly manage saves
     */
    handleTemplateContentSave(templateContent: TemplateContentEntity): void;
    /**
     * Adds template content changes to pending records
     */
    private addTemplateContentsToPendingRecords;
    /**
     * Handles template run requests from the editor
     */
    onTemplateRun(template: TemplateEntity): void;
    /**
     * Gets the display text for parallelization mode
     */
    getParallelizationModeDisplay(): string;
    /**
     * Gets the display text for output type
     */
    getOutputTypeDisplay(): string;
    /**
     * Gets the color for validation behavior display
     */
    getValidationColor(): string;
    /**
     * Checks if ParallelCount field should be visible
     */
    get showParallelCount(): boolean;
    /**
     * Checks if ParallelConfigParam field should be visible
     */
    get showParallelConfigParam(): boolean;
    /**
     * Checks if OutputExample field should be visible
     */
    get showOutputExample(): boolean;
    /**
     * Checks if the AI prompt can be executed
     */
    get canExecute(): boolean;
    /**
     * Gets status badge color
     */
    getStatusBadgeColor(): string;
    /**
     * Loads available AI models for selection
     */
    loadAvailableModels(): Promise<void>;
    /**
     * Loads available AI vendors for selection
     */
    loadAvailableVendors(): Promise<void>;
    /**
     * Loads available AI prompt types for selection
     */
    loadAvailablePromptTypes(): Promise<void>;
    /**
     * Loads available AI configurations for selection
     */
    loadAvailableConfigurations(): Promise<void>;
    /**
     * Loads vendors available for a specific model
     */
    loadVendorsForModel(modelId: string): Promise<{
        vendors: AIVendorEntity[];
        modelVendors: AIModelVendorEntity[];
    }>;
    /**
     * Gets vendors for a specific model from cache or loads them
     */
    getVendorsForModel(modelId: string): Promise<AIVendorEntity[]>;
    /**
     * Gets the status for a model-vendor combination
     */
    getModelVendorStatus(modelId: string, vendorId: string): string;
    /**
     * Gets the color for vendor status display
     */
    getVendorStatusColor(modelId: string, vendorId: string): string;
    /**
     * Handles model selection change and loads vendors for that model
     */
    onModelChange(modelId: string, promptModelIndex: number): Promise<void>;
    /**
     * Handles configuration change for a prompt model
     */
    onConfigurationChange(configurationId: string | null, promptModelIndex: number): void;
    /**
     * Gets vendors for a specific model
     */
    getVendorsForModelSync(modelId: string): AIVendorEntity[];
    /**
     * Checks if vendor dropdown should be shown (more than one vendor)
     */
    shouldShowVendorDropdown(modelId: string): boolean;
    /**
     * Loads prompt models for this AI prompt
     */
    loadPromptModels(): Promise<void>;
    /**
     * Adds a new model to the prompt (deferred until save)
     */
    addNewModel(): Promise<void>;
    /**
     * Removes a model from the prompt (deferred until save)
     */
    removePromptModel(index: number): Promise<void>;
    /**
     * Gets the display name for a model ID
     */
    getModelDisplayName(modelId: string): string;
    /**
     * Gets the display name for a vendor ID
     */
    getVendorDisplayName(vendorId: string): string;
    /**
     * Gets the display name for a prompt type ID
     */
    getPromptTypeDisplayName(typeId: string): string;
    /**
     * Gets the display name for a configuration ID
     */
    getConfigurationDisplayName(configurationId: string | null): string;
    /**
     * Override PopulatePendingRecords to add AI prompt model changes
     */
    protected PopulatePendingRecords(): void;
    /**
     * Override StartEditMode to capture original state for cancel functionality
     */
    StartEditMode(): void;
    /**
     * Override CancelEdit to restore original state
     */
    CancelEdit(): void;
    /**
     * Adds prompt model changes to the pending records
     */
    private addPromptModelsToPendingRecords;
    /**
     * Override InternalSaveRecord to handle template dependencies and related entity changes
     * Templates must be saved before AI Prompts to avoid foreign key constraint errors
     */
    protected InternalSaveRecord(): Promise<boolean>;
    /**
     * Loads the result selector tree data (categories and prompts)
     */
    loadResultSelectorTreeData(): Promise<void>;
    /**
     * Builds the tree structure for result selector
     */
    private buildResultSelectorTree;
    /**
     * Handles result selector selection
     */
    onResultSelectorChange(value: string): void;
    /**
     * Gets the display name for a prompt ID from the tree data
     */
    getPromptDisplayName(promptId: string): string;
    /**
     * Moves a model up in the list by swapping with the previous item
     */
    moveModelUp(index: number): void;
    /**
     * Moves a model down in the list by swapping with the next item
     */
    moveModelDown(index: number): void;
    /**
     * Updates priority values based on array order
     */
    private updateModelPriorities;
    /**
     * Gets a stable identifier for a model (for form tracking)
     */
    getModelTrackId(model: AIPromptModelEntity): string;
    /**
     * Handles drag start event
     */
    onDragStart(event: DragEvent, index: number): void;
    /**
     * Handles drag over event
     */
    onDragOver(event: DragEvent): void;
    /**
     * Handles drop event
     */
    onDrop(event: DragEvent, dropIndex: number): void;
    /**
     * Handles drag end event
     */
    onDragEnd(_event: DragEvent): void;
    /**
     * Load execution history for this prompt
     */
    loadExecutionHistory(): Promise<void>;
    /**
     * Sort execution history based on current sort field and direction
     */
    sortExecutionHistory(): void;
    /**
     * Change sort field and direction for execution history
     */
    changeHistorySort(field: 'runAt' | 'executionTime' | 'cost' | 'tokens'): void;
    /**
     * Navigate to a prompt run record
     */
    navigateToPromptRun(runId: string): void;
    /**
     * Format duration for display
     */
    formatDuration(ms: number | null): string;
    /**
     * Format cost for display
     */
    formatCost(cost: number | null): string;
    /**
     * Format tokens for display
     */
    formatTokens(tokens: number | null): string;
    /**
     * Get status color for execution
     */
    getExecutionStatusColor(success: boolean | null): string;
    /**
     * Get status icon for execution
     */
    getExecutionStatusIcon(success: boolean | null): string;
    /**
     * Gets the icon for a template parameter type
     */
    getParamTypeIcon(type: string): string;
    /**
     * Gets the color for a template parameter type
     */
    getParamTypeColor(type: string): string;
    /**
     * Gets a friendly description of the parameter type
     */
    getParamTypeDescription(param: TemplateParamEntity): string;
    static ɵfac: i0.ɵɵFactoryDeclaration<AIPromptFormComponentExtended, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<AIPromptFormComponentExtended, "mj-ai-prompt-form", never, {}, {}, never, never, false, never>;
}
export declare function LoadAIPromptFormComponentExtended(): void;
//# sourceMappingURL=ai-prompt-form.component.d.ts.map