// #region ValidationTypes [C:1] [TYPE Module] [SEMANTICS validation, types, llm]
// @BRIEF TypeScript interfaces for LLM dashboard validation tasks, runs, and records.
// @LAYER Domain

// ── Validation Task (policy) ─────────────────────────────────

export interface ValidationTask {
	id: string;
	name: string;
	environment_id: string;
	url?: string;
	is_active: boolean;
	config?: ValidationTaskConfig;
	created_at?: string;
	updated_at?: string;
}

export interface ValidationTaskConfig {
	interval_minutes?: number;
	llm_provider_id?: string;
	llm_model?: string;
	max_images?: number;
	[k: string]: unknown;
}

// ── Validation Run ──────────────────────────────────────────

export interface ValidationRun {
	id: string;
	task_id: string;
	status: RunStatus;
	started_at?: string;
	finished_at?: string;
	duration_ms?: number;
	error?: string;
	records?: ValidationRecord[];
}

export type RunStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';

// ── Validation Record (per dashboard) ───────────────────────

export interface ValidationRecord {
	id?: string;
	path?: string;
	execution_path?: string | null;
	screenshot_paths?: string[] | null;
	logs_sent_to_llm?: string[] | null;
	raw_response?: string | Record<string, unknown> | null;
	dashboard_id?: string;
	dashboard_title?: string;
	status?: string;
	issues?: ValidationIssue[];
	task_logs?: unknown[];
	[k: string]: unknown;
}

// ── Validation Issue ────────────────────────────────────────

export interface ValidationIssue {
	id?: string;
	tab_index?: number;
	location?: string;
	severity?: 'critical' | 'high' | 'medium' | 'low' | 'info';
	title?: string;
	description?: string;
	suggestion?: string;
	[k: string]: unknown;
}

// ── Screenshot Entry ────────────────────────────────────────

export interface ScreenshotEntry {
	path: string;
	label: string;
}

// ── Run Detail Response (from API) ──────────────────────────

export interface RunDetailResponse {
	run?: Record<string, unknown>;
	records?: ValidationRecord[];
}
// #endregion ValidationTypes
