import { ContactListsRepository, ContactListWithCount } from "../repositories/contact-lists-repository";

interface GetAllContactListsUseCaseRequest {
  userId: string;
}

interface GetAllContactListsUseCaseResponse {
  lists: ContactListWithCount[];
}

export class GetAllContactListsUseCase {
  constructor(private contactListsRepository: ContactListsRepository) {}

  async execute({ userId }: GetAllContactListsUseCaseRequest): Promise<GetAllContactListsUseCaseResponse> {
    const lists = await this.contactListsRepository.findAllByUserId(userId);
    return { lists };
  }
}
