package com.vaessl.app.search;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Component;

import com.vaessl.app.homebox.HomeboxItemClient;
import com.vaessl.app.shared.ServiceItem;
import com.vaessl.app.shared.ServiceType;
import lombok.RequiredArgsConstructor;

@Component
@RequiredArgsConstructor
public class HomeboxSearchProvider implements SearchProvider {

    private final HomeboxItemClient client;

    @Override
    public ServiceType getServiceType() {
        return ServiceType.HOMEBOX;
    }

    @Override
    public Page<ServiceItem> getSearchResults(SearchRequest request, Pageable pageable) {
        return client.hbResponse(request, request.query(), pageable).page();
    }
}
