import { useDeviceModels, } from '../../../../lib/seam/device-models/use-device-models.js';
export const useFilteredDeviceModels = ({ filterValue, filters, brands, excludedBrands, }) => {
    const params = {};
    if (filterValue.trim() !== '') {
        params.text_search = filterValue.trim();
    }
    if (filters.supportedOnly) {
        params.support_level = 'live';
    }
    if (filters.brand !== null) {
        params.brand = filters.brand;
    }
    const query = useDeviceModels(params);
    // UPSTREAM: The API does not have a brands or excludedBrands query parameter,
    // so selected brands are filtered here.
    return {
        ...query,
        deviceModels: query.deviceModels
            ?.filter(({ brand }) => {
            if (brands === null)
                return true;
            return brands.includes(brand);
        })
            .filter(({ brand }) => {
            return !excludedBrands.includes(brand);
        }),
    };
};
//# sourceMappingURL=use-filtered-device-models.js.map