using Avalonia.Media.Imaging;
using CommunityToolkit.Mvvm.ComponentModel;
namespace LANCommander.Launcher.ViewModels.Components;
/// Represents a single screenshot or video in the game detail media carousel.
public partial class GameMediaItemViewModel : ObservableObject
{
/// Local file path or remote URL for videos.
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(VideoPath))]
private string _path = string.Empty;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(VideoPath))]
private bool _isVideo;
///
/// Path for the inline video player — only populated for video items. The carousel
/// template instantiates an InlineVideoPlayer for every item (even hidden ones for
/// screenshots), so binding the screenshot path here would make libvlc try to "play"
/// the image and leak a decoder per item. Null for screenshots keeps the player idle.
///
public string? VideoPath => IsVideo ? Path : null;
[ObservableProperty]
private string _mimeType = string.Empty;
/// Pre-loaded bitmap for screenshot display (loaded from local file or remote URL).
[ObservableProperty]
private Bitmap? _imageSource;
/// When true, this item is a loading placeholder that will be replaced with real content.
[ObservableProperty]
private bool _isSkeleton;
}