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

namespace isnd.Data.Packages
{
    public enum PackageAction
    {
        DeletePackage,
        PublishPackage
    }

    public class Commit : IObject
    {
        [Key,
        DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [JsonIgnore]
        public long Id { get; set; }

        [Required][JsonIgnore]
        public DateTime TimeStamp{ get; set; }

        [Required]
        public PackageAction Action { get; set; }

        [NotMapped]
        public string CommitId { get => Id.ToString(); } 

        [NotMapped]
        public DateTime CommitTimeStamp { get => TimeStamp; }

        [ForeignKey("CommitNId")]

        public virtual List<PackageVersion> Versions { get; set; }
    }
}