package cache

import (
	"github.com/fiskerinc/cloud-services/pkg/common"
	"github.com/fiskerinc/cloud-services/pkg/redis"
)

func FillCarFilterOnline(redisCLI redis.Client, filter *common.CarSearch) error {
	if filter.Online == nil {
		return nil
	}

	var onlineVehicles []string
	err := redisCLI.GetSet(redis.CarSessionsKey(), &onlineVehicles)
	if err != nil {
		return err
	}

	filter.Online.VINsOnline = onlineVehicles

	return nil
}
