using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Printing;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace WpfApp3.Class
{
    [DataContract]
    public class MusicalInstrument
    {
        private string? photo;

        [DataMember]
        public string Name { get; set; }
        [DataMember]
        public string Type { get; set; }
        [DataMember]
        public string Brand { get; set; }
        [DataMember]
        public double Price { get; set; }

        [DataMember(Name = "deliveryDate")]
        private string? stringDate { get; set; }

        [IgnoreDataMember]
        public DateTime? deliveryDate
        {
            get
            {
                return stringDate == null ? null : DateTime.Parse(stringDate);
            }
            set
            {
                stringDate = value.ToString();
            }
        }
        
            public Uri? ImageBitmap
            {
                get
                {
                    var imageName = Environment.CurrentDirectory + "/img/" + (photo ?? "");
                    return System.IO.File.Exists(imageName) ? new Uri(imageName) : null;
                }
            }
    }
}

