/**
 * API Types
 */

// Paginated response from API
export interface PaginatedResponse<T> {
  rows: T[];
  count: number;
}

// Fetch parameters for entity queries
export interface FetchParams {
  id?: string;
  query?: string;
  limit?: number;
  page?: number;
}

// API error response structure
export interface ApiError {
  message?: string;
  statusCode?: number;
  errors?: Record<string, { _errors: string[] }>;
}

// Sort model for data grid
export interface SortModel {
  field: string;
  sort: 'asc' | 'desc';
}

// Query parameters for list requests
export interface ListQueryParams {
  page?: number;
  limit?: number;
  sort?: 'asc' | 'desc';
  field?: string;
  [filterKey: string]: string | number | boolean | undefined;
}

// Autocomplete item response
export interface AutocompleteItem {
  id: string;
  label: string;
}

// CSV upload response
export interface CsvUploadResponse {
  imported: number;
  errors?: string[];
}

// Generic create/update payload
export interface MutationPayload<T> {
  id?: string;
  data: Partial<T>;
}

// Delete by IDs payload
export interface DeleteByIdsPayload {
  ids: string[];
}
