import { User, UserRole, UserStatus } from '../entities/user.entity';

export interface UserListFilters {
  page: number;
  limit: number;
  search?: string;
  kycLevel?: number;
  status?: string;
}

export interface IUserRepository {
  findById(id: string): Promise<User | null>;
  findByEmail(email: string): Promise<User | null>;
  findAll(page: number, limit: number): Promise<[User[], number]>;
  updateProfile(id: string, data: Partial<User>): Promise<User>;
  updateKycLevel(id: string, level: number): Promise<void>;
  updateStatus(id: string, status: UserStatus | string): Promise<void>;
  save(user: User): Promise<User>;
  create(data: Partial<User>): Promise<User>;

  // Admin queries
  findByFilters(filters: UserListFilters): Promise<[User[], number]>;
  countByStatus(status: string): Promise<number>;
  countByRole(role: UserRole): Promise<number>;
  count(): Promise<number>;
  findByRole(role: UserRole): Promise<User[]>;
  findByIdAndRole(id: string, role: UserRole): Promise<User | null>;
  countCreatedSince(since: Date): Promise<number>;
  getRegistrationTrend(days: number): Promise<Array<{ date: string; count: number }>>;
  getKycLevelDistribution(): Promise<Array<{ level: number; count: number }>>;
  getGeoDistribution(): Promise<Array<{ region: string; count: number }>>;
}

export const USER_REPOSITORY = Symbol('IUserRepository');
