import { Pipe, PipeTransform } from '@angular/core';
import { SetupUser } from '../../models/user';

@Pipe({
  name: 'userFilter',
  standalone: true
})
export class UserFilterPipe implements PipeTransform {
  transform(users: SetupUser[], searchText: string): SetupUser[] {
    if (!users || !searchText.trim()) {
      return users;
    }

    const search = searchText.toLowerCase();
    
    return users.filter(user =>
      user.userId.toLowerCase().includes(search) ||
      user.userFullname.toLowerCase().includes(search) ||
      user.email.toLowerCase().includes(search)
    );
  }
}