// #region ApiTypes [C:1] [TYPE Module] [SEMANTICS api, types, generic]
// @BRIEF Generic TypeScript interfaces for API communication — response wrappers, error shapes, pagination, fetch options.
// @LAYER API

/** Generic API response wrapper. All backend JSON responses implicitly match this shape. */
export interface ApiResponse<T> {
	data: T;
	message?: string;
}

/** Paginated list response from backend list endpoints. */
export interface PaginatedResponse<T> {
	items: T[];
	total: number;
	page: number;
	page_size: number;
	pages: number;
}

/** Backend error detail as returned in HTTP error responses. */
export interface ApiErrorDetail {
	message?: string;
	error_code?: string;
	detail?: string | ApiErrorDetail;
	[key: string]: unknown;
}

/** Options for fetchApi / requestApi wrappers. */
export interface FetchOptions {
	headers?: Record<string, string>;
	suppressToast?: boolean;
	notifyError?: boolean;
}

/** Options for paginated list endpoints. */
export interface PaginationParams {
	page?: number;
	page_size?: number;
	offset?: number;
	limit?: number;
}

/** Options for task listing endpoint. */
export interface TaskListParams extends PaginationParams {
	status?: string;
	task_type?: string;
	completed_only?: boolean;
	plugin_id?: string[];
}

/** Options for dashboard list endpoint. */
export interface DashboardListParams {
	search?: string;
	page?: string;
	page_size?: string;
	page_context?: string;
	apply_profile_default?: boolean;
	override_show_all?: boolean;
	filters?: {
		title?: string[];
		git_status?: string[];
		llm_status?: string[];
		changed_on?: string[];
		actor?: string[];
	};
}

/** Options for Superset account lookup. */
export interface SupersetAccountLookupParams {
	search?: string;
	page_index?: number;
	page_size?: number;
	sort_column?: string;
	sort_order?: string;
}
// #endregion ApiTypes
