/**
 * Generic Repository Interface
 * Defines standard operations for all repositories
 */
export interface IRepository<T> {
  /**
   * Find all entities with optional pagination
   * @param page Page number
   * @param limit Items per page
   * @param filters Optional filters
   * @returns Promise resolving to array of entities
   */
  findAll(page?: number, limit?: number, filters?: Record<string, any>): Promise<T[]>;
  
  /**
   * Find entity by id
   * @param id Entity id
   * @returns Promise resolving to entity or null if not found
   */
  findById(id: string): Promise<T | null>;
  
  /**
   * Create a new entity
   * @param data Entity data
   * @returns Promise resolving to created entity
   */
  create(data: Partial<T>): Promise<T>;
  
  /**
   * Update an existing entity
   * @param id Entity id
   * @param data Updated entity data
   * @returns Promise resolving to updated entity
   */
  update(id: string, data: Partial<T>): Promise<T | null>;
  
  /**
   * Delete an entity by id
   * @param id Entity id
   * @returns Promise resolving to boolean indicating success
   */
  delete(id: string): Promise<boolean>;
  
  /**
   * Count total entities matching optional filters
   * @param filters Optional filters
   * @returns Promise resolving to count
   */
  count(filters?: Record<string, any>): Promise<number>;
  
  /**
   * Find entities by custom query
   * @param query Custom query object
   * @returns Promise resolving to array of entities
   */
  findBy(query: Record<string, any>): Promise<T[]>;
  
  /**
   * Transaction support - begin transaction
   * @returns Promise resolving to transaction object
   */
  beginTransaction(): Promise<any>;
  
  /**
   * Transaction support - commit transaction
   * @param trx Transaction object
   * @returns Promise resolving when commit completes
   */
  commitTransaction(trx: any): Promise<void>;
  
  /**
   * Transaction support - rollback transaction
   * @param trx Transaction object
   * @returns Promise resolving when rollback completes
   */
  rollbackTransaction(trx: any): Promise<void>;
}