using System;
using System.ComponentModel.DataAnnotations.Schema;
using isnd.Interfaces;
using Newtonsoft.Json;

namespace isnd.Data.Packages.Catalog
{
    /// <summary>
    /// An presence of package in a catalog,
    /// for availability, or deletion,
    /// 
    /// </summary>
    public class PackageRef : IObject
    {


        [JsonProperty("@id")]
        public string RefId { get; set; }

        /// <summary>
        /// Reference type :
        /// nuget:PackageDetails vs nuget:PackageDelete
        /// </summary>
        /// <value></value>
        [JsonProperty("@type")]
        public string RefType { get; set; }

        /// <summary>
        /// The NuGet Id
        /// </summary>
        /// <value></value>
        [JsonProperty("nuget:id")]
        public string Id { get; set; }

        /// <summary>
        /// The NuGet version
        /// </summary>
        /// <value></value>
        
        [JsonProperty("nuget:version")]
        public string Version { get; set; }

        [JsonProperty("commitId")]
        public string CommitId { get; set; }

        [ForeignKey("CommitId"), JsonIgnore]
        public virtual Commit LastCommit { get; set; }

        [JsonProperty("commitTimeStamp")]
        public DateTime CommitTimeStamp { get; set; }
    }
}