import TVServices
/// Returns a single full-screen carousel hero (the hosted physarum loop) for the Top Shelf.
/// The previewVideoURL plays after the poster image transitions in. tvOS-only (TVServices).
///
/// API verified against the AppleTVOS SDK (TVServices framework headers): `TVTopShelfCarouselItem`
/// inherits `setImageURL(_:for:)`, `playAction`, and `displayAction` from `TVTopShelfItem`;
/// there is no `imageShape` on the carousel item (carousel images are HDTV-shaped by definition).
/// `ImageTraits` is an OptionSet — `[]` requests the default (un-scaled) variant.
final class TopShelfProvider: TVTopShelfContentProvider {
override func loadTopShelfContent(completionHandler: @escaping (TVTopShelfContent?) -> Void) {
let hero = TopShelfHero.shared
let item = TVTopShelfCarouselItem(identifier: hero.identifier)
item.setImageURL(hero.posterURL, for: [])
item.previewVideoURL = hero.videoURL
if let open = URL(string: "physarum://open") {
let action = TVTopShelfAction(url: open)
item.displayAction = action
item.playAction = action
}
let content = TVTopShelfCarouselContent(style: .details, items: [item])
completionHandler(content)
}
}