Asurion Home+ receives a nested device catalog payload. Transform it into a flat list of eligible offers for a customer.
Implement filter_home_plus_offers(payload, category, max_price, min_rating). Include an offer only when its device has status equal to "active", its category matches the requested category, its available field is true, its price is at most max_price, and its rating is at least min_rating. If the same offerId appears more than once, keep only the occurrence with the lowest price. Return the results sorted by ascending price, then ascending offerId.
payload is a dictionary with a devices list.deviceId, brand, category, and status, plus an offers list.offerId and title, numeric fields price and rating, and a boolean field available.deviceId, brand, offerId, title, and price.def filter_home_plus_offers(payload, category, max_price, min_rating):