import type { IUserRepository, UserListFilters } from '@/domain/repositories/user.repository.interface';
import type { User, PaginatedResult } from '@/domain/entities';
import { httpClient } from '../http/http.client';

class UserRepository implements IUserRepository {
  async findMany(filters: UserListFilters): Promise<PaginatedResult<User>> {
    return httpClient.get('/api/v1/admin/users', { params: filters });
  }

  async findById(id: string): Promise<User> {
    return httpClient.get(`/api/v1/admin/users/${id}`);
  }

  async updateKycStatus(id: string, status: string): Promise<User> {
    return httpClient.patch(`/api/v1/admin/users/${id}/kyc`, { status });
  }

  async toggleActive(id: string, isActive: boolean): Promise<User> {
    return httpClient.patch(`/api/v1/admin/users/${id}/status`, { isActive });
  }
}

export const userRepository = new UserRepository();
