using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Xml.Serialization;

namespace MyApp
{
    public class Media : INotifyPropertyChanged
    {
        public string Name
        {
            get { return name; }
            set
            {
                name = value;
                OnPropertyChanged();
            }
        }
        string name = "";

        public string IconSource
        {
            get { return iconSource; }
            set
            {
                iconSource = value;
                OnPropertyChanged();
            }
        }
        string iconSource = "";

        public string FilePath
        {
            get { return filePath; }
            set
            {
                filePath = value;
                OnPropertyChanged();
            }
        }
        string filePath = "";

        [XmlIgnore]
        public bool IsPlaying
        {
            get { return isPlaying; }
            set
            {
                isPlaying = value;
                OnPropertyChanged();
            }
        }
        bool isPlaying = false;

        public string Genra
        {
            get { return genra; }
            set
            {
                genra = value;
                OnPropertyChanged();
            }
        }
        string genra = "";

        public Media(string name, string filePath)
        {
            this.name = name;
            this.filePath = filePath;
            iconSource = "pack://application:,,,/assets/video_icon.png";
        }
        public Media() { }

        public event PropertyChangedEventHandler? PropertyChanged;
        protected void OnPropertyChanged([CallerMemberName] string? name = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
        }
    }
}